Chapter 5 – Initial-Value Problems for Ordinary Differential Equations Per-Olof Persson persson@berkeley.edu Department of Mathematics University of California, Berkeley Math 128A Numerical Analysis
Lipschitz Condition and Convexity Definition A function f ( t, y ) is said to satisfy a Lipschitz condition in the variable y on a set D ⊂ R 2 if a constant L > 0 exists with | f ( t, y 1 ) − f ( t, y 2 ) | ≤ L | y 1 − y 2 | , whenever ( t, y 1 ) , ( t, y 2 ) ∈ D . The constant L is called a Lipschitz constant for f . Definition A set D ⊂ R 2 is said to be convex if whenever ( t 1 , y 1 ) and ( t 2 , y 2 ) belong to D and λ is in [0 , 1] , the point ((1 − λ ) t 1 + λt 2 , (1 − λ ) y 1 + λy 2 ) also belongs to D .
Existence and Uniqueness Theorem Suppose f ( t, y ) is defined on a convex set D ⊂ R 2 . If a constant L > 0 exists with � � ∂f � � ∂y ( t, y ) � ≤ L, for all ( t, y ) ∈ D, � � � then f satisfies a Lipschitz condition on D in the variable y with Lipschitz constant L . Theorem Suppose that D = { ( t, y ) | a ≤ t ≤ b, −∞ < y < ∞} and that f ( t, y ) is continuous on D . If f satisfies a Lipschitz condition on D in the variable y , then the initial-value problem y ′ ( t ) = f ( t, y ) , a ≤ t ≤ b, y ( a ) = α, has a unique solution y ( t ) for a ≤ t ≤ b .
Well-Posedness Definition The initial-value problem dy dt = f ( t, y ) , a ≤ t ≤ b, y ( a ) = α, is said to be a well-posed problem if: A unique solution, y ( t ) , to the problem exists, and There exist constants ε 0 > 0 and k > 0 such that for any ε , with ε 0 > ε > 0 , whenever δ ( t ) is continuous with | δ ( t ) | < ε for all t in [ a, b ] , and when | δ 0 | < ε , the initial-value problem dz dt = f ( t, z ) + δ ( t ) , a ≤ t ≤ b, z ( a ) = α + δ 0 , has a unique solution z ( t ) that satisfies | z ( t ) − y ( t ) | < kε for all t in [ a, b ] .
Well-Posedness Theorem Suppose D = { ( t, y ) | a ≤ t ≤ b and − ∞ < y < ∞} . If f is continuous and satisfies a Lipschitz condition in the variable y on the set D , then the initial-value problem dy dt = f ( t, y ) , a ≤ t ≤ b, y ( a ) = α is well-posed.
Euler’s Method Suppose a well-posed initial-value problem is given: dy dt = f ( t, y ) , a ≤ t ≤ b, y ( a ) = α Distribute mesh points equally throughout [ a, b ] : t i = a + ih, for each i = 0 , 1 , 2 , . . . , N. The step size h = ( b − a ) /N = t i +1 − t i .
Euler’s Method Use Taylor’s Theorem for y ( t ) : y ( t i +1 ) = y ( t i ) + ( t i +1 − t i ) y ′ ( t i ) + ( t i +1 − t i ) 2 y ′′ ( ξ i ) 2 for ξ i ∈ ( t i , t i +1 ) . Since h = t i +1 − t i and y ′ ( t i ) = f ( t i , y ( t i )) , y ( t i +1 ) = y ( t i ) + hf ( t i , y ( t i )) + h 2 2 y ′′ ( ξ i ) . Neglecting the remainder term gives Euler’s method for w i ≈ y ( t i ) : w 0 = α w i +1 = w i + hf ( t i , w i ) , i = 0 , 1 , . . . , N − 1 The well-posedness implies that f ( t i , w i ) ≈ y ′ ( t i ) = f ( t i , y ( t i ))
Error Bound Theorem Suppose f is continuous and satisfies a Lipschitz condition with constant L on D = { ( t, y ) | a ≤ t ≤ b, −∞ < y < ∞} and that a constant M exists with | y ′′ ( t ) | ≤ M, for all t ∈ [ a, b ] . Let y ( t ) denote the unique solution to the initial-value problem y ′ = f ( t, y ) , a ≤ t ≤ b, y ( a ) = α, and w 0 , w 1 , . . . , w n as in Euler’s method. Then | y ( t i ) − w i | ≤ hM e L ( t i − a ) − 1 � � . 2 L
Local Truncation Error Definition The difference method w 0 = α w i +1 = w i + hφ ( t i , w i ) has local truncation error τ i +1 ( h ) = y i +1 − ( y i + hφ ( t i , y i )) = y i +1 − y i − φ ( t i , y i ) , h h for each i = 0 , 1 , . . . , N − 1 .
Higher-Order Taylor Methods Consider initial-value problem y ′ = f ( t, y ) , a ≤ t ≤ b, y ( a ) = α. Expand y ( t ) in n th Taylor polynomial about t i , evaluated at t i +1 : y ( t i +1 ) = y ( t i ) + hy ′ ( t i ) + h 2 2 y ′′ ( t i ) + · · · + h n h n +1 n ! y ( n ) ( t i ) + ( n + 1)! y ( n +1) ( ξ i ) = y ( t i ) + hf ( t i , y ( t i )) + h 2 2 f ′ ( t i , y ( t i )) + · · · h n +1 = h n n ! f ( n − 1) ( t i , y ( t i )) + ( n + 1)! f ( n ) ( ξ i , y ( ξ i )) for some ξ i ∈ ( t i , t i +1 ) . Delete remainder term to obtain the Taylor method of order n .
Higher-Order Taylor Methods Taylor Method of Order n w 0 = α w i +1 = w i + hT ( n ) ( t i , w i ) , i = 0 , 1 , . . . , N − 1 where 2 f ′ ( t i , w i ) + · · · + h ( n − 1) T ( n ) ( t i , w i ) = f ( t i , w i ) + h f ( n − 1) ( t i , w i ) n !
Higher-Order Taylor Methods Theorem If Taylor’s method of order n is used to approximate the solution to y ′ ( t ) = f ( t, y ( t )) , a ≤ t ≤ b, y ( a ) = α, with step size h and if y ∈ C n +1 [ a, b ] , then the local truncation error is O ( h n ) .
Taylor’s Theorem in Two Variables Theorem Suppose f ( t, y ) and partial derivatives up to order n + 1 continuous on D = { ( t, y ) | a ≤ t ≤ b, c ≤ y ≤ d } , let ( t 0 , y 0 ) ∈ D . For ( t, y ) ∈ D , there is ξ ∈ [ t, t 0 ] and µ ∈ [ y, y 0 ] with f ( t, y ) = P n ( t, y ) + R n ( t, y ) � ( t − t 0 ) ∂f ∂t ( t 0 , y 0 ) + ( y − y 0 ) ∂f � P n ( t, y ) = f ( t 0 , y 0 ) + ∂y ( t 0 , y 0 ) � ( t − t 0 ) 2 ∂ 2 f ∂t 2 ( t 0 , y 0 ) + ( t − t 0 )( y − y 0 ) ∂ 2 f + ∂t∂y ( t 0 , y 0 ) 2 + ( y − y 0 ) 2 ∂ 2 f � ∂y 2 ( t 0 , y 0 ) + · · · 2 n ∂ n f 1 � n � � ( t − t 0 ) n − j ( y − y 0 ) j + ∂t n − j ∂y j ( t 0 , y 0 ) n ! j j =0
Taylor’s Theorem in Two Variables Theorem (cont’d) n +1 1 � n + 1 � � ( t − t 0 ) n +1 − j ( y − y 0 ) j · R n ( t, y ) = ( n + 1)! j j =0 ∂ n +1 f · ∂t n +1 − j ∂y j ( ξ, µ ) P n ( t, y ) is the n th Taylor polynomial in two variables.
Runge-Kutta Methods Obtain high-order accuracy of Taylor methods without knowledges of derivatives of f Determine a 1 , α 1 , β 1 such that a 1 f ( t + α 1 , y + β 1 ) ≈ f ( t, y ) + h 2 f ′ ( t, y ) = T (2) ( t, y ) . with O ( h 2 ) error. Since f ′ ( t, y ) = d dt ( t, y ) = ∂f f ∂t ( t, y ) + ∂f ∂y ( t, y ) · y ′ ( t ) and y ′ ( t ) = f ( t, y ) , we have T (2) ( t, y ) = f ( t, y ) + h ∂f ∂t ( t, y ) + h ∂f ∂y ( t, y ) · f ( t, y ) 2 2
Runge-Kutta Methods Expand f ( t + α 1 , y + β 1 ) in 1st degree Taylor polynomial: ∂f a 1 f ( t + α 1 , y + β 1 ) = a 1 f ( t, y ) + a 1 α 1 ∂t ( t, y ) ∂f + a 1 β 1 ∂y ( t, y ) + a 1 · R 1 ( t + α 1 , y + β 1 ) Matching coefficients gives a 1 α 1 = h a 1 β 1 = h a 1 = 1 2 , 2 f ( t, y ) with unique solution α 1 = h β 1 = h a 1 = 1 , 2 , 2 f ( t, y )
Runge-Kutta Methods This gives � t + h 2 , y + h � � t + h 2 , y + h � T (2) ( t, y ) = f 2 f ( t, y ) − R 1 2 f ( t, y ) with R 1 ( · , · ) = O ( h 2 ) Midpoint Method w 0 = α, � t + h 2 , w i + h � w i +1 = w i + hf 2 f ( t i , w i ) , i = 0 , 1 , . . . , N − 1 Local truncation error of order two.
Runge-Kutta Methods Runge-Kutta Order Four w 0 = α k 1 = hf ( t i , w i ) � t i + h 2 , w i + 1 � k 2 = hf 2 k 1 � t i + h 2 , w i + 1 � k 3 = hf 2 k 2 k 4 = hf ( t i +1 , w i + k 3 ) w i +1 = w i + 1 6( k 1 + 2 k 2 + 2 k 3 + k 4 ) Local truncation error O ( h 4 )
Runge-Kutta Order Four MATLAB Implementation function [t, w] = rk4(f, a, b, alpha, N) % Solve ODE y'(t) = f(t, y(t)) using Runge − Kutta 4. h = (b − a) / N; t = (a:h:b)'; w = zeros(N+1, length(alpha)); w(1,:) = alpha(:)'; for i = 1:N k1 = h*f(t(i), w(i,:)); k2 = h*f(t(i) + h/2, w(i,:) + k1/2); k3 = h*f(t(i) + h/2, w(i,:) + k2/2); k4 = h*f(t(i) + h, w(i,:) + k3); w(i+1,:) = w(i,:) + (k1 + 2*k2 + 2*k3 + k4)/6; end
Multistep Methods Definition An m -step multistep method for solving the initial-value problem y ′ = f ( t, y ) , a ≤ t ≤ b, y ( a ) = α, has a difference equation for approximate w i +1 at t i +1 : w i +1 = a m − 1 w i + a m − 2 w i − 1 + · · · + a 0 w i +1 − m + h [ b m f ( t i +1 , w i +1 ) + b m − 1 f ( t i , w i ) + · · · + b 0 f ( t i +1 − m , w i +1 − m )] , where h = ( b − a ) /N , and starting values are specified: w 0 = α, w 1 = α 1 , . . . , w m − 1 = α m − 1 Explicit method if b m = 0 , implicit method if b m � = 0 .
Multistep Methods Fourth-Order Adams-Bashforth Technique w 0 = α, w 1 = α 1 , w 2 = α 2 , w 3 = α 3 , w i +1 = w i + h 24[55 f ( t i , w i ) − 59 f ( t i − 1 , w i − 1 ) + 37 f ( t i − 2 , w i − 2 ) − 9 f ( t i − 3 , w i − 3 )] Fourth-Order Adams-Moulton Technique w 0 = α, w 1 = α 1 , w 2 = α 2 , w i +1 = w i + h 24[9 f ( t i +1 , w i +1 ) + 19 f ( t i , w i ) − 5 f ( t i − 1 , w i − 1 ) + f ( t i − 2 , w i − 2 )]
Derivation of Multistep Methods Integrate the initial-value problem y ′ = f ( t, y ) , a ≤ t ≤ b, y ( a ) = α over [ t i , t i +1 ] : � t i +1 y ( t i +1 ) = y ( t i ) + f ( t, y ( t )) dt t i Replace f by polynomial P ( t ) interpolating ( t 0 , w 0 ) , . . . , ( t i , w i ) , and approximate y ( t i ) ≈ w i : � t i +1 y ( t i +1 ) ≈ w i + P ( t ) dt t i
Recommend
More recommend