140
8.2
Chapter 8
Numerical Solution of Ordinary Differential Equations
Taylor-Series Methods
2
2
2
2
2
1. f (t) = e−t = e−t P0 (t), f 0 (t) = e−t (−2t) = e−t P1 (t). Suppose f (n) (t) = e−t Pn (t). Then tak2
2
2
ing the derivative, we obtain f (n+1) (t) = e−t Pn0 (t) + e−t (−2t)Pn (t) = e−t [Pn0 (t) − 2tPn (t)] =
2
e−t Pn+1 (t). Here are the first few: P0 (t) = 1, P1 (t) = −2t, P2 (t) = −2 + 4t2 , P3 (t) = 12t − 8t3 ,
P4 (t) = 12 − 48t2 + 16t4 , P5 = −120t + 160t3 − 32t5 .
2. No matter what step size is used, x(t + h) = 0 via Euler’s method. This problem is due to the
non-uniqueness of the solution — both x(t) = 0 and x(t) = t2 /4. If the second-order Taylor-series
method is used, the non-trivial solution will be obtained.
3. x(0.1) = 1.98
4. x(0.01) = 1.02035 56666̄
5. x(4.1) = 1.0049125
6. x0 (t) = et + cos(t + x(t)), x(0) = 1
7. x0 = cos(tx), x00 = − sin(tx)(x + tx0 ), x000 = − cos(tx)(x + tx0 )2 − sin(tx)(2x0 + tx00 ),
x(4) = sin(tx)(x + tx0 )3 − 3 cos(tx)(x + tx0 )(2x0 + tx00 ) − sin(tx)(3x00 + tx000 ).
8. x0 = f . So x00 = ft + fx x0 = ft + f fx = Df where D =
∂
∂t
∂
+ f ∂x
.
x000 = ftt + ft fx + f fxt + ftx f + fx2 f + f 2 fxx = (ftt + 2f fxt + f 2 fxx ) + fx (ft + f fx ) = D2 f + fx Df
∂2
∂2
2 ∂2
where D2 = ∂t
2 + 2f ∂x∂t + f ∂x2 .
x(4) = fttt + 2ft fxt + 2f fxtt + 2f ft fxx + f 2 fxxt + fxt (ft + f fx ) +fx (ftt + ft fx + f fxt ) + fttx f + 2fx f fxt +
2f fxtx f + 2f fx f fxx + f 2 fxxx f +fxx f (ft + f fx ) + fx (ftx f + fx f fx + f fxx f ) = (fttt + 3f fxtt + 3f 2 ftxx +
f 3 fxxx ) + fx (ftt + 2f fxt + f 2 fxx ) + fx2 (ft + f fx ) +2ftx (ft + f fx ) + 2f fxx (ft + f fx ) + f fxx (ft + f fx ) +
fxt (ft + f fx ) = D3 f + fx D2 f + (fx2 + 3fxt + 3f fxx )Df = D3 f + fx D2 f + 3Dfx Df + fx2 Df .
8.2
Computer Problems
3. Computed value: x(2) = 0.88208 14664 (using step-size 0.01)
From table-book: x(2) = 0.88208 13907.
4. x(2) = 0.88208 13900
True solution x = tan t so x(1.56) = 92.6. Note that π/2 ≈ 1.57 and x(π/2) = ∞.
5. x(1.56) = 0.22399036 × 106 . Value too large—can’t integrate back successfully!
6. x0 = (t + x)/(t − x), x00 = [1 + (x0 )2 ]/(t − x), x000 = x00 [−1 + 3x0 ]/(t − x). A sudden jump from
x(1.54) = 1.44671 to x(1.55) = 3.27735 and an even larger one from x(1.92) = 1.84666 to x(1.93) =
10.18824 lead to x(2) = 10.08436, which is therefore in error. Lets assume x(1.54) = 1.44671. What
.
is x(1.55)? We have x(t + h) = x(t) + hx0 (t) + (h2 /2)x00 (t) + (h3 /6)x000 (t)
.
= x(t) + h[(t + x)/(t − x)] + (h2 /2)[(1 + x0 )/(t − x)] + (h3 /6)[x00 (3x0 − 1)/(t − x)].
Now x0 (t) = (t + x)/(t − x) = (1.54 + 1.44671)/(1.54 − 1.44671) = 32.01532. Very big! So x is
increasing rapidly, and soon crosses t. So t − x = ∞ between t = 1.54 and 1.55. The solution to the
ODE has a pole between 1.54 and 1.55.
7. x0 = sin t2 , x00 = 2t cos t2 , x000 = −4t2 sin t2 + 2 cos t2 , x(4) = −8t3 cos t2 − 12t sin t2 ,
x(5) = (16t4 − 12) sin t2 − 48t2 cos t2 .
8.3
Runge-Kutta Methods
141
8. Define f (t) = sin t2 . Then f (n) (t) = Pn (t) sin t2 + Qn (t) cos t2 with P0 (t) = 1, Q0 (t) = 0. So
f (n+1) (t) = Pn0 (t) sin t2 + Pn (t)2t cos t2 + Q0n (t) cos t2 − Qn (t)2t sin t2 = [Pn0 (t) − 2tQn (t)] sin t2 +
[Q0n (t) + 2tPn (t)] cos t2 . Hence Pn+1 (t) = Pn0 (t) − 2tQn (t) and Qn+1 (t) = Q0n (t) + 2tPn (t).
9. x0 = (1 − k sin2 t)1/2 , x00 = −(k/2)(1 − k 2 sin2 t)−1/2 (sin 2t).
10. x0 = −(3t2 x + x2 )(2t3 + 3tx)−1 ,
x00 = (3t2 x + x2 )(2t3 + 3tx)−2 (6t2 + 3x + 3tx0 ) − (6tx + 3t2 x0 + 2xx0 )(2t3 + 3tx)−1 .
As t → 0, the accuracy of the computed solution deteriorates.
Verify: t3 x2 + tx3 + 4 = 0 ⇒ 3t2 x2 + 2t3 xx0 + x3 + 3tx2 x0 = 0 ⇒ x0 = −[(3t2 + x)x]/[(2t2 + 3x)t].
12. f 0 (x) = (1 + x3 )1/2 , f 00 (x) = 32 x2 (1 + x3 )−1/2 = 32 x2 (f 0 )−1 , f 000 (x) = 3x(f 0 )−1 − 32 x2 (f 0 )−2 f 00 .
13. By taking derivatives, we have x0 = 1 − xt−1 , x00 = (1 − 2x0 )t−1 , x000 = −3x00 t−1 , x(4) = −4x000 t−1 .
Assume x(n) = −nx(n−1) t−1 . Then x(n+1) = −nx(n) t−1 + nx(n−1) t−2 = −nx(n) t−1 − x(n) t−1 =
−(n + 1)x(n) t−1 . Note true solution x = 12 t + t−1 .
16. x00 = et − (1 + x0 (t)) sin(t + x(t)), x000 = et − (1 + x0 )2 cos(t + x) − x00 sin(t + x).
√
20. Use quadratic formula to get x0 : x0 = t ± t2 + x cos t. There are two problems
√
(I): x0 = t + t2 + x cos t, x(0) = 0, and
√
(II): x0 = t − t2 + x cos t, x(0) = 0.
At t = 0, x0 = 0 in both problems. Notice that x(t) ≡ 0 solves the original problem. Now x(t) ≡ 0 is
the solution of (II). But in (I), as t increases, x0 becomes positive, so there is a nontrivial solution of
(I).
8.3
Runge-Kutta Methods
1. x(t + h) = x + (1/4)hf + (3/4)hf (t + (2/3)h, x + (2/3)hf ).
2. f (x, t) = (3 − x)/(2t + x).
3. If f (x, t) = f (t) then the Runge-Kutta method is x(t+h) = x(t)+(h/6)[f (t)+4f (t+(h/2))+f (t+h)].
R t+h
This is equivalent to Simpson’s rule since x(t + h) − x(t) = t f (s) ds.
Note: Error is O(h5 ).
4. Euler’s method, (I): x(t + h) = x(t) + hf (t, x(t)) + (h2 /2)x00 (ξ). Taking two steps of size h/2:
x(t + h/2) = x(t) + (h/2)f (t, x(t)) + (h2 /8)x00 (ξ) and
x(t + h) = x(t + h/2) + (h/2)f (t + h/2, x(t + h/2)) + (h2 /8)x00 (ξ)
⇒ (II): x(t + h) = x(t) + (h/2)[f (t, x(t)) + f (t + h/2, x(t + h/2))] + (h2 /4)x00 (ξ). Combining 2(II)−(I),
we have x(t + h) = x(t) + h[f (t + h/2, x(t + h/2))] which is the desired results using x(t + h/2) =
x(t) + (h/2)f (t, x(t)).
5. From the Taylor expansion and using the solution to Problem 8.2.8: x(t + h) = x + hf + (h2 /2)(ft +
f fx )+(h3 /3!) [ftt +ftx f +(ft +fx f )fx +f (fxt +fxx f )]+O(h4 ), where all the functions are evaluated at
(t, x(t)). We want x(t+h) = x+w1 F1 +w2 F2 +w3 F3 where F1 = hf (t, x), F2 = hf (t+α1 h, x+β1 hF1 ),
F3 = hf (t + α2 h, x + β2 hF2 ). We obtain the equations w1 + w2 + w3 = 1, w2 α1 + w3 α2 = 1/2,
w2 β1 + w3 β2 = 1/2, (w1 α12 /2) + (w3 α22 /2) = 1/6, (w2 β12 /2) + β2 w3 = 1/6, w2 β2 α1 = 1/6, w2 α1 β1 =
1/6, w3 β1 β2 = 1/6, w3 β1 α1 = 1/6. Solving, this yields w1 = 2/9, w2 = 3/9, w3 = 4/9, α1 = 1/2,
α2 = 3/4, β1 = 1/2, β2 = 3/4. For the equation x0 = x + t, we have x00 = x000 = x + t + 1 and the
Runge-Kutta method gives x(t + h) = x + h(x + t) + (h2 /2)(1 + x + t) + (h3 /6)(1 + x + t). The Taylor
series method yields the same result.
142
Chapter 8
Numerical Solution of Ordinary Differential Equations
6. Using f (t, x) = λx in Eq. (8), we have F1 = hλx, F2 = hλx + (h2 /2)λ2 x, F3 = hλx + (h2 /2)λ2 x +
(h3 /4)λ3 x, and F4 = hλx + h2 λ2 x + (h3 /2)λ3 x + (h4 /4)λ4 x. Substituting, we obtain x(t + h) =
x + hλx + (h2 /2)λ2 x + (h3 /3)λ3 x + (h4 /24)λ4 x.
P
k
(k)
(k)
k
7. In the Taylor series x(t + h) = ∞
k=0 (h /k!)x (t), we substitute x (t) = λ x(t). Obviously, the
local truncation error is (h5 /5!)λ5 x(ξ) = O(h5 ).
8.3
Computer Problems
1. Analytic solution: x = 3/ cosh2 (t/2). Numerical solution: x(−2) = 1.25992.
2. Solution is x(t) = sin t, obviously for all λ. This is an example of a general scheme: x0 = λx+f 0 −λf ,
x(0) = f (0) whose solution is x(t) = f (t). For large negative λ, this is a stiff equation.
7. The set {z ∈ C : |R(z)| ≤ 1} is the stability domain for the Runge-Kutta method of order p with the
stability function R(x) = 1 + z + z 2 /2! + z 3 /3! + z 4 /4! + · · · + z p /p!. Here x0 = −kx, x(0) = 1,
and z = −kh. In this problem, we are assuming that both h and k are real. For Euler’s method,
R(z) = 1 + z and |1 − kh| ≤ 1 implies 0 ≤ kh ≤ 2. For any fourth-order Runge-Kutta method,
R(z) = 1 + z + z 2 /2 + z 3 /6 + z 4 /24 and |1 − kh + (kh)2 /2 − (kh)3 /6 + (kh)4 /24| ≤ 1 implies
0 ≤ kh < 2.7852935. In the complex plane, the stability domains are shown in Hairer and Wanner
[1980, pp. 17–18].
8.4
Multi-Step Methods
1. From the k-order formula given in the text, Adams-Moulton 1 step would be a1 xn −a0 xn−1 = h[b1 fn +
b0 fn−1R]. It is an implicit method so a1 = 1 and a0 = 1. Therefore, xn = xn−1 + h[b1 fn + b0 fn−1 ].
tn
Want tn−1
f (t, x(t)) dt ≈ h[b1 fn + b0 fn−1 ]. It should be correct when f (t, x(t)) is a first degree
polynomial.
This forces b1 = b0 = 1/2 and gives the trapezoid rule. In detail, WLOG consider
R0
−1 p(t) dt = Ap(−1) + Bp(0). Using p0 (t) = 1, we obtain 1 = A + B and p1 (t) = t gives 1/2 = A.
Hence, A = B = 1/2. So xn+1 = xn + (h/2)[fn+1 + fn ]. Obviously, this is equivalent to the trapezoid
rule for the integral.
2. Straightforward calculations.
3. RTake the basis {1, t, t(t + 1), t(t + 1)(t + 2), t(t + 1)(t + 2)(t + 3)} for Π4 and impose the formula
1
0 p dt ≈ Ap(1) + Bp(0) + Cp(−1) + Dp(−2) + Ep(−3) to be exact for p ∈ Π4 . This yields the
system of equations: A + B + C + D + E = 1, A − C − 2D − 3E = 1/2; 2A + 2D + 6E = 5/6,
6A − 6E = 9/4, 24A = 251/30. By back substitution, we obtain A = 251/720, B = 646/720,
C = −264/720, D = 106/720, E = −19/720.
4. With the same procedure as used in Problem 8.4.3 and the basis {1, t, t(t + 1), t(t + 1)(t + 2)} for
Π3 , we obtain the system of equations. A + B + C + D = 1, −B − 2C − 3D = 1/2, 2C + 6D = 5/6,
−6D = 9/4. Back substitution yields: A = 55/24, B = −59/24, C = 37/24, D = −9/24.
R1
5. As in Problem 8.4.4, we consider 0 p(t) dt = Ap(1)+Bp(0)+Cp(−1)+Dp(−2) and basis {1, t−1, (t−
1)t, (t−1)t(t+1)} for Π3 . We obtain the system of equations 1 = A+B +C +D, 1/2 = −B −2C −3D,
−1/6 = 2C + 6D, −1/4 = −6D. By back substitution, the solution is D = 1/24, C = −5/24,
B = 19/24, A = 9/24.
© Copyright 2025 Paperzz