# Python代写｜Coursework 2: MATH 3018/6141 – Numerical methods

A major use of numerical methods is in the creation of computer graphics in films, games, and other media. The generation of “realistic” animations of, for example,smoke, or water, or explosions, are typical problems. One case that remains difficult is the simulation of hair, particularly under external forces such as wind and rain.

The first reasonable model of human hair used the beam equation applied to each hair individually. This coursework follows that model. The model we use here makes a number of simplifying assumptions:

1. The human head is a sphere with radius 10 cm.

2. Each hair meets the head normal to the sphere.

3. The forces acting on each hair are gravity (in the −z direction) and a constant wind (in the +x direction).

We want to contruct the location of each hair. We will use the parameter s, which measures arclength along the hair, with s = 0 being the point where the hair meets the head and s = L being the point at the free end of the hair. Here we assume that L = 4 cm is the constant hair length.

The model works separately for each hair. It uses a mixture of coordinate systems.

The location of the hair will be displayed in the (x; y; z) coordinate system. The location of the hair will depend on the value of the independent variable s along its length.

The independent variable s takes the value s = L at the free end of the hair and, at the location where the hair meets the head, takes the value s = 0. The spatial position that the hair joins the head (at s = 0) is given by

Here θ0 and φ0 are coordinates on the head: θ0 is the latitude (angle away from hori zontal) and φ0 is longitude (angle away from the x-direction).

In contrast the angles θ(s) and φ(s) describe the local orientation (in space) of a given hair. The fact that the hair comes out of the head at right angles is given by the boundary conditions

The hair then bends under the influence of gravity and the wind force. Bending is described by the orientation (θ(s); φ(s)) changing with s, as we go along the length of the hair. A completely rigid hair would have constant θ(s) and φ(s). The simplified bending model leads to a system of 2 ODEs for each individual hair, which read

Here fg is a parameter describing the force from gravity relative to the bending stiffness of the hair. An appropriate value for human hair is fg = 0:1 cm−3 and we use this here.

The other parameter, fx, describes the force from the wind relative to the bending stiffness of the hair. In addition, the hair can move freely at its end (at s = L), which leads to the boundary conditions

We can determine θ(s) and φ(s), by solving the BVP defined in equation (3) with the two sets of boundary conditions found in equations (2) and (4). Once the angles θ(s) and φ(s) have been determined, the (x; y; z) coordinates of the hair can be found by solving the ODEs