See discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/333985200 Two Numerical Algorithms for the Ballistic Motion Equations Method · June 2019 DOI: 10.13140/RG.2.2.20482.32960 CITATIONS READS 2 4,635 1 author: Douglas Vinson Nance Air Force Research Laboratory 32 PUBLICATIONS 78 CITATIONS SEE PROFILE All content following this page was uploaded by Douglas Vinson Nance on 24 June 2019. The user has requested enhancement of the downloaded file. Two Numerical Algorithms for the Ballistic Motion Equations Douglas V. Nance, Ph.D. Retired Research Scientist June 24, 2019 i DISCLAIMER The author of this report has used his best effort in preparing this document. The author makes no warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness or usefulness of any information, apparatus, product or process disclosed or represents that its use would not infringe privately owned rights. Reference herein to any commercial products, processes, trade name, trademark, manufacturer or otherwise, does not necessarily constitute or imply its recommendation, or favoring, by the author. ii Abstract This report examines the performance of the Leap-Frog and standard fourth order Runge-Kutta methods for integrating the ballistic motion equations in time. Two major test problems are considered, first the gravity only or drag free case and second, a simple drag model. Analytical solutions are developed for each model elucidating the properties of the ballistic trajectories. The Leap-Frog and Runge-Kutta methods are derived and adapted for the test problems. Results are generated for each problem, and the subsequent numerical errors are examined. iii Contents 1 Introduction 2 2 The Ballistic Motion Problem 2.1 The Gravity Only or Drag Free Model . . . . . . . . . . . . . . . . . . . . . 2.2 Ballistic Motion with a Simple Drag Model . . . . . . . . . . . . . . . . . . . 3 4 6 3 Numerical Integration Schemes 3.1 Leap-Frog Scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Implementing the Leap-Frog Scheme . . . . . . . . . . . . . . . . . . . . . . 3.3 Runge-Kutta Fourth Order Scheme . . . . . . . . . . . . . . . . . . . . . . . 3.4 Implementing the Runge-Kutta Fourth Order Scheme . . . . . . . . . . . . . 11 11 12 13 14 4 Results 4.1 Gravity Only of Drag-Free Ballistic Motion . . . . . . . . . . . . . . . . . . . 4.2 Ballistic Motion with a Simple Drag Model . . . . . . . . . . . . . . . . . . . 19 19 20 5 Summary 29 A Appendix: Fourth Order Runge-Kutta Scheme Derivation A.1 Taylor Series for the Dependent Variable “y” . . . . . . . . . . . . . . . . . . A.2 Taylor Series for the Runge-Kutta Slope Expressions . . . . . . . . . . . . . 30 31 35 1 1 Introduction This report contains a set of informal notes describing the use of the Leap-Frog and fourth order Runge-Kutta Methods for integrating projectile motion equations. The projectile motion equations are a long standing staple for the applications of Integral Calculus. Since the dynamics of projectile motion rely upon acceleration (e.g., the acceleration of gravity), the time-dependent Cartesian coordinates for the trajectory are given by integrating a system of ordinary differential equations driven by acceleration. For more advanced models, the effects of aerodynamic drag may be considered. The author’s interest in Molecular Dynamics motivates this study of particle trajectory calculation. Under the purview of Molecular Dynamics, the motion of atoms and/or molecules is driven by similar equations through Newton’s laws of motion. Also, the projectile motion problem is both fun and conceptually easy to understand. Yet, this problem presents a good test of time integration schemes. Although it is an issue of scale, the ballistic motion and Molecular Dynamics problems can require lengthy time integration intervals, that is, large numbers of iterations for the time integration scheme equations. In this work, two such schemes are considered: (i) the Leapfrog Method and (ii) the venerable fourth order Runge-Kutta method. The former scheme utilizes staggered time meshes for the velocity and position coordinate loci. The latter scheme uses a common time mesh for both velocity and position. Both of these schemes are discussed in Section 3. First, the ballistic motion problem is introduced; its equations are developed, and closed form analytical solutions are obtained. 2 Figure 1: Ballistic Motion Problem Layout 2 The Ballistic Motion Problem In the context of this problem, a projectile is launched into the air at an angle θ to the ground. The projectile rises vertically (in the y direction) into the air while traveling horizontally (in the x direction) downrange. Gravity affects the projectile mass as a body force by slowing its upward motion and ultimately reversing the vertical velocity causing the projectile to fall back to Earth. This simple configuration is shown in Figure 1. The projectile’s motion is two-dimensional since the trajectory is confined to the xy-plane; x and y may be thought of as the range and altitude coordinates, respectively. At time t = 0, the projectile is given an initial velocity V~0 , i.e., V~0 = [Vx0 , Vy0 ]T (1) Let V0 be the magnitude of the velocity vector, then Vx0 = V0 cos(θ); Vy0 = V0 sin(θ) (2) This motion problem ends when the projectile’s y coordinate becomes zero for some non-zero time, that is, when the projectile arrives at the ground level. The initial coordinates for the mass (prior to launch) are denoted as (x0 , y0 ). For convenience, we can assign the value x0 = 0; (3) y0 may be assigned some constant value representing the projectile’s launch from a non-zero height. The launch angle (with respect to the horizontal or x axis) θ is confined to the domain 3 π (4) 2 The above constraint precludes the occurrence of strictly horizontal or strictly vertical launches. It also eliminates the case of launching backwards over the −x axis. 0<θ< As one may conclude from the discussions above, the projectile mass is defined as a point particle possessing neither size nor shape. This assumption is very strong and provides for a rudimentary analysis that is sufficient for the present investigation. This model may be enhanced to include more esoteric physics at the expense of simplicity. Still, the issue under consideration here is to obtain knowledge of the behavior of time integration schemes. Mathematical models possessing closed form, analytical solutions are invaluable in providing a basis for comparison with numerical solutions. 2.1 The Gravity Only or Drag Free Model In this, our most simple model, gravity is the only admitted force. Here, represented by an acceleration, its strength is constant and is represented by the constant g where g = 9.806 m/s (5) Below, we solve the equations of motion for this case. Note that for this model, gravitational acceleration is exerted in the −y direction. Specific accelerations are denoted as ax and ay for the x and y coordinate directions, respectively. Derivatives of the coordinate velocities relate to these accelerations as follows. dvx = ax = 0 dt (6) and dvy = ay = −g dt The equation of motion in the x direction (6) is quite easy to integrate, i.e., Z vx Z t dṽx = 0 · dt̃ vx0 (7) (8) 0 Note that the ˜ notation indicates the use of a dummy variable of integration. Doing so facilitates the use of definite integrals avoiding the need for arbitrary constants. The right side of this expression is zero, so the result is vx (t) = vx0 (9) Hence, the projectile’s velocity along the x coodinate direction is constant and equal to the initial value. The differential equation relating the x coordinate to the velocity is quickly obtained as 4 dx = v x0 (10) dt We may easily integrate (10) to obtain the x coordinate of the projectile as a function of time. Z t Z x vx0 dt̃ (11) dx̃ = 0 x0 Thus, the time dependent x coordinate for the mass is given as x(t) = x0 + vx0 t (12) We may now solve (7), the differential equation for the y coordinate. As with the previous equation, we may separate variables and form definite integrals based on the initial conditions.[1] Observe that dvy = ay = −g dt By separating variables and integrating, we arrive at the equation for y velocity, i.e., Z t Z vy dṽy = −gdt̃ =⇒ vy = vy0 − gt dvy = −gdt =⇒ (13) (14) 0 vy0 That is vy = vy0 − gt (15) The ordinary differential equation for the projectile’s y coordinate is dy = vy = vy0 − gt (16) dt This expression may be integrated to obtain the equation for the time-dependent y coordinate. We have that Z y Z t dỹ = vy0 − g t̃ dt̃ (17) y0 0 The equation for the y coordinate is therefore 1 (18) y = y0 + vy0 t − gt2 2 Recapping solutions, the parametric equations for the projectile’s ballistic trajectory are given by (12) and (18) for t ≥ 0. Moreover, we can analyze the solution and determine properties of the trajectory. First, we can determine the time tapex for the apex of the flight path. This time occurs when vy is set to zero in (16). The result is tapex = 5 vy0 g (19) The maximum altitude attained by the projectile can be calculated by substituting tapex into(18). This value is computed as vy20 yapex = y0 + 2g (20) A final trajectory point of interest is tgrnd , the time when the object strikes the ground (y = 0). This datum can be obtained by setting y = 0 in (18) and solving for time. This result is p vy0 + vy20 + 2gy0 (21) tgrnd = g 2.2 Ballistic Motion with a Simple Drag Model A sense of drag, a viscous force opposing projectile motion, may be incorporated in the ballistic equations through the use of a simple model. From basic aerodynamics, the drag force is empirically computed by using the equation F D = CD q S (22) where FD is the drag force on a 3D body; CD is the empirically obtained drag coefficient; S is the frontal or windward area of the body, and q is the dynamic pressure given by ρ q = v2 (23) 2 ρ being the local air density and v being the body’s velocity through still air.[2] The model to be used here is even simpler and addresses only the acceleration due to drag in the x and y Cartesian directions, i.e., axDrag = −βvx2 (24) ayDrag = −βvy2 (25) Again, this is a model, so the x and y accelerations due to drag are regarded as decoupled. It follows that the equation of motion in the x direction may be written as dvx = −βvx2 dt The corresponding equation for displacement in the x direction is (26) dx = vx (27) dt Referring to the previous section to incorporate gravity, we can write the equation of motion for the y direction as dvy = −g − βvy2 dt 6 (28) The corresponding equation for displacement in the y direction is dy = vy (29) dt By including initial conditions for the ordinary differential equations (ODEs), we can complete the statements of the initial value problems (IVPs). That is, vx (0) = vx0 ; vy (0) = vy0 (30) With the use of (26) and (30), the equation for x velocity is easily derived by separating variables. Observe that Z t Z vx dv˜x dt̃ (31) = −β 2 0 vx0 ṽx By integrating, we obtain v 1 x 1 1 − = βt or = βt ṽx vx vx vx0 (32) 0 Algebrically, we may solve for vx , i.e., vx (t) = vx0 1 + βvx0 t (33) As one may expect for this simple drag model, x velocity tends to zero as time tends to infinity. With vx (t) now known, the x displacement equation can be calculated. Note that vx0 dx = vx = dt 1 + βvx0 t (34) subject to the time zero initial condition x(0) = x0 = 0 (35) The x displacement IVP (34) and (35) can be solved easily. As before, we separate variables and integrate. Z x t Z t 1 vx0 dt̃ =⇒ x = ln|1 + βvx0 t̃| dx̃ = β 0 0 1 + βvx0 t̃ 0 (36) Hence, we obtain the x displacement equation as x(t) = 1 ln|1 + βvx0 t| β (37) Although x velocity tends to zero, x displacement still tends to infinity as ln(t)/β. In that sense, this model is unrealistic, but the mathematics are sound, so it is suitable for comparison with numerical solutions. Also, we stop the calculation when y equals zero (object strikes ground). 7 The exact solution for ballistic motion with drag in the y direction is more interesting. Recall (28), the equation of vertical motion. It can be rewritten as follows. dvy β 2 = −g 1 + vy (38) dt g Combined with (30), this ODE constitutes an IVP. As with previous case, we may begin to solve this problem by separating variables and constructing the following integral. Z t Z vy dṽy dt̃ (39) = −g β 2 0 vy0 1 + g ṽy The y velocity integral above may be solved by the use of the following substitution.[3] Let s s β β β w̃ = ṽy ; w̃2 = ṽy2 ; dw̃ = dṽy (40) g g g With the use of (40) and after evaluating the time integral, (39) becomes r Z w g dw̃ = −gt β w0 1 + w̃2 (41) where r w0 = g vy β 0 (42) We can evaluate the integral on the left side of (41) with the use of trigonometric substitution.[3] Let w̃ = tan θ ; θ = tan−1 w̃ ; dw̃ = sec2 θ dθ (43) With the substitution (43) in place, (41) becomes r r r Z θ θ sec2 θ̃dθ̃ g g g = θ̃ = (θ − θ0 ) = −gt 2 β θ0 1 + tan θ̃ β θ0 β (44) θ0 = tan−1 w0 (45) where By backward substitution via (43) and (40), we obtain s s ! !# r " g β β tan−1 vy − tan−1 vy = −gt β g g 0 It is not difficult to solve this expression for vy , i.e., s " ! # r p g β vy (t) = tan tan−1 vy − βg t β g 0 8 (46) (47) Time dependent vertical velocity for the projectile is given by the above equation. We may obtain an equation for the time dependent vertical displacement by integrating (47). This step looks to be complicated, but it is relatively easy if we use a few substitutions to simplify the notation. Let s ! r p g β ; δ = tan−1 vy0 ; γ = βg (48) = β g where , δ and γ are constants. Then (47) becomes vy (t) = tan (δ − γt) (49) To obtain the projectile’s y displacement, we integrate. Z t Z t y(t) − y0 = vy (t̃) dt̃ = tan (δ − γ t̃) dt̃ 0 (50) 0 The tangent function is integrable by the following method.[3] Z t sin(δ − γ t̃) dt̃ y(t) − y0 = 0 cos(δ − γ t̃) (51) Recall that the minus sine is the derivative of the cosine function, so we have that d cos(δ − γ t̃) = −sin(δ − γ t̃)(−γ) dt̃ = γ sin(δ − γ t̃) dt̃ (52) Hence, y(t) − y0 = γ Z t γ sin(δ − γ t̃) dt̃ t = ln cos(δ − γ t̃) 0 γ cos(δ − γ t̃) 0 By reversing the substitutions made in (48) and simplifying, we obtain q h i √ β −1 cos tan βg t v − y g 0 1 h q i y(t) = y0 + ln β β cos tan−1 v (53) (54) g y0 Equation (54) provides the time dependent altitude of the projectile for time t. It is always interesting to analyze the behavior of a mathematical model in order to see what it has to say concerning the physics of the model system. As a start, we can determine the time tapex of zero vertical velocity for the projectile. At that time, the projectile passes through the apex of its flight. To determine this time, recall (47). Note that the velocity is governed by the tangent function. This function has zeroes when its argument is an integer multiple of π. We will choose its argument as zero, so s ! p β tan−1 vy0 − βg tapex = 0 (55) g 9 It is easy to solve for tapex , i.e., tan−1 q β v g y0 √ βg tapex = (56) The other key event in ballistic motion occurs when the projectile strikes the ground; this time is denoted tgrnd , and y(tgrnd ) = 0. Recall (54) and evaluate it at time tgrnd . h q √ i β −1 cos tan v − βg t y grnd g 0 1 i h q (57) y(tgrnd ) = 0 = y0 + ln β β v cos tan−1 g y0 Properties of the logarithmic function can be used to support the algebraic rearrangement of the above expression to form a transcendental equation for tgrnd , i.e., " cos tan−1 s β vy g 0 ! # " p − βg tgrnd − exp(−βy0 ) cos tan−1 s β vy g 0 !# =0 (58) At first glance, it seems possible to solve directly for tgrnd through the use of the inverse cosine function. Doing so has proven to be difficult, and the trouble seems to be related to locating the branch of the cosine function involved. Instead, (58) is easy to solve by first obtaining an estimate for tgrnd and then refining that estimate via Newton’s Method. 10 3 Numerical Integration Schemes As a mishmash of concepts of interest to the author, this report is rather peripatetic, so this section contains a discussion of the ODE integration algorithms applied in solving the ballistic motion problem. The crux of the matter lies in determining good methods for calculating both velocity and displacement for a projectile, or in the context of Molecular Dynamics, for a system of particles. Although other methods are available, the two examined here are the Leap-Frog method and the fourth order Runge-Kutta method.[4, 5] Molecular Dynamics tends to apply the Leap-Frog algorithm or its close cousin, the Verlet algorithm.[6] These widely used methods employ staggered velocity and displacement meshes. A good property for these methods in numerical efficiency, lower operation counts per numerical time step. I am less familiar with this type of method. That, in itself, is a reason for investigating the Leap-Frog method here. I have greater familiarity with Runge-Kutta schemes since I have used them since my days as an undergraduate, but I have not used them for trajectory computation. Moreover, I have never delved deeply into Runge-Kutta theory. Making strides in remedying these deficiencies is a goal of this report. 3.1 Leap-Frog Scheme The Leap-Frog scheme, a Lax-type method, is a time advancement scheme that has become a staple for solving hyperbolic partial differential equations. It is characterized by good numerical performance with a low operation count; it also performs quite well in conserving total energy when modeling a physical system.[4] This method is stable in accordance with the Courant-Friedrichs-Lewy (CFL) criterion, and it is known to be nondissipative.[7] The Leap-Frog equations are rather easy to derive, so for didactic purposes, the derivation is presented below.[4, 6] Let the three Cartesian components of velocity be denoted vi while the associated position coordinates are denoted xi . As was mentioned above, the velocity mesh is staggered off of the position mesh by one-half time step, the time step being given by h. Consider the upwind and downwind Taylor series for the velocity field centered at time t, i.e., 2 3 h 0 1 h 1 h h (3) 00 (59) vi (t) + vi (t) + . . . vi (t + ) = vi (t) + vi (t) + 2 2 2 2 3! 2 2 3 h h 0 1 h 1 1 (3) 00 vi (t − ) = vi (t) − vi (t) + vi (t) − h vi (t) + . . . (60) 2 2 2 2 3! 2 By subtracting (60) from (59), we obtain h h 2 vi (t + ) − vi (t − ) = h vi0 (t) + 2 2 3! 3 h (3 vi (t) + . . . 2 (61) 3 h (3 vi (t) + . . . 2 (62) By rearrangement of the above equation, we have that h 2 h vi (t + ) = vi (t − ) + h vi0 (t) + 2 2 3! 11 Note that the term vi0 is actually the associated acceleration vector ai , so by deleting higher order terms, we obtain h h = vi t − + h ai (t) (63) vi t + 2 2 Above (63) is the first Leap-Frog equation. To derive the second Leap-Frog equation, consider the Taylor series for position xi (t). 1 xi (t + h) = xi (t) + hx0i (t) + h2 x00i + . . . 2 By factoring an h in part of the above equation, the following form results. 1 0 xi (t + h) = xi (t) + h vi (t) + hvi + . . . 2 (64) (65) where it has been noted that x0i = vi and that x00i = vi0 . Within (65), the quantity in parentheses is vi (t + h/2) plus terms of order h2 and higher. After truncating the higher order terms, we obtain the second Leap-Frog equation, in that h xi (t + h) = xi (t) + hvi t + (66) 2 The interplay between the staggered time meshes is quite evident in (66). A third Leap-Frog equation may be derived that allows velocities to be transferred onto the position mesh. This formula may be obtained from a Taylor series for velocity written at the previous half time step, i.e., 2 1 h h 0 h = vi (t) − vi (t) + vi00 (t) + . . . (67) vi t − 2 2 2 2 If we truncate the higher order terms in the above expression and note that vi0 = ai , rearrangement shows that the final form for the third equation is h h (68) vi (t) = vi t − + ai (t) 2 2 Equations (63), (66) and (68) complete the Leap-Frog algorithm. 3.2 Implementing the Leap-Frog Scheme For the ballistic motion problem, it is not difficult to bring the Leap-Frog integration scheme to bear. It is a little more difficult for those not accustomed to the use of staggered meshes. An essential first step entails the calculation of an initial value for this integration scheme. Consider a single position coordinate x with an associated velocity vx . The initial conditions for the position and velocity are x0 and vx0 , respectively. The values for position and velocity are tracked in the two arrays x(i) and vx(i). Let h be the fixed time step, and 12 the velocity values are staggered in the array by one-half time step. The i = 1 elements of these two arrays are calculated as follows. h ax 2 (69) x(1) = x0 + h vx(1) (70) vx(1) = vx0 + In the above expressions, ax is a fixed acceleration; for the drag free case, that value is zero. The next step in the procedure occurs in the time step loop. The associated equations are vx(i) = vx(i − 1) + h ax (71) x(i) = x(i − 1) + h vx(i − 1) (72) Changing acceleration values are easily accommodated within this algorithm. As is evident from the equations, the Leap-Frog method is quite efficient utilizing about four mathematical operations per coordinate per time step. 3.3 Runge-Kutta Fourth Order Scheme Runge-Kutta methods have long stood as highly effective algorithms for integrating ordinary differential equations. The canonical initial value problem solvable by the fourth order Runge-Kutta scheme is dy = f (t, y), y(t0 ) = y0 dt The fourth order Runge-Kutta algorithm is summarized below. f1 = f (t, y) h h f2 = f t + , y + f1 2 2 h h f3 = f t + , y + f2 2 2 f4 = f (t + h, y + hf3 ) h yn+1 = yn + (f1 + 2f2 + 2f3 + f4 ) 6 (73) (74) (75) (76) (77) (78) At some length, this algorithm is derived in Appendix A. The derivation is not the most general because we assume that the Runge-Kutta slope calculations are computed at t, t + h/2 and t + h as indicated above. 13 3.4 Implementing the Runge-Kutta Fourth Order Scheme Implementation of the fourth order Runge-Kutta scheme is an interesting topic because the mathematics involved is quite rich. The core references that I have used for this method are [5] and [9]. It is worthwhile to present pertinent details of the implementation here. We write the ballistic motion equations in vector form, i.e., ~ dX ~ = f~(t, X) (79) dt The Runge-Kutta model (79) has been generalized for more equations and variables.[8] More specifically, we may write x vx d vx = ax (80) y vy dt vy ay In (80), x and y are the trajectory coordinates while vx , vy , ax and ay are the associated velocities and accelerations, respectively. By the assumptions made in Section 2, the x and y components of the drag force are decoupled, so in either the gravity only (drag free) or drag engaged model, we can address motion in the two coordinates separately. Let us consider motion in the x direction, and for the sake of detail, consider the drag model. This subsystem becomes d x vx = (81) ax dt vx Accordingly, the vector function representing the differential equation is written as in Section 2.2, f~ = f (t, x, vx ) = (vx , −βvx2 )T = (fx1 , fx2 )T (82) An interesting aspect of this system is that the argument x1 , or more specifically, the coordinate x does not appear as an element of f~. Still, its elements are well defined and exist as functions of the arguments of f . Now, we proceed with structuring the Runge-Kutta slope values f1 through f4 . Slope f1 is easily defined as (1) (1) f~1 = f (t, x, vx ) = (fx1 , fx2 )T = (vx , −βvx2 )T (83) The superscripts found in (83) indicate the stage number of the slope. This notation is important because the slope associated with the previous stage is used in computing the slope associated with the follow on Runge-Kutta stage. Also, note that the time step size is defined by h. With this fact in mind, the Runge-Kutta slope f2 is written via (75) as h (1) h (1) h ~ (84) f2 = f t + , x + fx1 , vx + fx2 2 2 2 14 In the case of each slope computation, (82) acts as a prototype. What the prototype means is (1) that the third argument in the function, e.g., vx + h2 fx2 , is substituted for vx in the prototype (82). With substitutions from (82), we obtain the actual arguments for f2 . Specifically, h h h 2 f~2 = f t + , x + vx , vx − βvx (85) 2 2 2 By virtue of the way that the acceleration due to drag is defined, we know that β has dimensions of inverse length, so the arguments of f in (85) are completely consistent. Again, referring to (82), it is evident that the vector components of f2 are given as follows. 2 !T h 2 h 2 (2) (2) vx − βvx , −β vx − βvx = (fx1 , fx2 ) 2 2 f~2 = (86) The third Runge-Kutta slope is calculated in accordance with (76); the functional form is given as h h h (2) (2) f~3 = f t + , x + fx1 , vx + fx2 (87) 2 2 2 By substitution from (86), we obtain f~3 = f h h t + ,x + 2 2 2 ! h 2 h 2 h vx − βvx , vx − β vx − βvx , 2 2 2 (88) Following the prototype function, the components of f3 are shown to be h h f~3 = vx − β vx − βvx2 2 2 2 , −β h h vx − β vx − βvx2 2 2 2 !2 Referring to (77), the functional form for slope f4 is written as (3) (3) f~4 = f t + h, x + hfx1 , vx + hfx2 T (3) (3) = (fx1 , fx2 )T (89) (90) After repeating the same procedure from the prototype function and substituting from (89), we have that " 2 # h h f~4 = f t + h, x + h vx − β vx − βvx2 , vx − hβ 2 2 2 !2 h h vx − β vx − βvx2 2 2 (91) Hence, the components of f~4 become 15 f~4 = vx − hβ 2 !2 h h vx − β vx − βvx2 , −β vx − hβ 2 2 h h vx − β vx − βvx2 2 2 2 !2 2 T (92) These slope formulas can now be used in (78) to compute the fourth order Runge-Kutta solution for ballistic motion in the x direction. A nice aspect of this method is that is completely unnecessary to explicitly code these individual formulas. In actuality, the computer can actually perform the work. This idea may be illustrated as we consider motion in the y coordinate direction. Accelerated ballistic motion in the y direction is due to the force of gravity and due to the aerodynamic drag model wherein d y vy (93) = ay dt vy where ay = −g − βvy2 (94) This ODE subsystem lends itself to a new prototype vector function, i.e., f~ = f (t, y, vy ) = (vy , −g − βvy2 )T = (fy1 , fy2 )T (95) Naturally, this prototype function is used to construct Runge-Kutta slope terms for the y trajectory coordinate. The f1 slope is easily defined as (1) (1) f~1 = f (t, y, vy ) = (fy1 , fy2 )T = (vy , −g − βvy2 )T (96) Just as is the case with the x coordinate, the y coordinate is not explicitly represented in the slope calculation. Slope f2 is calculated from the following expression. h h (1) h (1) ~ f2 = f t + , y + fy1 , vy + fy2 (97) 2 2 2 The specific form of f2 arises after substituting f1 from (96). That is h h h 2 ~ f2 = f t + , y + vy , vy + (−g − βvy ) 2 2 2 (98) The components of f2 are derived from the prototype (95). In this case, vy + h2 (−g − βvy2 ) is substituted in the place of vy . We obtain f~2 = 2 !T h h (2) (2) = (fy1 , fy2 )T vy + (−g − βvy2 ), −g − β vy + (−g − βvy2 ) 2 2 (99) The expression for slope f3 is derived by using the same procedure. We begin by applying the functional form with arguments taken from (76). 16 f~3 = f h (2) h (2) h t + , y + fy1 , vy + fy2 2 2 2 (100) Substituting from (99) produces the result 2 !! h f~3 = f −g − β vy + −g − βvy2 2 (101) From the prototype vector form, the components of f3 are h h t + ,y + 2 2 f~3 = h vy + 2 h h 2 vy + −g − βvy , vy + 2 2 ! 2 h 2 −g − β vy + −g − βvy , 2 " 2 !#2 T h h −g − β vy + −g − β vy + −g − βvy2 2 2 (102) In determining f3 , the third argument occurring in (101) has been substituted for vy in the prototype vector components. By now, it is likely that the reader is becoming accustomed to the flow of the mathematics, so f4 is derived the same way except we use the time increment specified in (77). Beginning with the prototype function and its arguments, we have (3) (3) ~ (103) f4 = f t + h, y + hfy1 , vy + hfy2 Substitution from (102) provides the specific forms for the arguments of f~4 , i.e., 2 !# h h −g − β vy + −g − βvy2 , t + h, y + h vy + 2 2 " 2 !#2 h h (104) vy + h −g − β vy + −g − β vy + −g − βvy2 2 2 " f~4 = f This vector’s components may now be written as " h f~4 = vy + h −g − β vy + 2 −g − β vy + " −g − β vy + h −g − β vy + h 2 h −g − βvy2 2 −g − β vy + 2 !#2 , 2 !#2 2 h −g − βvy 2 2 T (105) 17 Although (105) contains explicit forms of the vector’s components, it is not recommended that such expressions be coded due to the confusing volley of delimiters. These equations are as hard to read as they are to type. Rather, it is better to take advantage of the general structure of the equations and let the computer do the work. The coding segment below lends to this idea. Stage 1 arg1 = yn(i-1) arg2 = vyn(i-1) fy1(1) = arg2 fy1(2) = -g - beta*arg2*arg2 Stage 2 arg1 = yn(i-1) + 0.5d0*h*fy1(1) arg2 = vyn(i-1) + 0.5d0*h*fy1(2) fy2(1) = arg2 fy2(2) = -g - beta*arg2*arg2 As the above coding segment indicates (only the first two stages are shown), we do not explicitly evaluate the slope equations; rather, the computer does so by calculating quantities in the order specified by application of the prototype function. The formulas (105) and earlier were produced by explicit algebraic manipulation. The same thing is performed in the coding, but the computation is less explicit. Terms like fy1 and fy2 retain running totals. This procedure makes for a relatively short, easy to program code. Of course, the up to date solution for y is provided by (78), the Runge-Kutta sum formula. 18 450 400 350 300 y 250 200 150 Leap-Frog Exact 100 50 0 -50 0 100 200 300 400 x 500 600 700 800 Figure 2: Leap-Frog solution versus exact solution for the drag free case. Range is denoted by x; altitude is denoted by y. Distances are in meters. 4 Results The test problems selected for this report are neither complicated nor are they earthshaking. Still, they are sufficient to test the Leap-Frog and Fourth Order Runge-Kutta schemes; the author also finds them to be both interesting and fun to solve. The problems tested are (i) the gravity only ballistic motion case and (ii) ballistic motion with a simple drag model. The trajectories for an unspecified mass are computed in a vertical plane where x is the down range coordinate; y is the altitude coordinate. As is elucidated in Section 2, analytical solutions exist for both cases providing a sound basis for comparison with numerical solutions. Trajectory errors in both the x and y coordinates are computed and presented in tables for both numerical schemes. 4.1 Gravity Only of Drag-Free Ballistic Motion For this model problem, a projectile is launched upward at an angle of 65o with the horizontal or ground plane. The initial velocity is 100 meters per second, 42.26 m/s in the x direction, 90.63 m/s in the y direction. The projectile altitude at launch is two meters. The initial value of x is set at zero. The acceleration of gravity is taken as 9.806 m/s2 . The exact solution specifies that the projectile reaches at maximum altitude of 420.82 m in 9.24 seconds 390.60 m down range. At 18.51 seconds after launch, the object strikes the ground 782.14 m down range. Both the Leap-Frog and Runge-Kutta fourth order numerical solutions have been computed for this problem using a temporal step size of 0.01 seconds. The Leap-Frog solution is plotted against the exact solution in Figure 2. 19 450 400 350 300 y 250 200 150 RK4 Exact 100 50 0 -50 0 100 200 300 400 x 500 600 700 800 Figure 3: Runge-Kutta fourth order solution versus exact solution for the drag free case. Range is denoted by x; altitude is denoted by y. Distances are in meters. As is evident from Figure 2, the Leap-Frog solution compares quite favorably with exact solution. Still, some error is visible and can be revealed in detail by examining error magnitudes for select trajectory points. This information is presented in Table 1. As one may suspect, the error in x displacement is negligible since the projectile’s x velocity is constant. On the other hand, the error in the y coordinate is substantially larger and increases with the duration of projectile flight. This property of the error is expected given that a small error existing in the simulation may increase with time. Refining the time step to a smaller value mitigates the magnitude and growth of this error. The numerical solution generated by the fourth order Runge-Kutta scheme is shown in Figure 3 for the drag free ballistic motion problem. This method is very accurate exhibiting excellent agreement with the exact solution. Table 2 contains a comparison of the errors exhibited by the x and y coordinates. The accuracy of the y coordinate’s solution far exceeds that of the Leap-Frog scheme. Both numerical algorithms perform well for this problem, but the accuracy of the Leap-Frog algorithm is called into question when longer integration times are required. 4.2 Ballistic Motion with a Simple Drag Model An exact solution is detailed in Section 2.2 for the problem of ballistic motion with a simple drag model. In this model, the acceleration due to drag is assumed to be proportional to the Cartesian velocity squared. The constant of proportionality is denoted β. This report considers three different values for β, i.e., β = 0.001, 0.010 and 0.100. Both the Leap-Frog 20 Table 1: Percent error computed for the Leap-Frog solution with respect to the exact solution for the drag free model Time (s) 1.0 3.0 5.0 7.0 9.0 11.0 13.0 15.0 17.0 x % Error -1.008 x 10−13 -5.043 x 10−13 7.532 x 10−13 3.842 x 10−13 -5.977 x 10−13 -1.234 x 10−12 -1.676 x 10−12 -1.991 x 10−12 -2.231 x 10−12 y % Error 0.1106 0.1192 0.1471 0.1730 0.2096 0.2656 0.3622 0.5691 1.324 Table 2: Percent error computed for the fourth order Runge-Kutta solution with respect to the exact solution for the drag free model Time (s) 1.0 3.0 5.0 7.0 9.0 11.0 13.0 15.0 17.0 x % Error -1.188 x 10−13 -5.061 x 10−13 7.412 x 10−13 3.848 x 10−13 -5.984 x 10−13 -1.236 x 10−12 -1.677 x 10−12 -1.991 x 10−12 -2.248 x 10−12 21 y % Error 3.269 x 10−14 6.977 x 10−14 2.053 x 10−13 3.158 x 10−13 5.407 x 10−13 7.983 x 10−13 1.243 x 10−12 2.327 x 10−12 5.807 x 10−12 350 300 250 y 200 150 Leap-Frog Exact 100 50 0 -50 0 50 100 150 200 250 x 300 350 400 450 500 Figure 4: Leap-Frog solution versus exact solution for the drag model with β = 0.001. Range is denoted by x; altitude is denoted by y. Distances are in meters. and fourth order Runge-Kutta methods are applied to solve these cases. For all test cases, the time step is held fixed at 10−3 seconds. The numerical and exact solutions are compared to test the two algorithms. First we consider the low drag case where β = 0.001. The exact solution for this case shows that the projectile reaches a maximum altitude of 308.2 meters in 7.48 seconds 274.8 meters down range. It strikes the ground at 15.0 seconds at a range of 490.7 meters. The Leap-Frog numerical solution for this case is compared against the exact solution in Figure 4. Overall, the Leap Frog results agree quite well with the analytical solution. The error in the Leap-Frog trajectory is specified at a collection of points. This information is provided in Table 3. Since the projectile decelerates under drag, the x velocity decreases, so the error associated with the x coordinate of the trajectory is larger than in the drag free case. The errors for the y trajectory points are smaller than in the drag free case. That result is interesting, but it likely to have occurred because all change in the motion for the drag free case is invested in the y coordinate. For the most part, the errors remain in the same order of magnitude except near the end of the trajectory. Figure 5 contains a plot of the fourth order Runge-Kutta solution for β = 0.001. Of course, the agreement between the numerical and exact solutions is excellent. The trajectory errors computed for several points are listed in Table 4. This data demonstrates that the Runge-Kutta solution is extremely accurate, but of course, this scheme requires many more mathematical operations. For the second drag model, β is set at 0.010. In a simple way of thinking, the drag is ten times stronger than in the first case. The analytical solution for this case shows that projectile reaches a maximum altitude of 113.9 meters in 3.95 seconds. The apex of flight 22 Table 3: Percent error computed for the Leap-Frog solution with respect to the exact solution for the drag model with β = 0.001 Time (s) 1.0 3.0 5.0 7.0 9.0 11.0 13.0 x % Error 4.135 x 10−3 3.982 x 10−3 3.844 x 10−3 3.722 x 10−3 3.612 x 10−3 3.512 x 10−3 3.422 x 10−3 y % Error 1.921 x 10−2 1.989 x 10−2 2.144 x 10−2 2.455 x 10−2 3.058 x 10−2 4.381 x 10−2 8.595 x 10−2 350 300 250 y 200 150 RK4 Exact 100 50 0 -50 0 50 100 150 200 250 x 300 350 400 450 500 Figure 5: Runge-Kutta fourth order solution versus exact solution for the drag model with β = 0.001. Range is denoted by x; altitude is denoted by y. Distances are in meters. 23 Table 4: Percent error computed for the fourth order Runge-Kutta solution with respect to the exact solution for the drag model with β = 0.001 Time (s) 1.0 3.0 5.0 7.0 9.0 11.0 13.0 x % Error -1.031 x 10−13 -3.572 x 10−14 8.897 x 10−14 4.387 x 10−13 6.172 x 10−13 9.083 x 10−13 9.736 x 10−13 y % Error 2.198 x 10−13 1.948 x 10−13 7.217 x 10−13 8.943 x 10−13 1.021 x 10−12 1.151 x 10−12 2.459 x 10−12 Table 5: Percent error computed for the Leap-Frog solution with respect to the exact solution for the drag model with β = 0.010 Time (s) 1.0 2.0 3.0 4.0 5.0 6.0 7.0 x % Error 3.557 x 10−2 3.157 x 10−2 2.883 x 10−2 2.682 x 10−2 2.524 x 10−2 2.398 x 10−2 2.294 x 10−2 y % Error 7.400 x 10−2 6.651 x 10−2 6.447 x 10−2 6.695 x 10−2 7.569 x 10−2 9.864 x 10−2 1.817 x 10−1 occurs 98.2 meters down range. The object strikes the ground in 7.92 seconds at a range of 147.0 meters. The Leap-Frog solution for this model is plotted in Figure 6. At face value, the agreement between the two solutions is quite good. Yet, a closer look is given by the errors in the computed trajectory coordinates. These errors are listed in Table 5. On the whole, these errors are somewhat larger than those for the previous drag model. In addition, a plot in very close agreement with the analytical solution is provided by the fourth order Runge-Kutta scheme; this item is shown in Figure 7. Moreover, the attendant trajectory coordinate errors are given in Table 6. As in the previous cases, the accuracy of the RungeKutta method exceeds that of the Leap-Frog method by eight to nine orders of magnitude. That result, in itself, is quite impressive and is a fairly consistent result across all of the problems considered thus far. That having been said, the error magnitudes are also fairly consistent for the Leap-Frog method. The final test case considered in this report is the high drag model where β is set at 0.100. In this case, the projectile reaches a maximum altitude of 24.2 meters in 1.47 seconds at a distance of 19.8 meters down range. The object strikes the ground at 2.97 seconds, 26.1 meters down range. Figure 8 contains a plot of the Leap-Frog solution for this case. 24 120 100 80 y 60 40 Leap-Frog Exact 20 0 -20 0 20 40 60 80 x 100 120 140 160 Figure 6: Leap-Frog solution versus exact solution for the drag model with β = 0.010. Range is denoted by x; altitude is denoted by y. Distances are in meters. 120 100 80 y 60 40 RK4 Exact 20 0 -20 0 20 40 60 80 x 100 120 140 160 Figure 7: Runge-Kutta fourth order solution versus exact solution for the drag model with β = 0.010. Range is denoted by x; altitude is denoted by y. Distances are in meters. 25 Table 6: Percent error computed for the fourth order Runge-Kutta solution with respect to the exact solution for the drag model with β = 0.010 Time (s) 1.0 2.0 3.0 4.0 5.0 6.0 7.0 x % Error -2.219 x 10−13 -1.972 x 10−13 5.207 x 10−14 3.302 x 10−13 3.629 x 10−13 2.475 x 10−13 1.446 x 10−13 y % Error -2.613 x 10−12 -9.234 x 10−13 -6.366 x 10−13 -5.864 x 10−13 -5.241 x 10−13 -5.261 x 10−13 -6.358 x 10−13 Table 7: Percent error computed for the Leap-Frog solution with respect to the exact solution for the drag model with β = 0.100 Time (s) 2.0 6.0 1.0 1.4 1.8 2.2 2.6 x % Error 3.136 x 10−1 2.388 x 10−1 2.057 x 10−1 1.861 x 10−1 1.728 x 10−1 1.629 x 10−1 1.553 x 10−1 y % Error 4.749 x 10−1 3.819 x 10−1 3.491 x 10−1 3.425 x 10−1 3.585 x 10−1 4.129 x 10−1 6.095 x 10−1 For this high drag problem, the Leap-Frog algorithm does not perform as well. There are clear differences visible between the numerical and exact trajectories. This fact motivates an examination of the errors in the computed trajectory coordinates. Table 7 contains this information. On average, the errors for the Leap-Frog solution are one order of magnitude larger than those associated with models of lesser drag. The final fourth order Runge-Kutta solution is shown in Figure 9 for the high drag problem. The solution exhibits excellent performance in terms of accuracy. Although the errors are on average two orders of magnitude higher than in the preceding test cases, the solution is still accurate to 10−9 . Its plotted appearance is quite good, and the sampling of errors for the computed trajectory is provided in Table 8. For both numerical schemes, solution quality suffers some simply because of the shortness of the event for a fixed temporal step size. Projectile velocity deteriorates rapidly at high drag, so the flight is of shorter duration. 26 25 20 y 15 10 Leap-Frog Exact 5 0 -5 0 5 10 15 x 20 25 30 Figure 8: Leap-Frog solution versus exact solution for the drag model with β = 0.100. Range is denoted by x; altitude is denoted by y. Distances are in meters. 25 20 y 15 10 RK4 Exact 5 0 -5 0 5 10 15 x 20 25 30 Figure 9: Runge-Kutta fourth order solution versus exact solution for the drag model with β = 0.100. Range is denoted by x; altitude is denoted by y. Distances are in meters. 27 Table 8: Percent error computed for the fourth order Runge-Kutta solution with respect to the exact solution for the drag model with β = 0.100 Time (s) 0.2 0.6 1.0 1.4 1.8 2.2 2.6 x % Error -7.332 x 10−10 -3.087 x 10−10 -2.133 x 10−10 -1.721 x 10−10 -1.487 x 10−10 -1.336 x 10−10 -1.229 x 10−10 28 y % Error -7.394 x 10−9 -3.713 x 10−9 -2.926 x 10−9 -2.621 x 10−9 -2.515 x 10−9 -2.551 x 10−9 -2.708 x 10−9 5 Summary This report concerns the study of two numerical schemes for ordinary differential equations, particularly those equations that model velocity and displacement in multiple dimensions. Although the topic of molecular dynamics is not addressed here, the author’s interest in this subject motivates this study. The Leap-Frog staggered time integration scheme is compared with the venerable fourth order Runge-Kutta scheme. In terms of speed and minimizing the number of mathematical operations, the Leap-Frog scheme prevails. It is a fast an inexpensive numerical scheme, yet it suffers from lesser accuracy. Since its errors do exhibit some growth, the Leap-Frog scheme must be applied with caution for problems involving long time integration intervals. From the standpoint of sheer accuracy, the fourth order Runge-Kutta scheme is the clear winner. In each case, its accuracy exceeds that of the Leap-Frog method. The Runge-Kutta scheme also exhibits great flexibility in its ability to address systems of ordinary differential equations as well as those problems with multiple time dependent arguments. 29 A Appendix: Fourth Order Runge-Kutta Scheme Derivation I have enjoyed working with Runge-Kutta schemes since I was first introduced to them some thirty-seven years ago. Explicit Runge-Kutta schemes are often used for simulating time-dependent phenomena or for solving ODEs that involve “marching problems”. Because of their high functionality and easy programmability, explicit Runge-Kutta schemes are frequently used as starting methods for multi-step algorithms, e.g., Adams-Moulton formulas.[9] Systems of ODEs are also easily addressed by Runge-Kutta methods, but are the Runge-Kutta formulas easy to derive? No, they are not. A significant part of my time as an undergraduate was spent trying to derive the standard fourth order scheme, and I did not succeed. Now, as a retired, but still functional researcher, with many addtional years of experience, I have finally managed to complete a derivation of the common fourth order Runge-Kutta scheme. This derivation required a great deal of work spread out over two weeks of time. For these reasons, it is documented below in its entirety. In order to provide credit where credit is due, Reference [10] is employed and enhanced with additional details. As with many other numerical algorithms, the Runge-Kutta schemes are based upon the careful application of Taylor series. The model ODE may be written as dy = f (t, y) (106) dt Of course, Taylor series may be used to solve this ODE in a direct way, but doing so requires knowledge of the derivatives of f . Derivative calculation can be a time-consuming and tedious process, so the Runge-Kutta schemes were developed, in part, to avoid this problem.[5] These methods function by performing a simple integration of (106) as in the Euler method, i.e., y n+1 = y n + hf (tn , y n ) (107) If we regard t as the time-like variable, then tn and tn+1 are the old and new time levels, respectively; n is the time step or iteration counter, and h = tn+1 − tn is the time step increment. The quantity f (tn , y n ) is the “slope” or the rate of change of y at time level n. Higher order Runge-Kutta methods are created by computing a series of slope values for intermediate values of t and, by association, y. Then these slopes are averaged to estimate y n+1 at the end of the new time step. For the standard fourth order Runge Kutta scheme, the intermediate slope values are provided as f1 = f (tn , y n ) f2 = f (tn + h/2, y n + h/2f1 ) f3 = f (tn + h/2, y n + h/2f2 ) f4 = f (tn + h, y n + hf3 ) (108a) (108b) (108c) (108d) These slopes are averaged in a simple linear combination to form the ODE integration equation 30 y n+1 = y n + h(a f1 + b f2 + c f3 + d f4 ) (109) its local order of accuracy being 4 5 d y Error ≈ O h dt In (109) a, b, c and d are constant but undetermined coefficients. The crux of this section describes a means for determining those coefficients. As is outlined in other references, one may also include constant fractions of the step size used in the four slope expressions as additional undetermined coefficients. Although there is great value in going to that extent, doing so complicates an already tedious derivation. For this reason, the fixed fractions of h shown in (108) are employed here. The derivation of Runge-Kutta methods of ever higher orders is an intimidating prospect. A lion’s share of the angst comes from a realization of the large number of terms involved even though the bulk of the mathematics is just algebra. There is a lot to be said for knowing how to organize the math, and a fore knowledge of certain “tricks” that one may pull to simplify the work. As it regards this derivation, I, like a real-life Gilderoy Lockhart, can’t seem to conjure up any helpful magic tricks.[11] Instead, I have had to rely upon lots of paper, some shorthand substitutions and much late night work. What I have found to be most helpful is learning just which terms in the Taylor series expansions are important as well as which terms may be ignored. These clues I discuss in more detail as the derivation evolves. Two Taylor series expansions constitute the core of a Runge-Kutta method’s derivation. As is indicated by equations (106) and (107), the independent and dependent variables are t and y, respectively.[5] The first, and somewhat easier Taylor series to develop is for y(t) and involves the total derivatives of y taken with respect to t. This series is used as a basis for comparison in the computation of the coefficients shown in (109). The second Taylor series required is calculated from the slope functions fi , i = 1, . . . , 4. These functions are defined in terms of the two variables t and y. It follows that this Taylor series is cast in those two variables and requires partial derivatives of the prototype function f . It is in the computation of these Taylor series that significant algebraic tedium emerges giving rise to the need for much, much work. We will begin by developing the standard Taylor series for y. A.1 Taylor Series for the Dependent Variable “y” The classic Taylor series for a dependant variable such as y is given by the countably infinite series of the form h2 h3 h 0 y (t) + y 00 (t) + y 000 (t) + · · · 1! 2! 3! 0 You may recall that y (t) is given by the ODE itself, i.e., y(t + h) = y(t) + 31 (110) dy = y 0 (t) = f (t, y(t)) (111) dt Since y 0 (t) is presented in this form, the chain rule for partial derivatives must be applied to compute higher order derivatives for y. Note that f depends on both t and y while y depends solely upon t. Based on these dependencies, y 00 is computed as follows. d d 0 y (t) = f (t, y) dt dt By applying the chain rule [3], the right side of (112) may be expanded as y 00 (t) = y 00 (t) = ∂f ∂f dy + ∂t ∂y dt (112) (113) Note that dy/dt has been used in lieu of ∂y/∂t in (113) since y depends only upon t. It follows from (111) that y 00 (t) = ∂f ∂f +f ∂t ∂y (114) The reader will also observe that the arguments have been dropped from f in order to simplify the notation. When the function f is typed simply as f , it is to be understood that its arguments are t and y. Even for a scientist as old as I, equations such as (114) incite momentary confusion because when I pause to actually read the equation, the left side depends solely upon t while the other side depends upon both t and y. How can this be? Variable y depends on t whose value begins at zero and increases monotonically; that locus of t is indeed the support set of function y (which I referred to as a variable in the context of f ). The confusion is ameliorated somewhat when one realizes that the support of f is different as it is composed of ordered pairs (t, y(t)). Hence, both sides rely upon t, but the support sets are different for each side of the equation. You may need to think about that for a while; I know I do. The third ordinary derivative of y is computed in a similar manner. The complication in the mathematics arises in application of the chain rule. We differentiate (114) as follows. ∂f d ∂f 000 +f (115) y (t) = dt ∂t ∂y Differentiation is a linear operation, so can differentiate terms individually, i.e., d ∂f d ∂f 000 + f y (t) = dt ∂t dt ∂y (116) We then apply the chain rule as before and expand the ordinary derivatives. The sequence of steps is shown below. ∂ ∂f ∂ ∂f df ∂f d ∂f 000 y (t) = +f + +f (117) ∂t ∂t ∂y ∂t dt ∂y dt ∂y 32 ∂ y (t) = ∂t 000 ∂f ∂t ∂ ∂f ∂f ∂f ∂f +f + +f ∂y ∂t ∂t ∂y ∂y ∂ ∂f ∂ ∂f +f +f ∂t ∂y ∂y ∂y (118) By collecting terms, we obtain 2 ∂ 2f ∂f ∂f ∂ 2f ∂f 2 ∂ f y (t) = 2 + 2f +f +f (119) + ∂t ∂t∂y ∂y 2 ∂t ∂y ∂y Last but not least, the fourth ordinary derivative of y is needed. As one may suspect, we differentiate the third derivative (119) accordingly. That is, 2 d ∂ 2f ∂ 2f ∂f ∂f ∂f (4) 2 ∂ f y (t) = + 2f +f + +f (120) dt ∂t2 ∂t∂y ∂y 2 ∂t ∂y ∂y It seems prudent to separate the argument into five distinct terms, i.e., 000 d y (4) (t) = dt 2 2 2 ∂ f d ∂ f d d ∂f ∂f d 2 ∂ f +2 + f + + 2 2 ∂t dt ∂t∂y dt ∂y dt ∂t ∂y dt f ∂f ∂y 2 ! (121) The terms in (121) must be individually differentiated. Consider the first term involving the second partial of f with respect to t. d ∂ 2f ∂ 3f ∂ ∂ 2f ∂ ∂ 2f ∂ 3f + f (122) = + f = dt ∂t2 ∂t ∂t2 ∂y ∂t2 ∂t3 ∂t2 ∂y The second term is elucidated as follows. 2 d ∂ 2f df ∂ 2 f ∂ f +f =2 ∂t∂y dt ∂t∂y dt ∂t∂y 2 2 2 ∂f ∂f ∂ f ∂ ∂ f ∂ ∂ f +f +f =2 +f ∂t ∂y ∂t∂y ∂t ∂t∂y ∂y ∂t∂y 2 3 3 ∂f ∂f ∂ f ∂ f ∂ f =2 +f + f 2 + f2 ∂t ∂y ∂t∂y ∂t ∂y ∂t∂y 2 d 2 dt (123) A similar application of the chain rule can be employed to resolve the form of the third term. In this case, the power rule is helpful in differentiating f 2 . Observe that d dt 2 2 d 2 ∂ 2f ∂ f 2∂ f 2 d f = f +f 2 2 ∂y dt ∂y dt ∂y 2 df ∂ 2 f ∂ ∂ 2f ∂ ∂ 2f 2 = 2f +f +f dt ∂y 2 ∂t ∂y 2 ∂y ∂y 2 2 3 3 ∂f ∂f ∂ f 2 ∂ f 3∂ f = 2f +f + f + f ∂t ∂y ∂y 2 ∂t∂y 2 ∂y 3 33 (124) The fourth term can be readily attacked as a differentiable product. By applying the product rule and simplifying, we have that d ∂f ∂f ∂f d ∂f d ∂f ∂f = + dt ∂t ∂y dt ∂t ∂y ∂t dt ∂y ∂ ∂f ∂ ∂f ∂f ∂f ∂ ∂f ∂ ∂f = +f + +f ∂t ∂t ∂y ∂t ∂y ∂t ∂t ∂y ∂y ∂y 2 2 2 2 ∂ f ∂f ∂ f ∂f ∂ f ∂f ∂ f ∂f = 2 +f + + +f ∂t ∂y ∂t∂y ∂y ∂t∂y ∂t ∂y 2 ∂t (125) The final term in the expansion for y (4) (t) is obtained in a manner similar to that applied above through the use of power, product and chain rules.[3, 10] The details are shown below. d dt f ∂f ∂y 2 ! 2 2 df ∂f d ∂f = +f dt ∂y dt ∂y 2 ∂f ∂f ∂f ∂f ∂ ∂f ∂ ∂f = +2f +f +f ∂t ∂y ∂y ∂y ∂t ∂y ∂y ∂y 2 2 ∂f ∂f ∂ 2f ∂f ∂f ∂ f = +f +f 2 + 2f ∂t ∂y ∂y ∂y ∂t∂y ∂y (126) With the use of (122) through (A.1), after regrouping terms, the fourth derivative of y can be written as follows. 2 3 3 2 ∂ 3f ∂ 3f ∂ f ∂ 2f ∂f d4 y 2 ∂ f 3∂ f 2 ∂ = + 3f + 3f + f + + 2f + f dt4 ∂t3 ∂t2 ∂y ∂t∂y 2 ∂y 3 ∂t2 ∂t∂y ∂t∂y ∂y 2 2 ∂f ∂f ∂f ∂f ∂f ∂f ∂ f ∂f ∂ 2 f +f +f +3 +f + + 3f ∂t ∂y ∂y ∂t ∂y ∂y 2 ∂t ∂y ∂t∂y (127) By using equations (110) through (127), the Taylor series for y may be written as y n+1 2 h2 ∂f ∂f h3 ∂ 2 f ∂ 2f 2∂ f = y + hf + +f + + 2f +f 2 ∂t ∂y 3! ∂t2 ∂t∂f ∂y 2 " # " # 2 2 h4 ∂f ∂f h3 ∂f ∂f ∂f ∂f + + +f +f 3! ∂t ∂y ∂y 4! ∂t ∂y ∂y 3 3 h4 ∂ 3 f ∂ 3f 2 ∂ f 3∂ f + + 3f + 3f + f 4! ∂t3 ∂t2 ∂f ∂t∂y 2 ∂y 3 2 h4 ∂ 2 f ∂ 2f ∂f h4 ∂f ∂f ∂ 2 f 2∂ f + + 2f +f + 3f +f 4! ∂t2 ∂t∂f ∂y 2 ∂y 4! ∂t ∂y ∂y 2 h4 ∂f ∂f ∂ 2 f + 3 +f + O(h5 ) 4! ∂t ∂y ∂t∂y n 34 (128) This series is the basis for comparison with the Runge-Kutta fourth order equation to be derived below. A.2 Taylor Series for the Runge-Kutta Slope Expressions Each of the Runge-Kutta slope forms in (108) must be expanded in Taylor series cast in two variables and then substituted into (109) in order to build an expression for comparison with (128). Then we may resolve undetermined coefficients a through d. Although it is a lackluster way of doing thing, these series are expanded about the point (t, y) without theu use of subscripted coordinates. This action is taken to promote some level of brevity in the midst of tedious and lengthy derivations. We begin with the easiest case, f1 = f (t, y). Since it is already written in the target arguments, it is its own one term series expansion. Since its expansion is complete, we also drop the arguments of f . Hence, f1 = f (129) As we begin the series expansion of f2 , a larger quantity of work is required. Recall from (108), that f2 (t, y) = f (t + h/2, y + hf1 /2) (130) To apply the Taylor series in two variables, the increments separating the arguments from (t, y) are h/2 and hf1 /2, respectively. Taylor series for multi-variable quantities can become complicated. In the case of these two variables, the operator θ= ∂ ∂ +f ∂t ∂y is employed just as in the binomial theorem where n ∂ ∂ n θ = +f ∂t ∂y (131) (132) Therefore, the Taylor series may be written as h 1 f2 = f + θf + 2 2 2 h θ2 f + · · · 2 (133) Many terms repeat in these binomial products, so like terms add up in the series. In the case of f2 , the detailed result is 2 2 2 h ∂f 1 h ∂ f ∂ 2f ∂f 2∂ f f2 = f + + + 2f +f +f 2 ∂t ∂y 2! 2 ∂t2 ∂t∂y ∂y 2 3 3 3 3 1 h ∂ f ∂ 3f 2 ∂ f 3∂ f + + 3f + 3f + f + O(h4 f (4) ) 3! 2 ∂t3 ∂t2 ∂y ∂t∂y 2 ∂y 3 35 (134) (135) In retrospect, the calculation of the Taylor series for f2 was not too difficult given the equivalence of f1 to f . From my point of view, it is advantageous to establish some shorthand notation at this point that is applied throughout the remainder of these derivations. Let ∂f 1 ∂f +f (136) δ1 = 2 ∂t ∂y 2 1 ∂ 2f ∂ 2f 2∂ f δ2 = +f (137) + 2f 8 ∂t2 ∂t∂y ∂y 2 3 3 1 ∂ 3f ∂ 3f 2 ∂ f 3∂ f δ3 = (138) + 3f 2 + 3f +f 48 ∂t3 ∂t ∂y ∂t∂y 2 ∂y 3 With the use of (136) through (138), f2 can be easily rewritten as f2 = f + hδ1 + h2 δ2 + h3 δ3 + O(h4 f (4) ) (139) Although the computation of the Taylor series for f3 is next under consideration, the form of f22 is needed for use in f3 . It can be shown that f22 = f 2 + h(2f δ1 ) + h2 (2f δ2 + δ12 ) + h3 [2(f δ3 + δ1 δ2 )] + O(h4 f(4) ) (140) Computing powers of f2 entails tricky calculations. It is not shown here due to page size restrictions, but I prepared a multiplication table for f2 × f2 . The table is comprised of a horizontal row containing the elements of f2 intersecting a vertical column also containing the elements of f2 . Then I would multiply each horizontal entry with each vertical entry. The upper left corner entry of the table thus contains f 2 . The summation of elements of the same order of h are given by carefully adding elements along minor diagonals, i.e., those table diagonals leading from lower left to upper right. The product f23 is also required. It is calculated in a similar manner by constructing an f2 × f22 table. The result is f23 = f 3 + h(3f 2 δ1 ) + h2 [3(f 2 δ2 + f δ12 )] + h3 [3f 2 δ3 + 6f δ1 δ2 + δ13 ] + O(h4 f (4) ) (141) As we plod onward, the next step in deriving coefficients for this fourth order scheme is to expand f3 in Taylor series form. Recall from (108) that f3 (t, y) = f (t + h/2, y + hf /2) (142) This expression has the following Taylor expansion in t and y. 2 2 2 h ∂f ∂f 1 h ∂ f ∂ 2f 2∂ f f3 = f + + f2 + + 2f2 + f2 2 2 ∂t ∂y 2! 2 ∂t2 ∂t∂y ∂y 3 3 3 3 1 h ∂ f ∂ 3f 2 ∂ f 3∂ f + + 3f + 3f + f 2 2 2 3! 2 ∂t3 ∂t2 ∂y ∂t∂y 2 ∂y 3 + O(h4 f (4) ) (143) (144) 36 To continue the derivation, (139), (140) and (141) must be substituted into (144) as is shown below. ∂f h ∂f 2 3 f3 = f + + f + hδ1 + h δ2 + h δ3 + · · · 2 ∂t ∂y 2 2 ∂ 2f ∂ f 1 h 2 3 + + 2 f + hδ + h δ + h δ + · · · 1 2 3 2! 2 ∂t2 ∂t∂y + [f 2 ∂ 2f + h(2f δ1 ) + h (2f δ2 + δ12 ) + h3 [2(f δ3 + δ1 δ2 )] + · · · ] 2 2 ∂y 3 3 ∂ 3f 1 h ∂ f 2 3 + + 3 f + hδ + h δ + h δ + · · · 1 2 3 3! 2 ∂t3 ∂t2 ∂y + 3[f 2 + h(2f δ1 ) + h2 (2f δ2 + δ12 ) + h3 [2(f δ3 + δ1 δ2 )] + · · · ] 3 2 2 2 2 3 + [f + h(3f δ1 + h [3(f δ2 + f δ1 )] + h [3f 4 (4) + O(h f 2 ∂ 3f ∂t∂y 2 ∂ 3f δ3 + 6f δ1 δ2 + δ13 ] + · · · ] 3 ∂y ) (145) Within this form for f3 , we begin the process of grouping terms by orders of h and by isolating familiar differential operators. ∂f ∂f h h ∂f 2 ∂f 3 ∂f +f + h δ2 + h δ3 + ··· + hδ1 f3 = f + 2 ∂t ∂y 2 ∂y ∂y ∂y 2 2 2 1 h ∂ f ∂ 2f 2∂ f + + 2f +f 2 2 ∂t2 ∂t∂y ∂y 2 2 1 h ∂ 2f ∂ 2f ∂ 2f 2 3 2hδ1 + 2h δ2 + 2h δ3 + ··· + 2 2 ∂t∂y ∂t∂y ∂t∂y 3 3 3 3 h ∂ f ∂ 3f 2 ∂ f 3∂ f + 3f 2 + 3f +f (146) 2 ∂t3 ∂t ∂y ∂t∂y 2 ∂y 3 3 1 h ∂ 3f ∂ 3f ∂ 3f 2 3 + 3hδ1 2 + 3h δ2 2 + 3h δ3 2 + · · · 3! 2 ∂t ∂y ∂t ∂y ∂t ∂y 3 3 3 1 h ∂ f ∂ 3f 2 2 ∂ f 3 + 3h (2f δ2 + δ1 ) + 3h [2(f δ3 + δ1 δ2 )] + ··· + 3h(2f δ1 ) 3! 2 ∂t∂y 2 ∂t∂y 2 ∂t∂y 2 3 3 1 h ∂ 3f ∂ 3f 2 2 2 2 ∂ f 3 2 + h(3f δ1 ) 3 + h [3(f δ2 + f δ1 )] 3 + h [3f δ3 + 6δ1 δ2 + δ3 ] 3 + · · · 3! 2 ∂y ∂y ∂y 1 + 3! Substitutions may be made for some of the lengthy terms in this equation by using (136) through (138), and terms may be arranged by powers of h. 37 h2 ∂f h3 ∂f h3 ∂ 2 f H3 ∂ 2f δ1 + h2 δ2 + δ2 + δ1 + (2f δ1 ) 2 2 ∂y 2 ∂y 4 ∂t∂y 8 ∂y 2 4 2 4 4 3 4 ∂ f h ∂ f h ∂ f h ∂f 3h + δ2 + (2f δ2 + δ12 ) 2 + δ1 2 + h3 δ3 + δ3 2 ∂y 4 ∂t∂y 8 ∂y 3! 8 ∂t ∂y 4 3 2 5 2 5 ∂ f ∂ f h ∂ f 3h h 3 h5 ∂ 3 f (3f 2 δ1 ) 3 + δ3 + [2(f δ3 + δ1 δ2 )] 2 + δ2 + 3! 8 ∂y 4 ∂t∂y 8 ∂y 3! 8 ∂t2 ∂y 1 h5 ∂ 3f 3 h6 ∂ 3f 3 h6 ∂ 3 f + [3(f 2 δ2 + f δ12 )] 3 + + [2(f δ + δ δ )] 3 1 2 3! 8 ∂y 3! 8 ∂t2 ∂y 3! 8 ∂t∂y 2 ∂ 3f 1 h6 (3f 2 δ3 + 6f δ1 δ2 + δ13 ) 3 + · · · + 3! 8 ∂y f3 = f + hδ1 + (147) Of course, (147) is a long, eye straining series for f3 , but its terms are well ordered with the powers of h. It is unfortunate, but we also need f32 and f33 for use in deriving f4 . As before, I have used a tabular manner to help calculate these product series. Several terms of f32 are shown below. ∂f ∂f + h2 δ12 + 2h2 f δ2 + h3 δ12 ∂y ∂y 3 2 3 h ∂ f h ∂ 2f ∂f + 2h3 δ1 δ2 + f δ1 + (2f 2 δ1 ) 2 + 2h3 f δ3 + h3 f δ2 ∂y 2 ∂t∂y 4 ∂y 2 4 4 2 2 h 2 ∂f ∂f h 2∂ f h4 4 4 2 2 ∂ f + δ1 + 2h δ1 δ2 + δ1 + h δ2 + (2f δ1 ) 2 2 ∂y ∂y 2 ∂t∂y 4 ∂y 4 + 2h δ1 δ3 + · · · f32 = f 2 + 2hf δ1 + h2 f δ1 (148) Experience has shown that it is very helpful to know how to get to the final form of the equation being derived. Repeated tries and the attendant mistakes have proven that several terms of f32 are needed, yet only one term is required from f33 . To that end, we have that f33 = f 3 + · · · (149) With the use of (147), (148) and (149), the Taylor series for f4 can written and expanded. The basic expession may be written as 2 ∂f ∂f h2 ∂ 2 f ∂ 2f 2∂ f f4 = f + h + f3 + + 2f3 + f3 2 ∂t ∂y 2 ∂t2 ∂t∂y ∂y 3 3 3 3 3 h ∂ f ∂ f ∂ f ∂ f + + 3f3 2 + 3f32 + f33 3 3 2 3! ∂t ∂t ∂y ∂t∂y ∂y + O(h4 f (4) ) (150) (151) The series for f4 is expanded after substituting (147), (148) and (149). Although very messy, the post-substitution series is shown below. 38 ∂f h2 ∂f h3 ∂f h3 ∂ 2 f h3 ∂ 2f f4 = f + h + f + hδ1 + δ1 + h2 δ2 + δ2 + δ1 + (2f δ1 2 ∂t 2 ∂y 2 ∂y 4 ∂1∂y 8 ∂y 4 2 4 4 3 4 h ∂ f h h ∂ f ∂f h ∂f 2 3 + δ2 ∂y + (2f δ2 + δ1 + δ1 2 + · · · +h δ3 + δ3 2 ∂y 4 ∂t 8 16 ∂t ∂y ∂y 2 3 3 2 3 2 2 h ∂f h ∂ f h ∂ 2f h ∂ f h ∂f 2 + h δ2 + δ2 + δ1 + (2f δ1 ) 2 + + 2 f + hδ1 + δ1 2 ∂t2 2 ∂y 2 ∂y 4 ∂t∂y 8 ∂y 2 4 2 4 2 3 4 4 h ∂ f h ∂ f ∂ f ∂ f h ∂f h + δ2 ∂y + (2f δ2 + δ12 ) 2 + δ1 2 + · · · +h3 δ3 + δ3 2 ∂y 4 ∂t 8 ∂y 16 ∂ ∂y ∂t∂y ∂f ∂f ∂f + f 2 + 2hf δ1 + h2 f δ1 + h2 δ12 + 2h2 f δ2 + h3 δ12 + h3 f δ2 + 2h3 δ1 δ2 ∂y ∂y ∂y 2 ∂f h4 ∂ 2 f h4 2 ∂f + 2h4 δ1 δ2 + δ12 + h4 δ22 + δ1 2 ∂y ∂y 2 ∂t∂y 2 2 4 ∂ f ∂ f h + (2f δ12 ) 2 + 2h4 δ1 δ3 4 ∂y ∂y 2 3 h3 ∂ 3 f h2 ∂f ∂ f 2 + + 3 f + hδ1 + δ1 + h δ2 + · · · 3 3 ∂t 2 ∂y ∂t2 ∂y 3 ∂f ∂ f 2 2 2 2 2 +3 f + 2hf δ1 + h f δ1 + h δ1 + 2h f δ2 + · · · ∂y ∂t∂y 2 3 ∂ 3f + f + ··· + ··· ∂y 3 (152) Major terms may be isolated within this series as follows. f4 = f + h ∂f ∂f +f ∂t ∂y h2 ∂f h3 ∂f h3 ∂ 2 f + h hδ1 + δ1 + h2 δ2 + δ2 + δ1 2 ∂y 2 ∂y 4 ∂t∂y 3 2 4 h ∂ f h ∂f h4 ∂ 2 f + (2f δ1 ) 2 + h3 δ3 + δ3 + δ2 8 ∂y 2 ∂y 4 ∂t∂y 4 3 4 h h ∂ f ∂f + (2f δ2 + δ12 ) + δ1 2 + · · · 8 16 ∂t ∂y ∂y 39 2 2 ∂ f h h3 ∂ 2 f ∂ 2f 2∂ f 2 ∂f 2 3 ∂f + f + 2hδ + h δ + 2h δ + h δ + δ1 + 2f 1 1 2 2 ∂t2 ∂t∂t ∂y 2 2 ∂y ∂y 2 ∂t∂y h3 ∂ 2f h4 ∂ 2 f ∂f + (2f δ1 ) 2 + 2h3 δ3 + h4 δ3 + δ2 4 ∂y ∂y 2 ∂t∂y 2 4 3 4 h ∂ f ∂ f h + (2f δ2 + δ12 ) + δ1 2 + · · · 4 8 ∂t ∂y ∂t∂y (153) ∂f ∂f + 2hf δ1 + h2 f δ1 + h2 δ12 + 2h2 f δ2 + h3 δ12 ∂y ∂y 2 ∂f h4 ∂f + 2h3 δ1 δ2 + δ12 +h3 f δ2 ∂y 2 ∂y 4 2 ∂f h ∂ f +2h4 δ1 δ2 + δ12 + h4 δ22 ∂y 2 ∂t∂y 2 2 h4 ∂ f 2 ∂ f 4 + (2f δ1 ) 2 + 2h δ1 δ3 + · · · 4 ∂y ∂y 2 3 3 h3 ∂ 3 f ∂ 3f 2 ∂ f 3∂ f + + 3f + 3f + f + ··· 3! ∂t3 ∂ 2 ∂y ∂t∂y 2 ∂y 3 h2 + 2 It is now prudent to multiply through by the factor of h/2 and carefully simplify the above expression retaining only those terms where h is of the fourth order and lower. We obtain 2 ∂f h3 ∂f h4 ∂f ∂ 2 f ∂f ∂f 2 ∂f + h3 δ2 +f + h δ1 + δ1 + δ2 f4 = f + h ∂t ∂y ∂y 2 ∂y ∂y 2 ∂y ∂y 2 ∂f + ··· +h4 δ3 ∂y 2 h2 ∂ 2 f ∂ 2f h4 ∂f ∂ 2 f ∂ 2f 2∂ f 3 + + 2f + f + h δ + δ1 1 2 ∂t2 ∂t∂y ∂y 2 ∂t∂y 2 ∂y ∂t∂y ∂ 2f +h4 δ2 + ··· ∂t∂y ∂ 2f h4 ∂f ∂ 2 f h4 2 ∂ 2 f ∂ 2f 4 +h3 f δ1 2 + f δ1 + δ + h f δ + ··· 2 ∂y 2 ∂y ∂y 2 2 1 ∂y 2 ∂y 2 3 3 h3 ∂ 3 f ∂ 3f 2 ∂ f 3∂ f + +f 2 +f +f + ··· 3! ∂t3 ∂t ∂y ∂t∂y 2 ∂y 3 (154) Clearly, (154) is a much shorter expression than its predecessors. The earlier forms were maintained lengthy to ensure that all of the important terms for the fourth order expansion were retained. The loss of a single relevant term would invalidate the calculate of the weight constants for the slopes f1 through f4 . With this pitfall hopefully avoided, we can now sum up the slope terms as in (109). As before, progress is made in small steps; begin by calculating af1 + bf2 + cf3 + df4 . 40 af1 + bf2 + cf3 + df4 = af + b(f + hδ1 + h2 δ2 + h3 δ3 + · · · ) h3 ∂f h3 ∂ 2 f h3 ∂ 2f h2 ∂f + δ2 δ1 + (2f δ1 ) 2 +c f + hδ1 + δ1 2 ∂y 2 ∂y 4 ∂t∂y 8 ∂y 3 + h δ3 + · · · 2 h3 ∂f ∂f 2 ∂f +d f + 2hδ1 + h δ1 + δ1 + h3 δ2 ∂y 2 ∂y ∂y ∂ 2f h4 ∂f ∂ 2 f 2 3 4 ∂f + 4h δ2 + h δ1 + δ2 + h δ3 2 ∂y ∂y 2 ∂y ∂t∂y 2 2 4 ∂ f h ∂f ∂ f 3 3 + h f δ1 2 + 8h δ3 + · · · + · · · + δ1 2 ∂y ∂t∂y ∂y (155) (156) If the above expression is multiplied by h, then it may be compared term by term with the Taylor series for y (128) to obtain equations relating the undetermined coefficients a through d. From the zeroth order term, we obtain the following. af + bf + cf + df = f =⇒ a + b + c + d = 1 (157) From the first order term, we have bδ1 + cδ1 + 2dδ1 = δ1 =⇒ b + c + 2d = 1 (158) The second order term yields b c 1 4 bδ2 + cδ2 + 4dδ2 = δ2 =⇒ + + d = 3 4 4 3 Arising from a third order term, we find bδ3 + cδ3 + 8dδ3 = 2δ3 =⇒ 1 b c + +d= 8 8 4 (159) (160) A second third order term is given by h2 ∂f 1 ∂f ∂f ∂f 2 ∂f c δ1 + dh δ1 = +f 2 ∂y ∂y 3! ∂y ∂y ∂y 2 h ∂f ∂f 1 ∂f c 1 + dh2 δ1 = δ1 =⇒ + d = c δ1 2 ∂y ∂y 3 ∂y 2 3 (161) From a fourth order term, we have that c ∂f ∂f 1 δ2 + dδ2 = 2 ∂y ∂y 24 2 ∂2 ∂ 2f 2∂ f + 2f + f ∂t2 ∂t∂y ∂y 2 41 ∂f c ∂f ∂f 1 ∂f =⇒ δ2 + dδ2 = δ2 ∂y 2 ∂y ∂y 3 ∂y c 1 =⇒ + d = 2 3 (162) An additional fourth order term provides 2 2 ∂f 1 ∂f ∂f = +f ∂y 24 ∂t ∂y 2 2 d ∂f 1 ∂f 1 δ1 = δ1 =⇒ d = 2 ∂y 12 ∂y 6 d δ1 2 (163) Continuing with another fourth order term c ∂ 2f ∂f ∂f ∂ 2 f ∂ 2f 3 (2f δ1 ) 2 + df δ1 2 = f +f 8 ∂y ∂y 4! ∂t ∂y ∂y 2 c 1 c 1 ∂ 2f ∂ 2f ∂ 2f f δ1 2 + df δ1 2 = f δ1 2 =⇒ + d = 4 ∂y ∂y 4 ∂y 4 4 (164) The final fourth order term presents as 3 ∂f ∂f ∂ 2 f ∂ 2f c ∂ 2f δ1 + dδ1 = +f 4 ∂t∂y ∂t∂y 4! ∂t ∂y ∂t∂y 2 2 2 1 ∂ f c 1 c ∂ f ∂ f δ1 + dδ1 = δ1 =⇒ + d = 4 ∂t∂y ∂t∂y 4 ∂t∂y 4 4 (165) As is evident, the last two relations render the same equation for coefficients c and d. A non-zero divisor has of course been assumed in the simplification step. From the equations above, d is known, so (164) can be used to compute c. Equation (158) may then be used to calculate b. The final coefficient a can then be computed by using (157). These coefficients are listed below. 1 1 1 (166) a= ; b=c= ; d= 6 3 6 These values satisfy all of the coefficient relations derived above. That particular demonstration is left as an exercise for the reader. This fourth order Runge-Kutta scheme may be written as 1 1 1 1 n+1 n y =y +h f1 + f2 + f3 + f4 + O(h5 ) (167) 6 3 3 6 It is only for the true mathematical toilers among us that such derivations are fun, but the Runge-Kutta idea of comparing the two different Taylor series expressions for y is very instructive and powerful giving rise to this potent family of ODE integration schemes. 42 References [1] Derrick, W.R. and Grossman, S.I., Elementary Differential Equations with Applications, Addison-Wesley, Reading, Massachusetts, 1976. [2] Kuethe, A.M. and Chow, C-Y., Foundations of Aerodynamics, Bases of Aerodynamic Design, 4th Ed., John Wiley & Sons, New York, New York, 1986. [3] Thomas, G.B., Jr. and Finney, R.L., Calculus and Analytic Geometry, 5th Ed., AddisonWesley, Reading, Massachusetts, 1979. [4] Rapaport, D.C., The Art of Molecular Dynamics Simulation, Cambridge University Press, Cambridge, United Kingdom, 1995. [5] Burden, R.L., Faires, J.D. and Reynolds, A.C., Numerical Analysis, 2nd Ed., Prindle, Weber & Schmidt, Boston, Massachusetts, 1981. [6] Allen, M.P. and Tildesley, D.J., Computer Simulation of Liquids, 2nd Ed., Oxford University Press, Oxford, United Kingdom, 2017. [7] Mitchell, A.R. and D.F. Griffiths, The Finite Difference Method in Partial Differential Equations, Wiley Interscience, New York, New York, 1980. [8] Stoer, J. and Bulirsch, R., Introduction to Numerical Analysis, Springer-Verlag, New York, New York, 1980. [9] Dahlquist, G. and Bjorck, Numerical Methods, Prentice-Hall, Englewood Cliffs, New Jersey, 1974. [10] Liu, L-H., Numerical Simulation of Space Plasmas, Appendix C, AP-4036, 2016. [11] Rowling, J.K., Harry Potter and the Chamber of Secrets, Bloomsbury, Canada, 1998. 43 View publication stats