Tut7_Sol

pdf

School

The Chinese University of Hong Kong *

*We aren’t endorsed by this school

Course

3240

Subject

Mathematics

Date

Nov 24, 2024

Type

pdf

Pages

5

Uploaded by MinisterGorilla8297

Report
MATH3240 Numerical Methods for Differential Equations Tutorial 7 (Mar. 23, 2023) 1 Recall: Most ordinary differential equations of higher order can be converted to a system of first-order ODEs. Consider the following system of first-order ODEs x 0 1 ( t ) = f 1 ( t, x 1 , x 2 , . . . , x n ) , x 0 2 ( t ) = f 2 ( t, x 1 , x 2 , . . . , x n ) , . . . x 0 n ( t ) = f n ( t, x 1 , x 2 , . . . , x n ) , (1) with initial conditions x 1 ( t 0 ) = x 10 , x 2 ( t 0 ) = x 20 , . . . , x n ( t 0 ) = x n 0 . 1. Taylor-series methods. Choose a step size h , consider the following discrete points: t 0 < t 1 < t 2 < · · · < t m < . . . , t k = t 0 + kh, k = 1 , 2 , 3 . . . , Suppose x i ( t k ) is known. By Taylor expansion, we have x i ( t k +1 ) = x i ( t k + h ) = x i ( t k ) + hx 0 i ( t k ) + · · · + h m m ! x ( m ) i ( t k ) + O ( h m +1 ) , so computing x i ( t k + h ) needs x i ( t k ) , x 0 i ( t k ) , x 00 i ( t k ) , . . . which can be obtained from (1). 2. Autonomous ODEs. If we introduce a new variable x 0 ( t ) = t , (1) becomes X 0 ( t ) = F ( X ) with X = x 0 ( t ) x 1 ( t ) . . . x n ( t ) , F ( X ) = f 0 ( X ) f 1 ( X ) . . . f n ( X ) . (2) This system of ODEs is called an autonomous system of ODEs, where t does not appear explicitly in the right- hand side function F ( X ) . 3. Analytical solutions of systems of first-order ODEs. We first discuss some properties about the solutions to the following homogeneous case of ODEs X 0 ( t ) = AX ( t ) . Theorem 1. If λ is an eigenvalue of the matrix A and V is a corresponding eigenvector, then X ( t ) = e λt V is a solution to the ODE X 0 ( t ) = AX ( t ) . Theorem 2. If the n × n matrix A has n linearly independent eigenvectors V 1 , V 2 , . . . , V n corresponding to the n eigenvalues λ 1 , λ 2 , . . . , λ n then the space the space span { X 1 ( t ) , X 2 ( t ) , . . . , X n ( t ) } with X i ( t ) = e λ i t V i , contains all the solutions of the ODE system X 0 ( t ) = AX ( t ) . 1
2 Exercises: Please do star questions during the tutorial and finish the remaining after class. 1. The following implicit one-step method x n +1 = x n + h 2 ( f n +1 + f n ) is used to approximate the solution of x 0 = f ( t, x ) with x ( t 0 ) = x 0 . Assume that the third derivative of the solution is uniformly bounded, that is, | x (3) | ≤ M , for some constant M . (a) Show that the local truncation error τ satisfies | τ | ≤ 5 Mh 2 12 . (b) Further assume x (3) ( t ) is Riemann integrable, show that the local truncation error τ satisfies | τ | ≤ Mh 2 12 . Hint: Use Taylor Theorem with integral remainder. (c) Further assume that | ∂f ∂x | ≤ L . Show that | x ( t 1 ) - x 1 | ≤ Mh 3 6 provided hL 1 . Hint: Repeat the proof of Theorem 2.1 in the lecture notes. Solution. We have the local truncation error in the following form τ n = h - 1 x ( t n +1 ) - x ( t n ) - h 2 ( x 0 ( t n +1 ) + x 0 ( t n ) ) . (a) By Taylor expansion, x ( t n +1 ) = x ( t n ) + hx 0 ( t n ) + h 2 2 x 00 ( t n ) + h 3 6 x (3) ( ξ 1 ) , x ( t n ) = x ( t n ) , x 0 ( t n +1 ) = x 0 ( t n ) + hx 00 ( t n ) + h 2 2 x (3) ( ξ 2 ) , x 0 ( t n ) = x 0 ( t n ) . Consequently, with the help of | x (3) ( t ) | ≤ M , | τ n | = h 2 6 x (3) ( ξ 1 ) - h 2 4 x (3) ( ξ 2 ) h 2 6 M + h 2 4 M = 5 h 2 12 M. (b) By Taylor Theorem with integral reminder, we have x ( t n +1 ) = x ( t n ) + hx 0 ( t n ) + h 2 2 x 00 ( t n ) + 1 2 t n +1 t n ( t n +1 - t ) 2 x (3) ( t ) dt, x ( t n ) = x ( t n ) , x 0 ( t n +1 ) = x 0 ( t n ) + hx 00 ( t n ) + t n +1 t n ( t n +1 - t ) x (3) ( t ) dt, x 0 ( t n ) = x 0 ( t n ) . Hence with the help of | x (3) ( t ) | ≤ M , | τ n | = 1 2 h t n +1 t n ( ( t n +1 - t ) 2 - h ( t n +1 - t ) ) x (3) ( t ) dt M 2 h t n +1 t n ( t - t n )( t n +1 - t ) dt = h 2 12 M. 2
(c) Firstly, we know by definition f n = f ( t n , x n ) , hence 0 = x 1 - x 0 - h 2 ( f 1 + f 0 ) . (3) Secondly, we have 1 = x ( t 1 ) - x ( t 0 ) - h 2 ( f ( t 1 , x ( t 1 )) + f ( t 0 , x ( t 0 )) ) . (4) Since x 0 = x ( t 0 ) and f 0 = f ( t 0 , x 0 ) = f ( t 0 , x ( t 0 )) , (4)-(3) gives 1 = x ( t 1 ) - x 1 - h 2 ( f ( t 1 , x ( t 1 )) + f ( t 1 , x 1 ) ) . By Mean Value Theorem, 1 = x ( t 1 ) - x 1 - h 2 ∂f ∂x ( t 1 , ξ ) ( x ( t 1 ) - x 1 ) . Hence, x ( t 1 ) - x 1 = 1 1 - h 2 ∂f ∂x ( t 1 , ξ ) . With the two assumptions | ∂f ∂x | ≤ L, hL 1 and results of (b), we have | x ( t 1 ) - x 1 | ≤ Mh 3 6 . 2. Consider the following initial-value problem: ( x 00 - t sin( x 0 ) + cos x = 25 , x (0) = 5 , x 0 (0) = 3 . (a) Convert the above IVP into an autonomous system of first order ODEs. (b) Write down the second order Taylor series method formula for the system derived in (a). (c) Try one iteration of Taylor series formula in (b) with step size h. Solution. (a) Let x 0 ( t ) = t , x 1 ( t ) = x ( t ) , and x 2 ( t ) = x 0 ( t ) . Then we have x 0 0 ( t ) = 1 , x 0 1 ( t ) = x 2 ( t ) , x 0 2 ( t ) = x 0 ( t ) sin( x 2 ( t )) - cos( x 1 ( t )) + 25 , with ( x 1 (0) = 5 , x 2 (0) = 3 . (b) The Taylor-series method of order 2 is as follows: x i ( t k +1 ) x i ( t k ) + hx 0 i ( t k ) + h 2 2 x 00 i ( t k ) , i = 0 , 1 , 2 . Using the formula in (a), we obtain x 0 0 ( t ) = 1 , x 00 0 ( t ) = 0 , x 0 1 ( t ) = x 2 ( t ) , x 00 1 ( t ) = x 0 2 ( t ) = x 0 ( t ) sin( x 2 ( t )) - cos( x 1 ( t )) + 25 , x 0 2 ( t ) = x 0 ( t ) sin( x 2 ( t )) - cos( x 1 ( t )) + 25 , x 00 2 ( t ) = sin( x 2 ( t )) + x 0 ( t ) cos( x 2 ( t )) + sin( x 1 ( t )) x 2 ( t ) . 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Then we have the following iterative formula: x 0 ,k +1 = x 0 ,k + h, x 1 ,k +1 = x 1 ,k + hx 2 ,k + h 2 2 ( x 0 ,k sin( x 2 ,k ) - cos( x 1 ,k ) + 25) , x 2 ,k +1 = x 2 ,k + h ( x 0 ,k sin( x 2 ,k ) - cos( x 1 ,k ) + 25) + h 2 2 (sin( x 2 ,k ) + x 0 ,k cos( x 2 ,k ) + sin( x 1 ,k ) x 2 ,k ) with initial value x 0 , 0 = 0 , x 1 , 0 = 5 , x 2 , 0 = 3 . (c) One iteration: x 0 , 1 = h x 1 , 1 = x 1 , 0 + hx 2 , 0 + h 2 2 ( x 0 , 0 sin( x 2 , 0 ) - cos( x 1 , 0 ) + 25) , = 5 + 3 h + h 2 2 (25 - cos(5)) . x 2 , 1 = x 2 , 0 + h ( x 0 , 0 sin( x 2 , 0 ) - cos( x 1 , 0 ) + 25) + h 2 2 (sin( x 2 , 0 ) + x 0 , 0 cos( x 2 , 0 ) + sin( x 1 , 0 ) x 2 , 0 ) = 3 + h (25 - cos(5)) + h 2 2 (sin(3) + 3 sin(5)) . 3. Consider the following two ODE systems X 0 ( t ) = A i X ( t ) + ω i ( t ) i = 1 , 2 with A 1 = - 1 0 - 6 0 1 0 0 0 2 ω 1 = sin t e - t 2 X 1 (0) = 1 4 7 ; A 2 = - 1 0 0 0 2 0 3 1 2 ω 2 = t 3 t 2 t X 2 (0) = 2 5 8 (a) Check whether the diagonalization approach works or not. (b) Solve the systems that the diagonalization approach works. Solution. (a) For the first ODE system A 1 = - 1 0 - 6 0 1 0 0 0 2 D 1 = - 1 0 0 0 1 0 0 0 2 P 1 = 1 0 2 0 1 0 0 0 - 1 We get eigenvalues λ 1 = - 1 , λ 2 = λ 3 = 2 and three eigenvectors V 1 = 1 0 0 V 2 = 0 1 0 V 3 = 2 0 - 1 Now we can transform the ODE system into a diagonal system by using the tranformation X ( t ) = P 1 Y ( t ) . The original equation becomes a diagonal Y 0 ( t ) = D 1 Y ( t ) = G ( t ) with initial value: y 1 (0) y 2 (0) y 3 (0) = Y (0) = P - 1 1 X (0) = 15 4 - 7 4
where G ( t ) = P - 1 1 ω 1 ( t ) = 4 + sin( t ) e - t - 2 Solving the diagonal system, we obtain y 1 ( t ) y 2 ( t ) y 3 ( t ) = 23 2 e - t + 4 + sin t - cos t 2 9 2 e t - 1 2 e - t - 8 e 2 t + 1 Finally, the original solution is x 1 ( t ) x 2 ( t ) x 3 ( t ) = X ( t ) = P 1 Y ( t ) = 23 2 e - t - 16 e 2 t + 6 + sin t - cos t 2 9 2 e t - 1 2 e - t 8 e 2 t - 1 (b) For the second ODE system A 2 = - 1 0 0 0 2 0 3 1 2 D 2 = - 1 0 0 0 2 1 0 0 2 P 2 = 1 0 0 0 0 1 - 1 1 0 We get eigenvalues λ 1 = - 1 , λ 2 = λ 3 = 2 and three eigenvectors W 1 = 1 - 3 0 W 2 = 0 0 1 W 3 = 0 0 0 Only two linearly independent eigenvectors exists, the diagonalization approach fails with this ODE system. 5