We now discuss the numerical approximation of solutions of systems of differential equations. Our goal is to apply the methods of Sections 2.4 through 2.6 to the initial value problem
for a system of m first-order differential equations. In (1) the independent variable is the scalar t, and
are vector-valued functions. If the component functions of f
Beginning with step size h, we want to approximate the values of x(t)
to the actual values
of the exact solution of the system in (1). We can then make the step from xn
For example, the iterative formula of Euler’s method for systems is
To examine the case m=2
Then the initial value problem in (1) is
and the scalar components of the vector formula in (2) are
Note that each iterative formula in (4) has the form of a single Euler iteration, but with yn
The improved Euler method for systems consists at each step of calculating first the predictor
and then the corrector
For the case of the two-dimensional initial value problem in (3), the scalar components of the formulas in (5) and (6) are
and
Consider the initial value problem
The exact solution of the system in (9) is
Here we have f(x, y)=3x−2y
With step size h=0.1
and
The actual values at t2=0.2
To compute the improved Euler approximations to x(0.2) and y(0.2) with a single step of size h=0.2
Then the corrector formulas in (8) yield
As we would expect, a single improved Euler step gives better accuracy than two ordinary Euler steps.
The vector version of the iterative formula for the Runge–Kutta method is
where the vectors k1, k2, k3
To describe in scalar notation the Runge–Kutta method for the two-dimensional initial value problem
let us write
Then the Runge–Kutta iterative formulas for the step from (xn,yn)
where the values F1, F2, F3
G1, G2, G3,
Perhaps the most common application of the two-dimensional Runge–Kutta method is to the numerical solution of second-order initial value problems of the form
If we introduce the auxiliary variable y=x′,
This is a problem of the form in (3) with f(t,x,y)=y.
If the functions f and g are not too complicated, then it is feasible to carry out manually a reasonable number of steps of the two-dimensional Runge–Kutta method described here. But the first operating electronic computers were constructed (during World War II) specifcally to implement methods similar to the Runge–Kutta method for the numerical computation of trajectories of artillery projectiles. The application material for this section lists TI-Nspire CX CAS and Python versions of Program RK2DIM that can be used with two-dimensional systems.
The exact solution of the initial value problem
is x(t)=sint.
which has the form in (3) with f(t,x,y)=y
Runge–Kutta values (with h=0.05
t | x=sint |
y=cost |
---|---|---|
0.5 | +0.47943 |
+0.87758 |
1.0 | +0.84147 |
+0.54030 |
1.5 | +0.99749 |
+0.07074 |
2.0 | +0.90930 |
−0.41615 |
2.5 | +0.59847 |
−0.80114 |
3.0 | +0.14112 |
−0.98999 |
3.5 | −0.35078 |
−0.93646 |
4.0 | −0.75680 |
−0.65364 |
4.5 | −0.97753 |
−0.21080 |
5.0 | −0.95892 |
+0.28366 |
Lunar lander In Example 4 of Section 2.3 we considered a lunar lander that initially is falling freely toward the surface of the moon. Its retrorockets, when fired, provide a deceleration of T=4m/s2.
Now we want to compute the descent time of the lunar lander. Let the distance x(t) of the lander from the center of the moon be measured in meters and measure time t in seconds. According to the analysis in Section 2.3 (where we used r(t) in stead of x(t)), x(t) satisfes the initial value problem
where G≈6.6726×10−11 N⋅(m/kg)2
The problem in (19) is equivalent to the first-order system
The table in Fig. 7.7.2 shows the result of a Runge–Kutta approximation with step size h=1
The lander’s descent to the lunar surface.
t(s) | x(m) | v(m/s) |
---|---|---|
0 | 1,781,870 | −450.00 |
20 | 1,773,360 | −401.04 |
40 | 1,765,826 | −352.37 |
60 | 1,759,264 | −303.95 |
80 | 1,753,667 | −255.74 |
100 | 1,749,033 | −207.73 |
120 | 1,745,357 | −159.86 |
140 | 1,742,637 | −112.11 |
160 | 1,740,872 | −64.45 |
180 | 1,740,059 | −16.83 |
200 | 1,740,199 | 30.77 |
Focusing on the lunar lander’s soft touchdown.
t(s) | x(m) | v(m/s) |
---|---|---|
180 | 1,740,059 | −16.83 |
181 | 1,740,044 | −14.45 |
182 | 1,740,030 | −12.07 |
183 | 1,740,019 | −9.69 |
184 | 1,740,011 | −7.31 |
185 | 1,740,005 | −4.93 |
186 | 1,740,001 | −2.55 |
187 | 1,740,000 | −0.17 |
188 | 1,740,001 | 2.21 |
189 | 1,740,004 | 4.59 |
190 | 1,740,010 | 6.97 |
As we saw in Section 7.1, any system of higher-order differential equations can be replaced with an equivalent system of first-order differential equations. For example, consider the system
of second-order equations. If we substitute
then we get the equivalent system
of four first-order equations in the unknown functions x1(t)=x(t), x2(t)=y(t), x3(t), and x4(t).rkn
that closely resembles the one-dimensional program rk
of Fig.2.6.11.
Batted baseball Suppose that a batted ball starts at x0=0, y0=0
According to Problem 30 of Section 7.1, the equations of motion of the baseball are
where v=√(x′)2+(y′)2
of four first-order differential equations with
Note that x3(t) and x4(t)
Without Air Resistance: Figure 7.7.4 shows the numerical results obtained when a Runge–Kutta program such as rkn
is applied with step size h=0.1
The batted baseball with no air resistance (c=0)
t | x | y | v | α |
---|---|---|---|---|
0.0 | 0.00 | 0.00 | 160.00 | +30 |
0.5 | 69.28 | 36.00 | 152.63 | +25 |
1.0 | 138.56 | 64.00 | 146.64 | +19 |
1.5 | 207.85 | 84.00 | 142.21 | +13 |
2.0 | 277.13 | 96.00 | 139.48 | +7 |
2.5 | 346.41 | 100.00 | 138.56 | +0 |
3.0 | 415.69 | 96.00 | 139.48 | −7 |
3.5 | 484.97 | 84.00 | 142.21 | −13 |
4.0 | 554.26 | 64.00 | 146.64 | −19 |
4.5 | 623.54 | 36.00 | 152.63 | −25 |
5.0 | 692.82 | 0.00 | 160.00 | −30 |
The batted baseball with air resistance (c=0.0025)
t | x | y | v | α |
---|---|---|---|---|
0.0 | 0.00 | 0.00 | 160.00 | +30 |
0.5 | 63.25 | 32.74 | 127.18 | +24 |
1.0 | 117.11 | 53.20 | 104.86 | +17 |
1.5 | 164.32 | 63.60 | 89.72 | +8 |
2.0 | 206.48 | 65.30 | 80.17 | −3 |
2.5 | 244.61 | 59.22 | 75.22 | −15 |
3.0 | 279.29 | 46.05 | 73.99 | −27 |
3.5 | 310.91 | 26.41 | 75.47 | −37 |
4.0 | 339.67 | 0.91 | 78.66 | −46 |
The batted ball’s apex and its impact with the ground.
t | x | y | v | α |
|
---|---|---|---|---|---|
1.5 | 164.32 | 63.60 | 89.72 | +8 |
|
1.6 | 173.11 | 64.60 | 87.40 | +5 |
|
1.7 | 181.72 | 65.26 | 85.29 | +3 |
|
1.8 | 190.15 | 65.60 | 83.39 | +1 |
← Apex |
1.9 | 198.40 | 65.61 | 81.68 | −1 |
|
2.0 | 206.48 | 65.30 | 80.17 | −3 |
|
⋮ |
⋮ |
⋮ |
⋮ |
⋮ |
|
3.8 | 328.50 | 11.77 | 77.24 | −42 |
|
3.9 | 334.14 | 6.45 | 77.93 | −44 |
|
4.0 | 339.67 | 0.91 | 78.66 | −46 |
← Impact |
4.1 | 345.10 | −4.84 |
79.43 | −47 |
|
4.2 | 350.41 | −10.79 |
80.22 | −49 |
With Air Resistance: Figure 7.7.5 shows the results obtained with the fairly realistic value of c=0.0025
An “easy out” or a home run?
The Runge–Kutta method for a large system requires an appreciable amount of computational labor, even when a computer is employed. Therefore, just as the step size h should not be so large that the resulting error in the solution is unacceptable, h ought not to be so small that too many steps are needed, hence requiring an unacceptable amount of computation. Thus the practical numerical solution of differential equations involves a tradeoff between accuracy and efficiency.
To facilitate this tradeoff, modern variable step size methods vary the step size h as the solution process proceeds. Large steps are taken in regions where the dependent variables are changing slowly; smaller steps are taken when these variables are changing rapidly, in order to prevent large errors.
An adaptable or variable step size Runge–Kutta method employs both a pre-assigned minimum error tolerance MinTol and a maximum error tolerance MaxTol to attempt to ensure that the error made in the typical step from xn to xn+1
Having reached xn
On the grounds that x(2)
as an estimate of the error in x(1).
If MinTol≦Err≦MaxTol, then let xn+1=x(1), tn+1=tn+h,
If Err<MaxTol,
If Err>MaxTol,
The detailed implementation of such a scheme can be complicated. For a much more complete but readable discussion of adaptive Runge–Kutta methods, see Section 17.2 of William H. Press et al., Numerical Recipes: The Art of Scientific Computing (Cambridge: Cambridge: University Press, 2007).
Several widely available scientific computing packages (such as Maple, Mathematica, and Matlab) include sophisticated variable step size programs that will accommodate an essentially arbitrary number of simultaneous differential equations. Such a general-purpose program might be used, for example, to model numerically the major components of the solar system:the sun and the nine (known) major planets. If mi
where rij=|rj−ri|
For an example of a program whose efficient solution requires adaptive step size methods, we consider an Apollo satellite in orbit about the Earth E and Moon M. Figure 7.7.8 shows an x1x2
The Earth–Moon center-of-mass coordinate system.
where rE
Suppose that the satellite initially is in a clockwise circular orbit of radius about 2400 kilometers about the Moon. At its farthest point from the Earth (x1=0.994)
An adaptive step size method (ode45
) in the Matlab software system was used to solve numerically the system in (27). The orbits in Figs. 7.7.9 and 7.7.10 were obtained with
Apollo Moon–Earth bus orbit with insertion velocity v0=7476 km/h
Apollo Moon–Earth bus orbit with insertion velocity v0=7365 km/h
respectively. [In the system of units used here, the unit of velocity is approximately 3680 km/h.] In each case a closed but multilooped periodic trajectory about the Earth and the Moon—a so-called bus orbit—is obtained, but a relatively small change in the initial velocity changes the number of loops! For more information, see NASA Contractor Report CR-61139, “Study of the Methods for the Numerical Solution of Ordinary Differential Equations,” prepared by O. B. Francis, Jr. et al. for the NASA–George C. Marshall Space Flight Center, June 7, 1966.
So-called Moon–Earth “bus orbits” are periodic—that is, are closed trajectories traversed repeatedly by the satellite—only in a rotating x1x2
The moon and satellite in a nonrotating coordinate system, 1.5 days after orbital insertion of the satellite at starting point S.
The moon and satellite in a nonrotating coordinate system, 1.5 days before their rendezvous at point R.
A hand-held calculator will suffice for Problems 1 through 8. In each problem an initial value problem and its exact solution are given. Approximate the values of x(0.2) and y(0.2) in three ways: (a) by the Euler method with two steps of size h=0.1
x′=x+2y, x(0)=0,y′=2x+y, y(0)=2;x(t)=e3t−e−t, y(t)=e3t+e−t
x′=2x+3y, x(0)=1,y′=2x+y, y(0)=−1;x(t)=e−t, y(t)=−e−t
x′=3x+4y, x(0)=1,y′=3x+2y, y(0)=1;x(t)=17(8e6t−e−t), y(t)=17(6e6t+e−t)
x′=9x+5y, x(0)=1,y′=−6x−2y, y(0)=0;x(t)=−5e3t+6e4t, y(t)=6e3t−6e4t
x′=2x−5y, x(0)=2,y′=4x−2y, y(0)=3;x(t)=2cos4t−114 sin 4t, y(t)=3 cos 4t+12 sin 4t
x′=x−2y, x(0)=0,y′=2x+y, y(0)=4;x(t)=−4et sin 2t, y(t)=4et cos 2t
x′=3x−y, x(0)=2,y′=x+y, y(0)=1;x(t)=(t+2)e2t, y(t)=(t+1)e2t
x′=5x−9y, x(0)=0,y′=2x−y, y(0)=−1;x(t)=3e2t sin 3t, y(t)=e2t(sin 3t−cos 3t)
A computer will be required for the remaining problems in this section. In Problems 9 through 12, an initial value problem and its exact solution are given. In each of these four problems, use the Runge–Kutta method with step sizes h=0.1
x′=2x−y,x(0)=1,y′=x+2y,y(0)=0;x(t)=e2t cos t,y(t)=e2t sin t
x′=x+2y,x(0)=0,y′=x+e−t,y(0)=0;x(t)=19(2e2t−2e−t+6te−t),y(t)=19(e2t−e−t+6te−t)
x′=−x+y−(1+t3)e−t,x(0)=0,y′=−x−y−(t−3t2)e−t,y(0)=1;x(t)=e−t(sin t−t),y(t)=e−t(cos t+t3)
x″+x=sin t,x(0)=0;x(t)=12(sin t−t cos t)
Crossbow bolt Suppose that a crossbow bolt is shot straight upward with initial velocity 288 ft/s. If its deceleration due to air resistance is (0.04)v, then its height x(t) satisfies the initial value problem
Find the maximum height that the bolt attains and the time required for it to reach this height.
Repeat Problem 13, but assume instead that the deceleration of the bolt due to air resistance is (0.0002)v2.
Height of projectile Suppose that a projectile is fired straight upward with initial velocity v0 from the surface of the earth. If air resistance is not a factor, then its height x(t) at time t satisfies the initial value problem
Use the values g=32.15 ft/s2 ≈ 0.006089 mi/s2 for the gravitational acceleration of the earth at its surface and R=3960 mi as the radius of the earth. If v0=1 mi/s, find the maximum height attained by the projectile and its time of ascent to this height.
Problems 16 through 18 deal with the batted baseball of Example 4, having initial velocity 160 ft/s and air resistance coefficient c=0.0025.
Find the range—the horizontal distance the ball travels before it hits the ground—and its total time of flight with initial inclination angles 40∘, 45∘, and 50∘.
Find (to the nearest degree) the initial inclination that maximizes the range. If there were no air resistance it would be exactly 45∘, but your answer should be less than 45∘.
Find (to the nearest half degree) the initial inclination angle greater than 45∘ for which the range is 300 ft.
Home run Home run Find the initial velocity of a baseball hit by Babe Ruth (with c=0.0025 and initial inclination 40∘) if it hit the bleachers at a point 50 ft high and 500 horizontal feet from home plate.
Crossbow bolt Crossbow bolt Consider the crossbow bolt of Problem 14, fired with the same initial velocity of 288 ft/s and with the air resistance deceleration (0.0002)v2 directed opposite its direction of motion. Suppose that this bolt is fired from ground level at an initial angle of 45∘. Find how high vertically and how far horizontally it goes, and how long it remains in the air.
Artillery projectile Artillery projectile Suppose that an artillery projectile is fired from ground level with initial velocity 3000 ft/s and initial inclination angle 40∘. Assume that its air resistance deceleration is (0.0001)v2. (a) What is the range of the projectile and what is its total time of flight? What is its speed at impact with the ground? (b) What is the maximum altitude of the projectile, and when is that altitude attained? (c) You will find that the projectile is still losing speed at the apex of its trajectory. What is the minimum speed that it attains during its descent?
3.15.239.140