Chapter 3

Realistic projectile motion with air resistance

One of the most classic and well-known problems in physics is projectile motion. Tossing a ball in the air, we expect to see it move in a familiar arched path. Under ideal conditions assuming constant gravitational acceleration and negligible air resistance, projectile motion is analytically solvable, i.e., its solutions are expressible in closed-form, known functions. Its properties such as the parabolic path are well explained from introductory physics. Free fall discussed in Chapter 2 is a special case of one-dimensional ideal projectile motion, while the general case is three-dimensional.

To describe realistic projectile motion, we need to consider the effects of air resistance, or drag, which can be significant and interesting. However, the inclusion of these effects renders the problem analytically nonsolvable, and no closed-form solutions are known except under limited conditions. Numerically, this presents no particular difficulty for us, given the toolbox and ODE solvers we just developed in Chapter 2. In fact, realistic projectile motion is an ideal case study for us to begin application of these numerical and visualization techniques to this classic problem in this chapter, for it is relatively simple, intuitive, and its basic features are already familiar to us. We will learn to construct models of appropriate degree of complexity to reflect the effects of drag and spin. Furthermore, we will also discuss the application of a recently discovered Lambert W-function to projectile motion, as well as methods of finding roots.

3.1 Visualization of ideal projectile motion

In his work Two New Sciences in 1638, Galileo theorized that a free body in motion was “compounded from equable horizontal and naturally accelerated downward motion, which I call ‘projection’.” Of course we recognize in today's nomenclature that Galileo was talking about ideal projectile motion which, if air resistance is ignored, moves with constant horizontal velocity and constant vertical acceleration, i.e., image and image. In 2D, this can be expressed in terms of differential equations similar to Eq. (2.1) as

image

where x, y and vx, vy are the components of position and velocity, respectively, and g the gravitational acceleration as usual. The analytical solutions to Eq. (3.1) are well known from introductory physics. For example, the projectile range is given simply by

image

where v0 is the initial speed and θ0 the initial projection angle. It is worth noting that the angle that maximizes the range is 45°, independent of speed in ideal projectile motion. We shall see that this is no longer true if air resistance is included.

Visualizing projectile motion is also straightforward. The program below displays perpetual projectile motion of a ball, captured in Figure 3.1.

Program listing 3.1: Ball toss (balltoss.py)

  1import visual as vp                           # get VPython modules for animation

  3vp.display(background=(.2,.5,1))    # make scene, ball, floor, and path
ball   = vp.sphere(pos=(−4, −4,0), radius=1, color=vp.color.yellow)
  5floor = vp.box(pos=(0, −5,0), length=12, height=0.2, width=4)
path = vp.points(pos=ball.pos, size=4)          # use make_trail in newer VP
  7h, g, vx, vy = 0.01, 9.8, 4.0, 9.8                     # Δt, g, and initial velocity
while True:
  9      vp.rate(400)                                              # limit animation rate
      ball.pos.x += vx*h                                   # update position
11      ball.pos.y += vy*h
      path.append(pos=ball.pos, retain=300)   # draw path, keep 300 pts
13      if ball.pos.y > floor .y + ball.radius:
              vy = vy − g*h                                  # above floor, update vy
15      else: vx, vy = − vx, − vy                         # below floor, reverse vel.

image

Figure 3.1: Snapshots of a ball toss from Program 3.1.

The program is very similar to Program 2.1 in both structure and flow. Note that the position attributes of objects such as the sphere include now both x and y components in 2D motion. We have added the path of the ball made with points, which is continually appended to in the loop (lines 6 and 12). The retain=n attribute keeps only the last n points, useful for ensuring smooth animation where a large number of points are generated. The position and the vertical velocity vy are updated according to Eq. (3.1) by first order Euler's method. When the ball would fall below the floor, its velocity vector is reversed, so the ball moves back and forth perpetually. The path traces out the familiar parabolic shape, with front-back symmetry. Experiment with different parameters such as g, and initial vx, vy, etc. What happens if only vy is reversed upon collision with the floor?

3.2 Modeling air resistance

Anyone riding a bicycle can feel the rush of oncoming air and the resistive force that grows with increasing speed. As a fact of life, air resistance is easy to understand but hard to quantify, because the underlying physics involves the interactions of a very large number of particles, and there is no exact form for that force. Nonetheless, we observe that, among other things, the force is dependent on the velocity of relative motion image. In particular, it is zero if image. This leads us to describe the resistive force phenomenologically by a power series as

image

Here image is the force due to air resistance (or drag), image is the velocity of the projectile relative to the medium (air), and image is the speed. The constants b1 and b2 are called linear and quadratic coefficients. The negative sign in front of b1 and b2 indicates that the drag force is opposite the direction of velocity.

Linear drag

Physically, the first term in Eq. (3.3) comes from viscosity of the medium. The linear coefficient b1 can be calculated from Stoke's law applicable to laminar (smooth) flow. We can understand qualitatively how b1 comes about from Newtonian physics.

image

Figure 3.2: Viscous fluid flow between two moving plates.

Let us consider a fluid between two large parallel plates shown in Figure 3.2. The top plate is moving with velocity v to the right, and the bottom one is stationary. We assume v is small, so the flow is smooth and separates into thin layers from top to bottom. The topmost layer moves at speed v, and the bottom one at rest, since they “stick” to the top and bottom plates, respectively. In between, we expect the fluid velocity to decrease uniformly, depicted as shrinking arrows in the figure.

To keep the top plate moving, a force to the right has to be applied on it to counter the drag from the layer below. Newton's conjecture is that the force should be proportional to the velocity v, the area of contact A between the plate and the fluid, and inversely proportional to the plate separation d, i.e., F1Av/d. Proportionality to v and A can be understood as follows: a larger v means a higher rate of momentum change for the fluid,1 and a larger A means a greater amount of fluid being pulled, so both factors lead to a greater force. As to the inverse proportionality to d, we imagine trying to push a piece of jello from the top, and the taller the jello, the easier to deform (less shear force).

Let the proportionality constant be μ, then

image

The coefficient μ is the viscosity. Its unit is kg/s/m, or Pa·s. The negative sign is added because the force is exerted on the plate by the fluid (Newton's third law).

For a sphere moving in a fluid, Eq. (3.4) does not apply since the velocity gradient (v/d) around it is not constant. Nevertheless, we expect Eq. (3.4) to give at least a rough estimate. Replacing A = 4πr2 (surface of sphere) and d = 2r, with r being the radius of the sphere, we have F1 = −2πμrv. The exact expression is

image

This is Stoke's law. Our estimate gives the correct dependence on the relevant parameters, but the constant factor is wrong (2 instead of 6), which is to be expected given the crudeness of our model.

If the velocity v is very small, linear drag is the dominant force. But as it turns out, the speed where the linear term dominates is usually quite low (see Exercise E3.3). Therefore for all practical purposes, the second order term is the important one.

Quadratic drag

The second term in Eq. (3.3) arises when the flow is turbulent, meaning that it is no longer laminar in nature. The dimensionless Reynolds number defined as

image

is the determining factor as to whether the flow is laminar or turbulent.2 Here, ρ is the fluid density, μ the fluid viscosity defined in Eq. (3.4), L the characteristic length of the object, and v the velocity. It is generally noted that the transition from laminar to turbulent flow for circular objects occurs at Re image 2300, i.e., the flow is laminar below 2300, and turbulent above it. For example, the transition occurs at about 0.5 m/s for a baseball, so the quadratic term plays the dominant role in practice.

image

Figure 3.3: An object of cross section area A moving at speed v. In time interval Δt, the air mass in its path is displaced and accelerated.

We can obtain the quadratic coefficient from elementary considerations. Let us assume an object (say a disc) with an effective cross sectional area A. As it moves through air with speed v in time interval Δt, it will displace all the air mass in its path (Figure 3.3). The amount of air displaced is equal to the cylindrical volume AvΔt swept by the disc, multiplied by air density ρ, or Δm = ρAvΔt. If, on average, the air mass Δm is accelerated to the speed v, the net gain of impulse is Δp = Δmv = ρAv2Δt. The force necessary to exert this impulse is given by Newton's second law, F = Δp/Δt = ρAv2. By the third law, the object (disc) experiences an equal magnitude but opposite force, −ρAv2. By this estimate, the coefficient b2 in Eq. (3.3) is identified to be b2ρA.

To be more precise, we let b2 = CdρA/2 and express the second term in Eq. (3.3) as

image

Now Cd is dimensionless, and is called the (quadratic) drag coefficient. To the extent that the linear drag force is negligible, then F2 image Fd, and F2 is usually referred to as the drag force. It is the dominant force from air resistance. This expression (3.7) is by no means fully accurate, but contains the essential physics.

Model building, realism, and complexity

Numerically, the nominal drag coefficient for spherical shapes is Cd ∼ 0.5. According to our estimation above, it should be about 2. The difference reflects the crudeness of our model, assuming uniform acceleration of displaced air mass, flat surface, etc. Here a word is in order about model building in computer modeling. A computer simulation is only as accurate as the ingredients contained in the model. Simple models may be crude, but they are useful for bringing out the essential physical features for a better understanding of the problem. Complex models, though more complete and accurate, may give results that are difficult to interpret. One can increase the accuracy by increasing sophistication of the model. There is clearly a tradeoff. In practice, it is usually a good idea keep the model as simple as possible within required realism.

For instance, the drag force of the form (3.7) with constant Cd is adequate for most projectile problems. We could certainly fine tune the model, e.g., by including some velocity dependence in the coefficient Cd. In fact, experimental evidence shows that Cd is velocity-dependent and not a constant over all the range of v. This dependence is displayed in Figure 3.4.

Figure 3.4 presents a rather interesting feature: a sharp drop in Cd at the critical speed ∼ 34 m/s for baseball. A similar drop occurs for smooth balls at a larger speed. Before and after the sudden drop, the drag coefficient remains relatively flat. The difference in Cd between smooth and rough balls is very interesting, and is mainly due to the boundary layer surrounding the ball. A rough ball (stitches on the baseball) creates a more turbulent layer than a smooth ball, so the onset of the drop occurs earlier. It is thought that at the critical speed, the turbulence produces a smaller wake, thus less air resistance and the precipitous drop in Cd.

It is convenient to fit the baseball data in Figure 3.4 to a simple form for use in simulations. We choose the following empirical formula

image

Figure 3.4: The drag coefficient as a function of velocity for smooth balls and baseball [32]. The data for baseball were derived from actual games at 1996 Atlanta Olympics [81]. The dashed line is a fit to the data.

image

Here, speed v is in m/s, and vc denotes the critical speed. The second term in Eq. (3.8) mainly causes the steep drop near vc, and the third term, an asymmetric Gaussian, yields the steep rise after vc.

From the above discussions on the velocity dependence of the drag coefficient, we see that the power series (3.3) is effectively of higher order than quadratic. In other words, an adequate representation of air resistance should include orders v3, v4, etc. Then, how meaningful is it to speak of quadratic air resistance? Because the drag coefficient Cd is rather flat outside the critical speed region, we take the view that Eq. (3.7) captures the essential quadratic nature of the drag force. However, we should keep in mind that if the velocity-dependent coefficient (3.8) is used, Eq. (3.7) effectively takes into account all orders within the specified range shown in Figure 3.4.

3.3 Linear air resistance

Though for practical purposes quadratic air resistance dominates for all but extremely small speeds, linear air resistance is nonetheless very insightful from the viewpoint of modeling because it is simpler and, surprisingly, even admits analytic solutions in terms of special functions. It is an ideal, first case study to begin our exploration into simulations.3

In this section, we shall discuss linear air resistance only. Ignoring the quadratic term in Eq. (3.3), we take the drag force to be linear

image

The Newtonian equations of motion with the net force of gravity plus linear drag image are

image

where m is the mass of the projectile, and x, y, vx, vy are the same as in Eq. (3.1). These four first-order ODEs (3.10) are slightly modified versions from Eq. (3.1).

3.3.1 Numerical simulation

The equations of motion (3.10) are tailor-made for a numerical integrator like Euler's or Runge-Kutta methods discussed in the Chapter 2. Similar to Program 2.5, we only need to supply a subroutine diffeq which returns the RHS of Eq. (3.10). So here it is, named Lin_drag:

Program listing 3.2: Linear drag (projectile.py)

  1import ode, numpy as np # ODE solvers, numpy import matplotlib.pyplot as plt # plot functions   3 def Lin_drag(Y, t): # projectile motion with linear drag   5 # returns RHS of Eq. (3.10) : [vx, vy, ax, ay] return np.array([Y[2], Y[3], −b1*Y[2]/m, −g − b1*Y[3]/m])   7 def go(vx=5., vy=5.): # default velocity =(5,5)   9 Y = [0., 0., vx, vy] # initial values, [x,y,vx,vy] t, h, x, y = 0., .01, [], [] # time, step size, temp arrays 11 while Y[1] >= 0.0: # loop as long as y>=0 x.append(Y[0]), y.append(Y[1]) # record pos. 13 Y, t = ode.RK4(Lin_drag, Y, t, h), t+h # update Y, t 15 plt.figure () # open fig, plot, label, show fig plt.plot(x, y), plt.xlabel(’x (m)’), plt.ylabel(’y (m)’) 17 plt.show() 19g, b1, m = 9.8, 0.2, 0.5 # g, linear coeff ., mass go(vx=10.0, vy=10.0)

In Lin_drag, the input array Y[0..3] is assumed to contain x, y, vx, vy in order. It returns a NumPy array converted from a list in order to use vectorized RK4. The array just contains the respective derivatives on the RHS of Eq. (3.10). It also requires the parameters b1 and m, which are chosen (somewhat arbitrarily) at the end of the code. The main function go() initializes the variables, calls RK4 in the main loop until the y-position becomes negative, and plots the results (similar to Figure 3.5). Note the front-back asymmetry in the ascending and descending parts of the trajectory and the sharp falloff toward the end. This is a signature of air resistance breaking the symmetry in ideal projectile motion.

3.3.2 Analytic solutions

Analytic solutions can be obtained in nearly the same straightforward manner as for numerical solutions. To make things a bit tidy, we redefine the linear drag coefficient by including the mass m of the projectile as

image

We begin with the x component of the velocity of Eq. (3.10), dvx/dt = −bvx, whose solution is

image

It shows that vx declines exponentially from v0x, the initial x velocity, when air resistance is included. Integrating vx to find x gives

image

where a starting position at the origin is assumed.

For the y component of the velocity, dvy/dt = −bvyg, and the solutions are

image

image

Note that the terminal y velocity as t → ∞ is −g/b.

Time t may be eliminated from x and y to get the trajectory as

image

image

Figure 3.5: The trajectories for projectile motion with linear air resistance at a large initial speed (b = 1 s−1, v0 = 200 m/s) for several firing angles.

Several sample trajectories are shown in Figure 3.5. Unlike ideal projectile motion, the trajectories with air resistance are no longer front-back symmetric. Note the steep drop-off after the peak at larger angles. It also shows that the range increases with decreasing angle. In addition, the maximum range is not at 45°. It is around 20° in this case (see Exercise E3.9).

Explicitly, the range, R, is defined as the x coordinate where y = 0, so

image

The range R is a root to Eq. (3.17), a transcendental equation. There are no known solutions in terms of elementary functions, though analytic solutions do exist, albeit in terms of a special function (see Section 3.4). To find the root without resorting to special functions, we need a numerical root finder. We take up this subject next.

3.3.3 Root finders

In scientific computing, we frequently encounter situations just described above where we need to find the roots of equations. Root finding is an important operation that we will be using in several chapters ahead. The basic task of root finding may be stated as follows: Given a function f(x), find a root x* such that f(x*) = 0. Equation (3.17) is such an example with f(R) equal to the LHS of the equation. We shall limit our discussion to two common, practical methods.4

Bisection method

The bisection method is a simple and sure way of finding a root, provided we know in advance that there is at least one root within an interval (bracket). It relies on the fact that the function f(x) changes sign when passing through a root. The basic idea is shown graphically in Figure 3.6.

Suppose a root is known to lie within an initial bracket [a, b], that is to say, f(a) × f(b) < 0. The bisection method works simply as 1-2-3 (see Figure 3.6): 1) cutting the bracket in half; 2) determining which new bracket contains the root; 3) repeating steps 1-2 until the bracket is sufficiently small.

Program 3.6 implementing these steps is given in Appendix 3.A. The function has the form bisect(f, a, b, eps). It requires as input a user-defined function f(x), initial bracket [a,b], and an optional error tolerance eps.

image

Figure 3.6: Bisection root finding method. Starting with an initial bracket [a, b] in which a root lies, the interval containing the root is successively halved (iterations marked 1 to 4), until the required accuracy is reached.

image

Figure 3.7: Newton's method of root finding. The left panel shows the successive steps of the process. In each step, the x-intercept of the tangent line is found, which is used as the next estimate for the root. The process is repeated until the change of the intercept is within allowed accuracy. The right panel shows the unstable nature of this method. In this case, the intercept cycles between two points endlessly.

Newton's method

Compared to the bisection method, Newton's method for root finding requires not only the function f(x) itself, but its derivative f′(x) as well. It can be a lot faster and more efficient when it works, but may also be unstable and less robust. Nonetheless, there are situations when this method is useful and appropriate, or even preferred.

The idea for Newton's method is illustrated in Figure 3.7. Starting with the initial guess x1, Newton's method uses the local slope to find the x-intercept of the tangent, x2 on the x-axis. Presumably, the point x2 is closer to the actual root, and it is used to find the next approximation, x3, and so on. Various stages are related by

image

Unless the derivative f′ is readily available, Newton's method is not suitable, especially if f′ is expensive to evaluate.

The mathematical basis of Newton's method is easy to understand. Suppose we expand f(x + δ) with our trusted Taylor series,

image

If we wish to find the correction δ which hopefully brings us closer to the root where f(x + δ) ∼ 0, then from Eq. (3.19) we have

image

This leads precisely to the correction terms in Eq. (3.18). The root solver, newton(f, df, x, eps), is given in Program 3.7 (Section 3.A). We supply the function and its derivative f(x) and df(x), the initial guess x, and the error tolerance eps as before.

Root finders library

As with the library for ODE solvers we develop, we will put both Programs 3.6 and 3.7 in a standalone library called rootfinder.py, and import it before use. Practice the use of bisect() and newton() with the next example and Exercise E3.8. The bisection method is robust, i.e., given a root known to exist within a bracket, it will find the root without fail. As such, the bisection method should be the first method to consider in a practical problem.

Numerical solution of range by root-finding

As an example, we solve Eq. (3.17) to obtain the dependence of range R on launching angle θ0. We use the program below, which yields the results shown in Figure 3.8.

Program listing 3.3: Range vs. angle (range.py)

import rootfinder as rtf, math as ma   # get root finders, math
  2import matplotlib.pyplot as plt # get matplotlib plot functions

  4def f(R):                                   # range function, Eq. (3.17)
      return R*(vy+g/b)/vx + g*ma.log(1.−b*R/vx)/(b*b)
  6
g, b, v0 = 9.8, 1.0, 100.            # g, linear coeff ., firing speed
  8x, y, dtr = [], [], ma.pi/180.      # temp arrays, degtorad conv

10for theta in range(1,90):
      vx, vy = v0*ma.cos(theta*dtr), v0*ma.sin(theta*dtr) # init vel
12      R = rtf.bisect (f, 0.01, vx/b−1.e−5, 1.e−6)           # solve
      if (R != None): x.append(theta), y.append(R)
14
plt.figure ()                              # open fig, plot, label, show fig
16plt.plot(x, y), plt.xlabel(’angle (deg)’), plt.ylabel(’R (m)’)
plt.show()

The function f(R) represents the range equation (3.17) to be solved. It uses several global variables defined in the main program, including vx and vy, components of the initial velocity that depend on the launching angle θ0. The function is supplied to the bisection root finder (line 12). Though the root lies between zero and infinity, the lower end of the initial bracket should be set to just above zero because it is a trivial solution. The upper end should be a large number, but not so large that the argument to the logarithm term in Eq. (3.17) becomes negative. This yields a maximum of vx/b for the upper end. Therefore, we set the bracket to [1, vx/b2], 1,2 > 0, on line 12. The next line checks to make sure a valid root is found (not None) before storing the results.

The results (Figure 3.8) for two initial speeds show a steep rise from small angles to the maximum, and a shallower falloff toward larger angles. The maxima occur at angles much earlier than 45°, and there is no symmetry as there would be for ideal projectile motion. Achieving the maximum range requires optimal balancing between the time of flight and the horizontal velocity. With air resistance, it is more important to have a larger horizontal velocity and a smaller time of flight because the former decreases exponentially (3.12), leading to a smaller angle θmax that maximizes the range.

image

Figure 3.8: The range as a function of launching angle for projectile motion with linear air resistance (b = 1 s−1, v0 = 50 and 100 m/s).

We note that θmax decreases as the speed increases (∼ 22° vs. 15°). Qualitatively, this can be understood as the balancing act discussed above. However, it begs an interesting question: How fast does θmax decrease? How does it scale with the initial speed? We turn to a special function next for answers.

3.4 The Lambert W function

As mentioned earlier, Eq. (3.17) does not possess analytic solutions in terms of elementary functions, so numerical solutions have traditionally been obtained by means of root finding. However, it turns out that it does have analytically exact solutions in terms of a special function, the Lambert W function. Though discovered (or rediscovered) only recently, the Lambert W function has been linked to the solutions of a growing number of problems where only numerical solutions were thought possible previously. These problems include projectile motion with drag, Wien's displacement law in blackbody radiation, and the Dirac δ-molecule (see Section 9.3.2 and Ref. [90, 94] for more examples). Because it is important to compare numerical and analytic solutions where possible for testing numerical methods, we will briefly introduce this special function and its application to projectile motion with linear drag below.

The Lambert W function is defined as a function satisfying the following inverse relation for a given z,

image

This definition is similar to stating that the square root function f is defined such that f(x) × f(x) = x for a given value of x ≥ 0. Some special values can be inferred from Eq. (3.21):

image

image

Figure 3.9: The Lambert W function for real argument x. The two real branches are: the principal branch W0 (solid line), and the secondary branch W−1 (dashed line). The branch point is at x = −e−1 and W = −1.

The Lambert W function is generally complex-valued (see Ref. [20, 46] for general properties). For our purpose we are interested in the real-valued W(x), shown in Figure 3.9. There are two branches, the principal branch W0, and the secondary branch W−1.

The power series expansion for W is

image

Asymptotically, W(x) behaves largely like the logarithm function,

image

Without the prefactor, Eq. (3.21) would be the inverse of an exponential function, i.e., an exact logarithm.

Evaluation of W

Unlike elementary functions, the Lambert W function has yet to make its way on a handheld calculator with a dedicated button. Fortunately, it can be computed efficiently and accurately using the root finders we have discussed.5 For a given x, the value of the W function is the root w to

image

according to Eq. (3.21). Whereas the bisection method would certainly work, Newton's method is preferred here for its rapid convergence. Making use of the derivative of f(w) in Eq. (3.25) as

image

Newton's method for the W works as follows (see Eq. (3.18)): Starting with an initial guess w1 and assuming local stability, successive iterations wn approach rapidly to the true value as,

image

It only remains to determine the initial guess w1. We choose w1 to be

image

Equation (3.27) with the seed from (3.28) always converges to the correct branch W0 or W−1.

The actual implementation for the Lambert W function is given below.

Program listing 3.4: Lambert W function (lambertw.py)


  1import math as ma                   # import math library
def lambertw(x, branch = 0):    # branch = 0 or1
  3      if (x<−1.0/ma.e or branch<0 and x>=0.0): return None # bad arg
      w, nmax = x, 20
  5      if (x > 1.5 or branch == −1): w = ma.log(abs(x))

  7      for i in range(nmax):
            w, v = (w*w + x*ma.exp(−w))/(1.0+w), w # Eq. (3.27)
  9            if (abs(w−v) <= 1.e−15*abs(w)): break # to double precision
        return w

The module lambertw() accepts an argument x and an optional branch switch. If the argument is invalid, a type None is returned. Otherwise, it computes the value by Eq. (3.27) and checks for convergence in the loop. The convergence is fast, usually to machine accuracy in just a few iterations in nearly all cases.

There is one exception, however. It occurs near x ∼ −1/e for both branches, where f(w) ∼ −1 and the derivative vanishes, f′(w) ∼ 0. This causes slow convergence in Newton's method in the immediate neighborhood around −1/e. If accurate values are required in this narrow region, we may switch to the bisection method which does not suffer from the vanishing derivative problem. Alternatively, we may also use the rational polynomial approximation (Section S:3.A). Otherwise, Program 3.4 works very well for computing the Lambert W function on the real branches, W0 and W−1. We will use it next.

Analytic solution of range by Lambert W function

Until recently it was thought that the transcendental range equation (3.17) admitted only numerical solutions. Having introduced the Lambert W function, we are now ready to discuss how it can be used to solve Eq. (3.17) analytically.6 To begin, Eq. (3.17) may be rewritten in exponential form as

image

Our strategy is to cast the above equation into the same form as the defining equation for the Lambert W function (3.21), where the multiplicative factor in front of the exponential is the same as the exponent. This can be accomplished by multiplying both sides of (3.29) by c exp(−cv0x/b) to give

image

All R-dependence has been moved to the LHS of Eq. (3.30), and the prefactor is the same as the exponent. Comparing Eq. (3.30) with (3.21), we identify the following,

image

Expressing R in terms of W(z) and explicitly substituting in c, we have for the range

image

This is the analytic solution for the range in terms of the special Lambert W function. Since the argument z in Eq. (3.32) is negative, and W(z) is multivalued with two branches (Figure 3.9), how do we decide which one to use, W0 or W−1? Mathematically, both are correct solutions. Physically, the valid choice is the primary branch W0, since W−1 would produce a negative range. It is understood that W0(z) must be used in Eq. (3.32).

With the use of the special W function, projectile motion with linear air resistance is now completely and analytically solvable. The analytic solutions can help us determine the accuracy of the numerical methods, and to validate the program (see Project P3.2). Furthermore, it can also help us answer several interesting questions, including one posed earlier about the scaling law, namely: How does the range-maximizing angle, θmax, scale with the initial speed? It turns out the scaling law is rather simple but powerful,

image

It predicts that, for increasing speed v0 (or equivalently drag b), there exists a small but finite angle that maximizes the range. Proof of the scaling law and its further exploration are left to Exercise E3.12.7

3.5 Quadratic air resistance and spin

In the preceding sections we had a thorough airing-out of projectile motion with linear resistance. But in most cases, the quadratic term in Eq. (3.3) dominates. No known analytic solutions exist with this type of resistive force, except for one special case where we restrict the projectile to a straight up-down motion.

3.5.1 Quadratic air resistance

For the general case involving quadratic drag forces, we will have to rely on an ODE solver to get numerical solutions. The equations of motion similar to Eq. (3.10) but for quadratic drag forces are

image

where image is the projectile speed. The appearance of the square root in Eq. (3.34) makes the problem unsolvable analytically.

Numerically, we need a diffeq that returns the RHS of Eq. (3.34) for quadratic drag. We call it Quad_drag given below.

def Quad_drag(Y, t): # returns RHS of Eq. (3.34): [vx, vy, ax, ay] v = np.sqrt(Y[2]*Y[2] + Y[3]*Y[3]) return np.array([Y[2], Y[3], −b2*v*Y[2]/m, −g − b2*v*Y[3]/m])

Being equivalent to Lin_drag in Program 3.2, Quad_drag assumes the array Y[] holding x, y, vx, vy in that order. We can plug Quad_drag in an ODE solver just like in Program 3.2 and obtain the desired results.

One complication with quadratic air resistance is that the drag coefficient Cd changes with speed, and has a dramatic drop near critical speeds (Figure 3.4). The effect can be simulated with Quad_drag, and sample results are shown in Figure 3.10 for both constant Cd and changing Cd from Eq. (3.8).

image

Figure 3.10: The trajectories for projectile motion (baseball) with quadratic air resistance with constant Cd (solid), changing Cd (dashed), and zero Cd (dotted).

With realistic drag coefficient used, we can see significant effects of air resistance. As expected, a constant Cd = 0.5 produces the shortest range. A changing Cd from Eq. (3.8) increases the range by about 20%, mainly because of reduced drag at the critical speed. Of course, both are significantly smaller than the ideal range without air resistance.

It is interesting to note that greater dynamical influence happens sooner than the closeness of the trajectories in Figure 3.10 seems to suggest, because the points in the trajectories correspond to different moments in time. In fact, the greatest difference in acceleration, particularly the horizontal component, occurs at the beginning where the speed is largest. To a significant degree, this initial phase determines subsequent motion, including the difference in range.

Even with air resistance, projectile motion remains in a vertical plane. Sideway (transverse) motion can occur if airflow such as wind is introduced. In that case, the motion becomes three-dimensional, and 3D simulation is necessary. We can extend the model because the drag force depends on the relative velocity, image, between the projectile and air (wind). If air is flowing with a wind velocity image, the drag force becomes

image

The full 3D equations of motion are (see effect in Project P3.8)

image

3.5.2 Effects of spin

Transverse motion can also occur if airflow is deflected off the direction of motion. Many an example can be found in everyday life, including in sports such as baseball and ping pong where the ball can move in curving, lateral directions.

Redirection of airflow can be accomplished by moving objects having uneven shapes or spin. Figure 3.11 shows a sketch of airflow around an aerofoil and a spinning ball in a wind tunnel.

image

Figure 3.11: Schematic airflow around an aerofoil (left) and measurement of a suspended ball spinning in a wind tunnel (right). The ball is spinning counterclockwise (Photo credit: F. N. M. Brown, Univ. of Notre Dame).

It is clear from the sketch that as air flows past the aerofoil, it is bent downward. There must be a net downward force exerted on the airflow by the aerofoil. By Newton's third law, the aerofoil experiences an equal magnitude but opposite force from the airflow, i.e., an upward lift.8

Similar effect exists for a spinning ball, as the wind-tunnel experiment shows. The ball is spinning counterclockwise and the wind is blowing to the left. We can see a puff of smoke downstream which comes off the spinning ball, and is deflected downward. The airflow over the top is “carried” around the ball more due to rotation. Again, by Newton's third law, this means a net downward force is acting on the air mass due to the spinning ball. The ball must experience a reciprocal upward force. This effect is known as the Magnus effect (force). It is schematically shown in Figure 3.12.

image

Figure 3.12: The Magnus effect on a spinning ball. Airflow past the spinning ball (counterclockwise) is bent downward. The direction of the force image on the ball is given by the vector product image, upward here.

The magnitude of the Magnus force is found to be proportional to the angular velocity image as well as to the linear velocity image of the ball. Its direction is given by the cross product image. The final result is

image

where α is a constant with the dimensions of mass. Because the direction of the Magnus force is perpendicular to the velocity, the ball will always curve, but will not change speed by this force alone (no work). Thus, if a ball travels forward spinning around its vertical axis, the Magnus force will be lateral, inducing a sideway motion to either the left or the right.

Analogous to Eq. (3.7), the Magnus force for a sphere is often written as

image

where CL is called the lift coefficient. The virtue of writing it this way is that when image, the magnitude is simply Fmagnus = CAv2/2.

Undoubtedly, we expect CL to depend on quite a few things such as the roughness of the ball. Given the roughness, CL is experimentally found to be mainly a function of the so-called spin parameter, S = rω/v. Putting all together, we have

image

Here, ρ and A are the air density and cross section, respectively (same as in (3.7)), and r is the radius of the ball. Effects of both drag and Magnus forces should be included in more realistic simulations of projectile motion, and are considered next.

3.6 Physics of ball sports

Sports games such as baseball, ping pong (table tennis), and soccer bring out the fans to share the excitement. To a physicist, the games are fascinating because they bring out the interesting effects due to drag and spin [22]. At times it seems the ball is doing nearly impossible tricks as it moves from point A to point B, be it a curveball, a back chop, or a corner kick. We have discussed the basic physics needed to understand the complexity in the ball movement. We are interested in the combined effects of drag and spin on a ball in flight.

3.6.1 Physics of baseball

Baseball may be low in scoring (normally), but very high in physics content [2, 3]. We lead off with baseball in our discussion.

Lift coefficient for a baseball

Like the drag coefficient, accurate lift coefficient CL in Eq. (3.39) needs to be determined experimentally. Figure 3.13 shows experimental data of CL as a function of the spin parameter S for a baseball.

image

Figure 3.13: The lift coefficient as a function of spin parameter for a baseball. The line is a fit to the data [67] shown as symbols.

The data are an aggregate of several measurements using a variety of techniques in wind tunnels and open labs. The value of CL increases with S. Within the data scatter, it is approximately linear in S, though there is noticeable curvature near small values of S. As we might expect from the parameterization of Cd (3.7), CL must have a more complex dependence than on S alone. Experimental evidence shows that CL is also dependent on the Reynolds number, although it is relatively weak. Nonetheless, it is useful to have a simple form similar to Eq. (3.8) for use in simulations. We choose a power law as

image

This relationship is displayed in Figure 3.13.

Forces on a baseball

With the drag and lift coefficients determined, we can examine and compare quantitatively the forces acting on a baseball in flight. They are shown in Figure 3.14.

The quadratic drag force grows with v2 until around 30 m/s where it starts to decrease due to the drop-off in the drag coefficient near the critical speed (Figure 3.4). It rebounds afterwards, is equal to the weight of the baseball (gravity) at about 43 m/s (97 mph), and exceeds gravity eventually. Therefore, quadratic drag has considerable effect on the path and range of a baseball, as Figure 3.10 depicts.

image

Figure 3.14: The forces acting on a baseball as a function of speed. The spin of the baseball is 200 rad/s (1900 rpm).

The Magnus force, on the other hand, grows monotonically as a power law, slightly faster than linearly in v. Of course, it would be exactly linear if the exponent in the scaling law (3.40) were 1, which is reasonably valid within the scatter of Figure 3.13 for larger spin parameters S. In the latter case, it is simpler to use Eq. (3.37) with a constant α for the Magnus force.

Because the Magnus force is perpendicular to the velocity, it always deflects the moving body, making it appear to “curve” and more perceptive to visual detection by the naked eye. This is especially true in sideway curves where gravity has zero effect.

The equations of motion, including gravity, drag image, and the Magnus force image, are

image

Here image is the position vector, with x referring to the forward motion, y the vertical motion, and z the lateral (sideways) motion. This is a set of 6 ODEs to be solved.

Before doing a full scale simulation, it is useful to have an estimate of the effects. Let us estimate the magnitude of the Magnus force at speed v = 30 m/s (∼ 70 mph) and angular velocity ω = 100 rad/s (950 rpm). By scaling from Figure 3.14, we obtain a Magnus force that is roughly 1/6 of gravity, which is equivalent to an acceleration of g/6. If the ball is thrown from the pitcher's mound, it takes about 0.6 seconds for it to travel to the home plate (a distance of 18.4 m). Over this period, the Magnus force causes a lateral displacement of 0.3 meters (nearly one foot), a substantial amount of adjustment for the hitter. For comparison, a ball would drop about 1.8 m in the same period by gravity.

Visualization of realistic flight of a baseball

We solve Eq. (3.41) and display the motion with VPython in Program 3.8 listed in Section 3.B. The trajectory is shown in Figure 3.15.

image

Figure 3.15: Views of a curveball from the front, behind, and above (bird's eye). Also shown is the ideal projectile motion (darker/green, without the ball). The coordinates are such that from the bird's eye, x axis points to the right, y axis out of page, and z axis down.

The essential physics is contained in the function baseball().

def baseball(Y, t):                                                # Y = [r, v] assumed
       v = Y[1]                                                        # name v for clarity
       fm = alpha*vp.cross(omega, v)                     # Magnus force
       a = (fm − b2*vp.mag(v)*v)/mass − [0,g,0]    # minus gvec
       return np.array([v, a])                                  # np array

Because the motion becomes three-dimensional when spin is involved, it is much easier to use vector objects. The program uses vectors as the basic building blocks instead of individual vector components like x, vx, etc. Vector operations can be simulated using NumPy arrays, which can be added or multiplied like true vectors (see Program 2.5 and Section 1.D). As stated in Chapter 2, our vectorized ODE solvers like RK4 works transparently on vector objects as on scalar objects without any change.

The input Y is assumed to be a 2×3 NumPy array containing the position and velocity vectors as image. The output is the RHS of Eq. (3.41) in a NumPy array consisting of velocity and acceleration vectors image. We calculate the Magnus and drag forces using VPython's vector functions such as the magnitude vp.mag() and the cross product vp.cross(). This makes our life easier and the code more compact. Note that in the calculation of acceleration, the gravity vector image is simply represented by a list −[0, g, 0], not a NumPy array. This is possible because when a list is added to a NumPy array, it is automatically broadcast to an array type before adding.

The actual trajectory can be seen to rise above and curve to the left relative to ideal projectile motion (Figure 3.15). This is due to the ball rotating with a back and side spin, i.e., ωz > 0 (back) and ωy > 0 (side).

Quantitative results are shown in Figure 3.16. Both the lateral shift (z, curving) and the vertical rise (Δy) represent the difference between two cases: with or without spin (drag is included in both cases). The side spin – rotation about the vertical axis – is responsible for curving to the left (negative z), and the back spin for the rise (lift). The amount of curving and rise is nearly identical because the angular velocity components are the same. We note that the lift produced by the back spin actually increases the range of motion. This fact turns out to be very important in golf for long drives as we will see shortly. Conversely, we could reverse it to a top spin (as if rolling in the forward direction). Then the ball would appear to sink faster.

The program uses constant drag and lift coefficients. It can be improved by using variable Cd and CL. Then, the simulation could be considered fully realistic. Even then, we must remember that there are uncertainties and fluctuations in actual games, so our results should not be taken as perfectly accurate. However, the trend and conclusions we draw from these effects are valid.

image

Figure 3.16: The lateral shift (z) and vertical rise (Δy) of a baseball with spin relative to no spin. The parameters are the same as in Program 3.8.

A final caveat: in all likelihood, the ball's spin rate (ω) is not constant, and there is little data at present on how it precisely changes. If we assume the torque is proportional to angular velocity, we expect an exponential decay (see Eq. (3.12)) as

image

where ω0 is the initial angular velocity and τ the characteristic decay time.

3.6.2 Golf, ping pong, and soccer

We briefly discuss key elements of physics involved in golf, ping pong, and soccer games. We mainly present the results, and leave the details to be investigated in projects.

Long golf drives

Golf balls have a roughened surface with small depressions, or dimples. Coupled with its smaller size (diameter 4.3 cm) and mass (46 g), and high spin rate (up to 10,000 rpm), drag and Magnus forces can have much larger effects on the range and direction of golf drives.

The drag coefficient for a golf ball is qualitatively similar to data for smooth balls shown in Figure 3.4. Quantitatively, however, the critical speed happens at a much smaller value, and the dip, present in baseball data, appears to be much smoothened [32]. As a result, we can approximate the drag coefficient by dropping the third term from Eq. (3.8) as

image

with v in m/s.

The lift coefficient is also qualitatively similar to that for baseball (see Figure 3.13), at least at higher Reynolds numbers (Re ≥ 105), and can be roughly described similarly to Eq. (3.40)

image

image

Figure 3.17: Trajectories of golf with different amount of spin.

Sample results are shown in Figure 3.17 for a firing angle of 20° and speed of 60 m/s. For simplicity, we assume constant backspin only. The spin rates are none, normal (∼ 8000 rpm), and double spin. Compared to the case of no spin, the range is increased by roughly 1/3 with normal spin, and nearly 1/2 with double spin. The increase in range is due to lift which primarily increases the height, and hence the time of flight. The change in the maximum height is even more dramatic, approximately doubling in each step. It shows the strong influence of the Magnus force that can be greater than gravity and drag combined. We can see this in the double spin case where the beginning part of the trajectory actually curves upward. Another notable feature is that the front-back asymmetry is less pronounced for golf than for baseball when spin is included. The back end of the trajectory falls off less steeply, owing to the relatively strong Magnus force that “stretches” the peak out on both sides.

If the rotation is not purely backspin, curving can also occur. This may be used to counter such factors as wind or other obstacles. Of course, given how strongly spin affects the trajectory of a golf ball, controlling the flight by imparting a proper spin on the ball can be tricky.

Ping pong smash

Ping pong games are played with a ball that has a 4.0-cm diameter and 2.7-g mass. Unlike other ball sports, ping pong balls have a rather smooth surface. It is played over a table that is 2.72 m long and 1.53 m wide. In the middle of the table is a net, 15.3 cm high.

Ping pong is rather unique due to its small mass and the compact playing area. Of all ball sports, spin is most important in ping pong games. Top spin rates can easily reach 6000 to 8000 rpm, and top speeds can be more than 40 m/s. These factors make ping pong one of the fastest sports where quick reaction and accurate anticipation of ball movement is crucial [98].

Figure 3.18 shows part of a rally in a singles ping pong game at the 2012 London Olympics. The plot shows the last two plays by each of the players (not shown). It starts with the player to the right hitting the ball from the upper-right corner, and ends with the player to the left who returns the ball with sufficiently large side-spin that the ball curves and bounces off the table near the edge, out of the opponent's reach. The right panel shows the last play, with a dotted line superimposed to illustrate the amount of curving.

Because ping pong balls are smooth, we expect the drag coefficient shown in Figure 3.4 should work well. Furthermore, since the critical speed for smooth balls occurs at a rather large value relative to the speeds ping pong is played at, we can safely set the drag coefficient to 1/2. For the lift coefficient, available data suggests that a linear function of the spin parameter should be adequate [83]. Therefore, we can use the following in our ping pong simulation,

image

Figure 3.18: Overhead view of trajectories of a ping pong ball in a game at the 2012 London Olympics. Left: the rally starts from upper-right corner and ends at the lower-right corner when the ball bounces off the table. Right: the last return in the rally showing curved path; the dots are in a straight line to guide the eye.

image

image

Figure 3.19: Trajectories of ping pong with different amount of spin. Left: side view; Right: vertical view.

Representative results are shown in Figure 3.19. Parameters are used to mimic the conditions of an overhand smash: an initial speed of 25 m/s, and a spin of 60 rev/s (3600 rpm) in the direction (1, 0, −1), i.e., roll-spin (ωx > 0) and topspin (ωz < 0). The coordinates are such that the x-axis runs along the length of the table, the z-axis along the width, and the y-axis is vertical as usual. The left plot again shows three cases, no spin, normal spin, and double spin. Without spin, the ball flies past the far end of the table, and the player loses a point. But with normal topspin, the Magnus force is downward (negative lift). The ball sinks, just clears the net, and lands in play. This is a good smash. In this case, we also allow the ball to bounce back up with a loss of energy, i.e., reversing image. Too much spin, the ball accelerates downward too fast, and is blocked by the net (but allowed to continue in the simulation).

In the overhand smash, we also assume a roll-spin in the positive x-direction, a clockwise rotation from the attacking player's perspective. This causes a slight curving motion to the left (Figure 3.19, right panel). The amount is small because in the cross product image, the z component of the Magnus force is proportional to ωxvy. The initial value of vy is small, and |vy| increases due to gravity and the negative lift as the ball travels across. Hence we see increased curving later on. After the bounce (normal spin), the vertical velocity is reversed, and that slows down the rate of curving.

In comparison to baseball, the effect of spin is about 5% to 10% for ping pong judging from Figure 3.19 (left), and 1% to 2% for baseball from Figure 3.16. Spin plays a more important role in ping pong games.

Soccer corners

Last but not least, we turn our attention to the most popular sports the world over, soccer. The soccer ball is considerably bigger and heavier than the cases discussed so far, but the effects of drag and spin are no less important [97]. Casual spectators can easily spot the curving of the ball in long passes. Curving is such an important art in soccer that set plays such as direct kicks or corner kicks are major scoring opportunities. In direct kicks, for example, players form a human wall to block the direct path of the ball to the goal. However, a skilled player could curve the ball around the wall and score. Direct scoring is also possible, albeit more difficult, in corner kicks.

Typical soccer speeds are below 30 m/s, and spin rates roughly under 160 rad/s (25 rev/s). The drag and lift coefficients for soccer are shown in Figure 3.20. The drag coefficient again exhibits the critical speed phenomenon, but the dip is relatively shallow because of low roughness of soccer balls. We see weak dependence of the lift coefficient on the Reynolds number Re: a higher Re leads to a slightly higher CL.

image

Figure 3.20: Drag and lift coefficients for soccer [5, 36]. The data for the lift coefficient correspond to different Reynolds numbers from 3.3 to 4.5 × 105.

The parameterized expression similar to Eq. (3.8) for the drag coefficient can be written as

image

This relation is shown in Figure 3.20 as the dashed line. The average lift coefficient is modeled as

image

Except for the smallest spin parameter (S) values, we may assume CL as a linear function in S, with appropriate adjustment of the constant factor. In this case, we can use the constant α defined in Eq. (3.39).

Using these coefficients, we have the necessary physics to simulate realistically the flight of soccer balls with a code similar to Program 3.8. Figure 3.21 displays a corner kick which, absent a virtual goal keeper, would result in a direct, curling goal.

image

Figure 3.21: Trajectories of a soccer ball in a corner kick with (curving) and without spin, from forward (top) and reverse (bottom) angles.

3.7 Shooting methods

We have dealt with initial value problems, that is, given initial conditions, we integrate the equations of motion to find out where the trajectory ends up. There is another scenario in which we want the ball to end at some specified position, and we wish to know what initial conditions will lead it there. For instance, if we want to kick a ball so that it clears a bar (or hits a spot) at certain distance, what kicking angle should we aim initially? Problems of this kind are called two-point boundary value problems.

One way to solve such a problem seems straightforward, trial and error: pick a value, run the simulation, check the result, adjust and repeat. As illustrated in Figure 3.22, we want to find the launching angle leading the projectile to the boundary point at (xb, yb). The first pass overshoots, the second one undershoots, and the third try is the correct angle. This is the basic idea of the shooting method.

image

Figure 3.22: The shooting method. Trial 3 is the correct solution.

Manual adjustment can work, but is inefficient if high accuracy is required. In that case, it is better to cast the problem into a form suitable for automatic adjustment. Below we discuss an example using root finders.

We assume a projectile is launched from the origin with a given speed v0. Our goal is to find the firing angle θ such that the projectile hits the point at (xb, yb) (Figure 3.22). For a given θ, let the projectile reach xb in time t, where its vertical position is y(t). The condition for the correct θ satisfying the boundary values is

image

The first equation in (3.48) defines time t, which is an implicit function of θ. We rewrite Eq. (3.48) as a pair of functions

image

image

We have treated θ explicitly as the independent variable in Eq. (3.49b). We can solve the two equations by finding the roots to fx(t) = 0 for t first, then fy(θ) = 0 for θ, the desired solution.

The shooting method can be implemented as follows.

  1. For a given θ, solve (3.49a) for t, by integrating the equation of motion such as (3.1) or (3.34) to obtain x(t) and by root-finding as necessary.
  2. Find y(t) by integrating the same equations of motion to t. Return y(t) − yb as fy(θ), (3.49b).
  3. Feed fy(θ) to a root finder to obtain the desired θ, using the bisection method to be safe.

This strategy is used in sample Program 3.5.

Program listing 3.5: Shooting method (shoot.py)

  1from _future_ import print_function # use print() as function import ode, rootfinder as rtf, numpy as np # ode, root solvers, numpy   3 def proj(Y, t): # ideal projectile motion   5 return np.array([Y[2],Y[3], 0.0, −g]) # [vx,vy,ax,ay]   7def fy(theta): # return f as a func of theta Y = [0., 0., v0*np.cos(theta), v0*np.sin(theta)] # [x,y,vx,vy]   9 t = xb / Y[2] # Step 1: time to xb h = t / nsteps 11 for i in range(nsteps): Y = ode.RK2(proj, Y, t, h) # no need to update t 13 return Y[1] − yb # Step 2: y(θ) − yb 15 # number of steps, g, init speed, x and y boundary values 17nsteps, g, v0, xb, yb = 100, 9.8, 22., 40., 3. # para. 19theta = rtf. bisect (fy, 0.6, 1.2, 1.e−6) # Step 3: shoot for θ if (theta != None): print(’theta(deg)=’,theta*180/np.pi) # result

To be concrete and avoid unnecessary clutter, we neglect air resistance, i.e., assume ideal projectile motion. This simplifies the first step (line 9) since we can find the time simply as t = xb/v0x without integrating the equations of motion or using a root finder.

In the function fy(theta), y(t) is calculated using the RK2 ODE solver. Though it is unnecessary because analytic solutions are available, we do it this way so it can be easily generalized to cases involving air resistance, for example. By the same token, the value of nsteps does not matter in the ideal case, because RK2 yields exact solutions for ideal projectile motion regardless of the step size. After setting the initial speed and boundary point (line 17), the bisection method is called to find the solution. The key to be successful lies in choosing the initial bracket. There are usually two solutions if the initial speed is sufficiently large. In the present case, the solutions are 33.1° (ascending) and 61.2° (descending).

Chapter summary

The focus of this chapter is on one of the most classic and celebrated problems in physics, realistic projectile motion. We have discussed the effects of air resistance and spin. The drag force is broken down into linear and quadratic powers in speed. We modeled them separately. In the case of linear drag, we have presented a new method of solution in terms of the Lambert W function. We briefly described the key properties of W and several ways of evaluating it. With the help of the W function, the closed-form solutions enable us to compare numerical and analytic solutions and to gain more insight than possible with only numerical solutions, such as the asymptotic scaling law for the angle that maximizes the range.

For the quadratic drag which dominates in practice, we discussed the dependence of the drag coefficient on speed, models to parameterize it, and its effect on projectile motion. We also introduced the Magnus force and discussed its effect, as well as modeling of the lift coefficient. Finally, simulations combining drag and spin are applied to the study of physics of sports, including baseball, golf, ping pong, and soccer. Both qualitative and quantitative results have been presented to help explain the observed effects.

Numerical methods for root finding have been discussed, including bisection and Newton's methods. They are included in one of the libraries that we will use frequently in the chapters ahead. We introduced the shooting method for two-point boundary value problems. We have also introduced visualization techniques using 3D capabilities of VPython and applied them to illustrate realistic projectile motion effectively and from unique perspectives.

3.8 Exercises and Projects

Exercises

E3.1 Modify Program 3.1 to use the RK2 ODE solver.
E3.2 Use dimensional analysis to show that the linear drag force must be of the form given by Eq. (3.4) without the explicit factor 6π.
E3.3 Calculate the speed at which the transition from laminar to turbulent flow occurs for a baseball. The viscosity and density of air are μ = 1.810−5 kg/m/s and ρ = 1.2 kg/m3 under standard atmospheric conditions. The mass of a baseball is 0.15 kg, and the diameter is 7.4 cm.
E3.4 Estimate the size of falling rain drops if their speed ranges typically from 10 to 30 km/h.
E3.5 Find the speed at which the linear and quadratic drag forces are equal for a baseball. Do the same for a ping pong ball.
E3.6 Verify that Eqs. (3.13), (3.14) and (3.15) are solutions to (3.10). Also derive the range (3.16).
E3.7 In the limit b → 0, show that Eqs. (3.16) and (3.17) reduce to the expressions for ideal projectile motion, with the former to

image

and the latter to Eq. (3.2), respectively.

E3.8 (a) Use both the bisection and Newton's methods to find the roots of f(x) = 5xx3. Investigate what happens when the initial guess is at ±1 in Newton's method.

(b) Alternatively, find the roots using SciPy's equation solver, fsolve, which requires a (vector) function and an initial guess, as shown below:

In [1] :   from scipy.optimize import fsolve
In [2] :   def f(x): return x*(5.−x*x)
In [3] :   x = fsolve(f, −2.)
E3.9 Solve Eq. (3.17) to find R as a function of θ with both the bisection and Newton's methods. Take b = 1 s−1, and do this for several initial speeds: 10, 20, 50, 100, 200, and 500 m/s. Note the position of the range-maximizing angle in each case. Compare with the scaling law (3.33). Be warned that it is challenging to calculate R by root-finding at large angles and large speeds.
E3.10 (a) Show that W(x ln x) = ln x. (b) Solve xx = a, and express x in terms of W. Verify your answer for a = 4 and 27. Here you can also use SymPy's solve,
In [1] : from sympy import * In [2] : x, a = symbols(’x a’) In [3] : solve(x**x−a, x) # solve xxa = 0 Out [3] : [exp(LambertW(log(a)))]

(c)* Solve Eq. (3.29) with SymPy to obtain Eq. (3.32). (d) Verify the first two terms in the series expansion of W, Eq. (3.23). Note that W′ = W/[x(1 + W)].

E3.11 Consider projectile motion with linear air resistance. (a) Find the maximum height. (b) Calculate the time it takes to reach the top, to fall back to the ground, and the total time of flight, respectively. (c) Give the numerical values for each if b = 1 s−1, v0 = 50 m/s, and θ0 = 20°.
E3.12 Prove the scaling law (3.33). Hint: simplify the range (3.32) with the assumption β sin θ image 1 using (3.23), and solve dR/dθ = 0 in terms of the Lambert W function. See Project P3.4 for a numerical analysis.

Projects

P3.1 (a) Integrate animation into Program 3.2 so that the projectile and its trail are displayed during flight as in Program 3.1. Place the camera to capture the scene from different angles, e.g., forward image, reverse image, top (−ŷ), or other arbitrary angles. Also add a keyboard check to the main loop so the program can be paused or resumed with key presses.

(b) Modify the program and add two arrows to the projectile indicating the vector forces of gravity and drag, respectively. The lengths of the arrows should be proportional to the magnitudes of the forces. Scale them appropriately so they are clearly visible but not overwhelming the scene. Note that the drag force (both direction and magnitude) changes with time.

Refer to Program 3.8 on useful VPython techniques.

P3.2 Numerically investigate projectile motion with linear air resistance.

(a) Add necessary elements to Program 3.2 so the position-time and velocity-time curves (x-t, y-t, vx-t and vy-t) are graphed. In each case, add the corresponding curve for the analytic results (Eqs. (3.12) to (3.15)) and for ideal projectile motion.

Do the numerical and analytic results agree? The curves may be too close to see any difference. Instead, plot the differences, Δx = xnumxana and Δy = ynumyana as a function of time. Comment on the error.

Now turn off drag (b1 = 0) and run the program again. Do the results converge to the ideal case?

Note: We have assumed the step size h to be small compared to the characteristic time scale τs. Estimate τs in this case. How do we check whether h is adequate?

(b) Calculate and plot the range as a function of the launching angle like Figure 3.8 for the same parameters. This is best done automatically with a double loop: the outer one over the angle (say in 5-degree intervals), and the inner one over time. The range for a given angle is the last value of x before y turns negative. Your results should agree with Figure 3.8 to within the accuracy of the step size.

(c) On the same graph as above, plot the analytic range using the Lambert W function. To do so, you should write a function that accepts as input the launching speed and angle and returns the range given by Eq. (3.32). The function can access other parameters such as b and g as global variables. In the main code, add a loop iterating through the angles (for a given speed) and append the results to a list. How do the numerical and analytic results compare? Are the differences as expected for the step size h used? Halve h and repeat the comparison.

As an optional challenge, find the angle θmax for which the range is maximum, from both the numerical and analytic results. Study the asymptotic behavior as the speed (or β in Eq. (3.33)) becomes large. Plot θmax vs. 1 for 1 ≤ β ≤ 103. Compare with the prediction of the scaling law (3.33). Is it easy to extract the ln β dependence from the graph? Why? See also Project P3.4.

(d) Plot as a function of the launching angle the time of flight, τ, and the mean horizontal velocity, 〈vx〉. Compute the latter as 〈vx〉 = Σvx/N where the sum runs over the number of time steps N. Discuss your results. Plot 〈vx〉 × τ as a function of the launching angle and compare how they relate to the range calculated earlier.

(e)* When recording the range or time of flight, it is unlikely that the projectile would hit the ground exactly at y = 0 because of the finite step size h. More often than not, we will have the projectile above ground (y > 0) at t and below it (y < 0) at t + h. To pinpoint the moment more exactly without too small a step size, we can linearly interpolate between the two points just above and just below.

Let (x1, y1) and (x2, y2) be the positions of the projectile at t1 and t2, respectively. Connecting the points by a straight line, the equation of the line is

image

Hence, if the projectile crosses y = 0 between t1 and t2, we can approximate the range and time of flight as

image

Refine the calculation of R and τ accordingly. Change the main loop in the program to keep the positions of the last two iterations. Apply Eq. (3.52) after the loop. Compare your results with part (d). Optionally, do the comparison for a larger step size h and comment on your observations.

P3.3 Investigate one-dimensional free fall with quadratic air resistance.

(a) Consider only vertical (y) motion in Eq. (3.34) (i.e., set x = 0, vx = 0). Calculate the terminal speed, assuming b2/m = 10−2 m−1.

(b) Predict how position, velocity, and acceleration will change with time if motion starts from rest. Sketch them. With initial conditions y = 200 m and vy = 0, simulate the motion until it hits the ground (y = 0). Plot the y-t, vy-t, and ay-t curves. Discuss your results and predictions. At what time and position does the velocity reach 95% of terminal velocity?

(c) Animate the motion with VPython. Mark the position of the projectile at regular time intervals. Make sure to space out the marks so they are not too close (say every 1/4 seconds or so). What do you conclude from the trail of the position marks?

(d) We have used a constant b2. However, air density is not constant, which means that b2 is a function of y. Let us model the effect of changing air density. Assuming constant temperature, thermodynamics predicts that air density decreases exponentially with height,

image

Here, ρ0 is the density at y = 0, and y0 image 9000 m. This model is not terribly accurate, but not grossly inaccurate either.

Repeat parts (a) to (c), assuming b2/m = 10−3 × exp(−y/y0) (m−1). You will have to adjust the initial position so it reaches at least within 5% of terminal speed before hitting the ground. Analyze your results and observations.

P3.4 The project concerns numerical exploration of the scaling law (3.33).

(a) Differentiate Eq. (3.32) with respect to θ, set dR/dθ = 0, and show that the angle maximizing the range satisfies

image

Consult Exercise E3.10 on the chain derivative of W. Also see Exercise E3.12.

(b) Solve Eq. (3.54) for θmax as a function of β from 10 to 1000 using a root finder. Space out the data points by increasing β by a constant factor, e.g., doubling it each time. Plot your exact results along with the scaling law (3.33) on a semi-log scale. Discuss your findings.

P3.5 Consider a batted baseball hit near the ground level at an angle θ = 32° above the horizontal with speed v0 = 150 km/h. Assume air resistance in the form of Eq. (3.7).

(a) Is the use of quadratic air resistance justified? Support your answer by computing the Reynolds number for a typical size and speed of the baseball. Obtain a reasonable value for the constant b2 (including units). The relevant parameters for a baseball is given in Exercise E3.3.

(b) Modify Program 3.8 to simulate the motion of a baseball. As input, the program should ask the user for v0 and θ. Verify the program works correctly.

(c) Plot the x-t, y-t, and y-x curves calculated with the drag force and compare each with the respective curve in the ideal case. Find the range and maximum height of the baseball.

(d) Let us assume that when the baseball hits the ground, it rebounds with 60% of speed (coefficient of restitution), but keeps the same angle of “incidence”. Plot the trajectory up to the third bounce. (Fun exploration: let the bounce continue until it does not move appreciably. Find the maximum horizontal distance traveled.)

(e)* Track the work done by the drag force and verify that the work-energy theorem is satisfied by testing the relation WdragEEi, where image is the work done up to time t, E the energy at t (kinetic and potential), and Ei the initial energy. Plot E, Wdrag, and EWdrag as a function of time. This relation, another form of energy conservation, may be used to validate the program and the step size h.

P3.6 Let us continue the investigation of the batted ball with regard to the angle maximizing the range and a scaling law.

(a)With the same initial condition as in Project P3.5, vary the launching angle θ and locate the optimum θmax to within 0.1° for which the range is maximum. Use linear interpolation (3.52) for improved accuracy. Compare with the theoretical maximum range without air resistance.

(b) How does θmax scale with large v0? First, make a qualitative prediction. Now, calculate θmax for different values of v0, say between 10 and 1000 m/s. Double the speed each time to space out the data points. Plot the results on a semilog scale for v0. You should automate the process of finding θmax. Keep θmax to at least two significant digits. Does your prediction and the results agree? Why or why not?

(c)* Assume a power scaling law image. Visually fit it to the data, and extract γ. Comment on how the results compare with the results of Project P3.4 if available.

P3.7 Like other ball sports, the American football is also full of physics [33].9 It is typically thrown with a speed of 80 to 90 km/h. Use the optimum launch angle from Project P3.6 if available, or else θ = 30°.

(a) Given that the mass of the football is about 400 g, and the radius at the center of the football is ∼ 9 cm, estimate the b2 value for quadratic drag (ignore the fact that the football is prolate, and assume a reasonable frontal cross section). Write a program, or use one you developed, to calculate the range of the football. Should we worry about any forward spin (zip)? Plot the trajectory and compare with no drag. Are they reasonable?

(b) Suppose the b2 above is for standard atmospheric conditions. Let us assume that air density is inversely proportional to temperature T (kelvin), so that the temperature dependent coefficient is b2(T) = b2T0/T. Assuming T0 = 300 K, repeat the range calculation as a function of T from T0 to T0−30 K in steps of 2 K. Plot and discuss the results. What is the difference in range between T0 and freezing (273 K)? What is the range reduction per 5 K (∼ 9 F) drop in temperature?

P3.8 Study the effects of constant versus variable drag and lift coefficients.

(a) Calculate the trajectories depicted in Figure 3.10 of a baseball with constant Cd = 0.5 and variable Cd given by Eq. (3.8). See Exercise E3.3 for relevant parameters of a baseball. Use initial values vx = 30 m/s and vy = 20 m/s, for example.

(b) Add spin to the calculation. Let us give it a side-spin image rad/s. First, assume a constant ratio CL/S = 1.0 so α is a constant in Eq. (3.39). Second, use a variable CL from (3.40). Compare the sideway motion curves (z-t), and discuss the difference. Note the net displacement in z direction at the end.

(c) Examine the equivalency between wind and spin. Assume cross wind in the image direction. Use Eq. (3.36) in your simulation. Find the wind speed vwind which gives the same net displacement as above. Convert it into km/h or mph, and comment on your answer. This may be done by trial and error, or by the shooting method. Try the latter for added challenge!

P3.9 Let us investigate the necessary parameters to hit a home run or a tree-top clearing golf drive.

(a) If the baseball leaves the bat at 35° above the horizontal and with a backspin of 2000 rpm, what should be the initial speed to make a 420-foot home run? Use realistic drag and lift coefficients.

(b) Assume you want to hit a golf ball directly over the tree top which stands at 10 m high and 120 m away. With an initial speed of 60 m/s and a backspin of 8000 rpm, find the angle (at least two significant figures) so your shot just clears the tree top. Compare the cases of constant and changing drag and lift coefficients.

P3.10 Pick your favorite sport, and simulate an event or play that interests you, e.g., a corner kick in soccer, or an overhand smash in ping pong. Show your results both quantitatively by graphs and visually via animation. Additionally, study the effect of changing spin rate during the flight according to Eq. (3.42). You will need to use a reasonable τ.

3.A Bisection and Newton's root finders

In this section we implement the root-finding methods outlined in Section 3.3.3 and discuss their properties including applicability and convergence.

Bisection root finder

The key step in the implementation of the bisection method is to determine which new bracket contains the root (Section 3.3.3). It may be accomplished by first finding the midpoint xmid and then deciding which end point to replace. To determine which side the root is on, the function value f(xmid) at xmid = (b + a)/2 (the first being c in Figure 3.6) is compared to an end point, say f(a). If they are of the same sign, then a is replaced by xmid and the new bracket for the root is [xmid, b]. Otherwise, b is replaced, and the bracket is set to [a, xmid]. This strategy may be expressed as

image

The code below implements the above strategy.

Program listing 3.6: Bisection root finder (bisect.py)

def bisect (f, a, b, eps=1.e−6):   # userdefined f(x) and bracket [a,b]
  2      fa, fb, gap = f(a), f(b), abs(b−a)   # end points and initial gap
      if (fa*fb > 0.0):                             # no root in bracket
  4           print(’Bisection error: no root bracketed’)
           return None
  6      elif fa == 0.0:   return a
      elif fb == 0.0:   return b
  8
      while (True):
10            xmid = 0.5*(a+b)
            fmid = f(xmid)
12            if (fa*fmid > 0.0):               # root in [xmid, b]
                a, fa = xmid, fmid           # set a=xmid and save a function call
14            else: b=xmid                         # root in [a, xmid]
            if (fmid == 0.0 or abs(b−a) < eps*gap): break # root found
16
      return xmid

This code needs a user supplied function f(x), an initial bracket [a, b], and an optional relative accuracy eps (default: 10−6). It starts by checking easy cases first: if no root is bracketed, it returns a type None;10 or if either end happens to be a root, it just returns as such. The main loop computes the midpoint, decides which end point to replace according to Eq. (3.55). If the midpoint satisfies f(x) = 0, or the relative accuracy is satisfied (line 15), a root is presumed found. The program exits the loop and returns the root.

The bisection method never fails, provided the initial bracket [a, b] contains at least one root. While for an arbitrary function it is usually not trivial to locate the initial bracket, it is relatively easy to do so based on physics, because physical considerations should lead to a reasonable guess. For example, for the projectile motion problem (3.17), we know the range must be between (0, R0], where R0 is given by Eq. (3.2), the range for ideal projectile motion.

The cost of the bisection method amounts to one function call per iteration. The rate of convergence is linear, since each iteration reduces the interval by half. Let δ be the bracket width after n iterations, then δ ∼ |ba|/2n, or n ∼ −log2 with = δ/|ba| being the relative error. For example, if = 10−6, roughly 20 iterations are required. It is not the fastest, but fast enough for most cases. Coupled with its robustness, it should be the first root finding method to consider for a given problem.

Newton's root finder

In implementing Newton's method, we need to be careful about potential pitfalls lurking behind it. Figure 3.7 illustrates one of those, where Newton's method happily jumps in a never-ending loop. Other pitfalls might occur such that the algorithm marches to ±∞ without bounds, unless safeguards are built into the implementation of the method. We implement Newton's method (3.18) below.

Program listing 3.7: Newton's method (newton.py)

  1def newton(f, df, x, eps=1.e−6):    # userdefined f(x),df/dx, init root
      nmax, fx = 20, f(x)                  # max number of iterations
  3      if (fx == 0.0): return x

  5      for i in range(nmax):
            delta = fx/df(x)
  7            if (i == 0): gap = abs(delta)      # save initial gap
            x = x − delta                            #improvedroot
  9            fx = f(x)                                  # prep for next round
            if (fx == 0.0 or abs(delta) < eps*gap): break     # root found
11
      return x

To use newton(), the user supplies both the function f(x) and its derivative df(x), the initial guess x, and the optional relative error eps. The choice of the starting value can be critical, it could mean a successful run or a not-so-successful run into the abyss. We safeguard against the latter by setting a maximum number of iterations nmax. However, no check is made on whether the loop exited normally due to accuracy satisfied (line 10) or just reached the maximum iterations.

The rate of convergence of Newton's method turns out to be quadratic for well-behaved functions in the neighborhood of a root. This means that if the initial error is 0, the error after one iteration is image. After n iterations, the error roughly scales as image, or n ∼ log2(ln /ln 0). For instance, if 0 = 10−2 and = 10−16, then n ∼ 3, i.e., each iteration roughly doubles the number of significant digits. It is very efficient and usually converges to machine accuracy in a few iterations. When we are certain that Newton's method is locally stable in the proximity of a root, it can be a powerful tool, and we should use it.

3.B Program listings and descriptions

Program listing 3.8: Motion of a baseball (baseball.py)

import ode, visual as vp, numpy as np    # get ODE, VPython, numpy
  2
def baseball(Y, t):                              # Y = [r, v] assumed
  4      v = Y[1]
      fm = alpha*vp.cross(omega, v)                    # Magnus force
  6      a = (fm − b2*vp.mag(v)*v)/mass − [0,g,0]  # minus gvec
      return np.array([v, a])                                 # np array
  8
def set_scene(R):              # draw scene, ball, trails, spin, info box
10      scene = vp.display(background=(.2,.5,1), forward=(−1, −.1, −.1),
                                     center=(.5*R,1,0), ambient=.4, fullscreen=1)
12      floor = vp.box(pos=(R/2,0,0), length=1.1*R, height=.1, width=8,
                              color=vp.color.orange, opacity=0.7) # transparent
14      zone = vp.curve(pos=[(R,0,1),(R,1,1),(R,1, −1),(R,0, −1)], radius=.02)
      ball  =  vp.sphere(pos=(0,0,0), radius=.2, material=vp.materials.rough)
16      trail  =  vp.curve(pos=(0,0,0), radius=0.04)
      ideal = vp.curve(pos=(0,0,0), radius=0.04, color=vp.color.green)
18      spin = vp.arrow(axis=omega,pos=(0,0,0),length=1) # omega dir
      info  =  vp.label(pos=(1.1*R,2, −2),text=’Any key=repeat’)
20      return scene, ball, trail, ideal, spin

22def go(x, y, vx, vy):           # motion with full drag and spin effects
      h, t, Y = 0.01, 0., np.array ([[x, y, 0.], [vx, vy,0.]])                # initialize
24      while (Y[0,0]<R and Y[0,1]>0.2):   # before homeplate&above ground
             vp.rate(40)
26             t, Y = t+h, ode.RK4(baseball, Y, t, h)     # integrate
             ball.pos, spin.pos = Y[0], Y[0]−offset # move ball, arrow
28            spin.rotate(angle=phi), ball.rotate(angle=phi,axis=omega) #spin
             trail.append(pos=ball.pos)
30             ideal.append(pos=(x+vx*t, y+vy*t−0.5*g*t*t, 0.)) # ideal case
      while (not scene.kb.keys):                      # check for key press
32            vp.rate(40)
            spin.rotate(angle=phi), ball.rotate(angle=phi,axis=omega)
34       scene.kb.getkey()                                    # clear key
       trail.append(pos=(0,0,0), retain=0)        # reset trails
36       ideal.append(pos=(0,0,0), retain=0)

38g, b2, alpha, mass = 9.8, .0013, 5e−5, .15     # parameters
R, omega = 18.4, 200.*np.array ([0,1,1])     # range, angular velocity
40phi, offset = np.pi/16., 0.4*omega/vp.mag(omega)

42scene, ball, trail, ideal, spin = set_scene(R)
while (1):
44      go(x=0., y=2., vx=30., vy=0.)                 # initially z=0, vz=0

As discussed in the main text, baseball() returns the equations of motion, RHS of Eq. (3.41), in a NumPy array in order to use a vectorized ODE solver. Subroutine set_scene() does what it says: it orients the camera to the scene containing various objects: the ground (floor), strike-zone, ball, trails (vp.curve(), one for the actual motion, and another for ideal projectile motion), angular velocity arrow, and an informational text box, vp.label(). The floor is drawn as a transparent box via the opacity parameter (line 13), so that even if the camera is below the ground while being swung around, the baseball remains visible. The lower the opacity parameter, the higher the transparency.

The function go() takes input for initial conditions, and integrates the motion until the ball reaches the strike-zone or hits the ground. The array Y holds the position and velocity vectors as image, which are represented as NumPy arrays. At each step, the positions of the ball and of the arrow representing spin are updated. The rotation is effected via the rotate method of the object (line 28), which rotates a given angle counterclockwise about the object's axis. For objects that do not have an axis such as the sphere, we must specify the axis as a direction vector. After the numerical integration ends, the second loop keeps rotating the ball and the arrow until a key has been pressed (so we can admire the scenery, explore it from different angles, or take a snapshot). This is done by monitoring whether a key has been pressed (line 31). If so, scene.kb.keys will be set to True in VPython, and the loop exits. The function scene.kb.getkey() is called to clear the keyboard buffer (line 34). Finally, the trails are cleared by setting retain=0 (line 35) so fresh ones can be drawn in the next go-around.

The main body of the program sets the necessary parameters. The angular velocity vector image is set (line 39) such that the ball has a back and side spin. The purpose of the variable offset, a vector along the direction of image, is to center the spin arrow at the ball (line 27). Once the scene is set, go() is called repeatedly after each key press until the window is closed.

1We should not confuse the velocity dependence with kinetic friction which is independent of velocity. For kinetic friction, the contact surface does not move with the body.

2Laminar and turbulent flows can be observed in a column of rising smoke, say from a burning incense. At first, the column is smooth as silk, and is laminar. As the column rises, it spreads and starts to develop twirls and twists, and becomes turbulent.

3To quote the 5th century BC philosopher Laozi: the longest journey starts with a single step.

4SciPy also has a general root solver, scipy.optimize.fsolve. See Exercise E3.8.

5The Lambert W function is also available in the SciPy special function library, lambertw, and in SymPy as LambertW.

6It can also be solved more quickly (and opaquely) with SymPy, see Exercise E3.10.

7Numerical extraction of the scaling law is rather tricky because of the slow-varying logarithmic term ln β in Eq. (3.33) (see Project P3.2).

8Another common explanation invokes Bernoulli's principle. The flow velocity is greater on the top than on the bottom, resulting in a net upward pressure difference, hence the lift. But we think the third-law argument is more direct.

9See the so-called “Deflategate” in which the New England Patriots team was alleged of deflating or under-inflating the football to gain an unfair advantage in a playoff game, and the science behind it in The New York Times Sports, “Upon scientific review”, January 30, 2015. The team won that year's Super Bowl. See also Section 11.4.4 on pressure and temperature.

10Having no root bracketed is not an uncommon error, so type None should be inspected by the calling program to make sure a legitimate root is found.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.45.80