11.07.2015 Views

Lecture 6: =1=Truncation Error, Consistency, and Convergence

Lecture 6: =1=Truncation Error, Consistency, and Convergence

Lecture 6: =1=Truncation Error, Consistency, and Convergence

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Lecture</strong> 6:Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong><strong>Convergence</strong>J.K. Ryan@tudelft.nlWI3097TUDelft Institute of Applied MathematicsDelft University of Technology8 October 2012() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 1 / 54


Outline1 ReviewSingle Step MethodsStabilityIVP StabilityAmplification factor2 Local Truncation <strong>Error</strong> & <strong>Consistency</strong>3 Global truncation error & <strong>Convergence</strong>() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 2 / 54


Single-step methodsSummaryWe have 4 schemes to solvey ′ (t) = f (t, y(t))y(t 0 ) = y 0 .Forward Euler: w n+1 = w n + hf (t n , w n )Backward Euler: w n+1 = w n + hf (t n+1 , w n+1 )Trapezoidal method:Modified Euler:w n+1 = w n + h 2 (f (t n, w n ) + f (t n+1 , w n+1 ))¯w n+1 = w n + hf (t n , w n )w n+1 = w n + h 2 (f (t n, w n ) + f (t n+1 , ¯w n+1 ))() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 3 / 54


StabilityLax Equivalence Theorem: For a linear scheme,Stability + <strong>Consistency</strong> = <strong>Convergence</strong>Stability is how much small perturbations affect the solution.For this we have to look atStability of the initial value problem (IVP)Stability of the numerical method() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 4 / 54


StabilityIVP StabilityFor the stability of the initial value problem (IVP), we considerɛ(t) =There are three possibilities:ỹ(t) −y(t)}{{}perturbed problem1 It is unstable if lim t→∞ |ɛ(t)| → ∞2 It is stable if lim t→∞ |ɛ(t)| < ∞ (finite)3 It is unconditionally stable if lim t→∞ |ɛ(t)| → 0() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 5 / 54


StabilityIVP StabilityFor the test equationy ′ = λyy(0) = y 0 , (1)lim t→∞ |ɛ(t)| → 0 equates to λ < 0.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 6 / 54


StabilityNumerical StabilityFor numerical stability, we must consider the amplificationfactor, Q(hλ) inThe possiblities are:w n+1 = Q(hλ)w n = (Q(hλ)) n+1 y 0 .1 The method is unstable if lim h→0 |Q(hλ)| > 1.2 The method is stable if lim h→0 |Q(hλ)| ≤ 1.We use these conditions to choose an appropriate bound on h.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 7 / 54


StabilityAmplification factorw n+1 = Q(hλ)w nThe amplification factor for our methods is given by:Forward Euler: Q(hλ) = 1 + hλ, stable for 0 < h < 2|λ| .Backward Euler: Q(hλ) = 11−hλ, stable for 0 < h.Trapezoidal method: Q(hλ) = 1+ h 2 λ1− h λ,stable for 0 < h.2modified Euler: Q(hλ) = 1 + hλ + 1 2 (hλ)2 , stable for0 < h < 2|λ| .() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 8 / 54


Local Truncation <strong>Error</strong>Last time we asked: How good are these methods?For this, we need convergence.But, convergence is difficult to prove directly.The Lax equivalence theorem says that we can instead provestability <strong>and</strong> consistency.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 9 / 54


StabilityLast time, we covered stability.Stability is given by the amplification factor,w n+1 = Q(hλ)w n .For this, we choose h so that |Q(hλ)| ≤ 1.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 10 / 54


Local Truncation <strong>Error</strong>For consistency, we will need the local truncation error. Butfirst we need a few definitions:y n+1 = exact solution at time t n+1 .z n+1 = Q(hλ)y n = approximation applied to the exactsolution at time t n .w n+1 = (Q(hλ)) n+1 y 0 = approximation applied n + 1times.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 11 / 54


Local Truncation <strong>Error</strong>Definition ( Local truncation error)The local truncation error at time step n + 1 is given byτ n+1 (h) = y n+1 − z n+1.hNotice, it is the difference between the exact solution <strong>and</strong> theapproximation applied to the exact solution at time t n .() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 12 / 54


<strong>Consistency</strong>Definition (Consistent)A numerical method is consistent iflim τ n+1(h) = 0.h→0Consistent ↔We can replicate the results.Solution of the numerical method converges to the exactsolution of the IVP.y n+1 − z n+1 → 0 faster than h → 0.By definition, this means that we need to examine thetruncation error.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 13 / 54


Local truncation errorConsider again the test equation:y ′ = λy,y(0) = y 0which has solution y(t) = y 0 e λt .The solution at t n+1 isy n+1 = y(t n+1 ) = y 0 e λt n+1= e λ(n+1)h y 0 = e λh y n = y n+1 .() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 14 / 54


Local truncation errorThe numerical method is given byw n+1 = Q(hλ)w n .Applied to the exact solution it isz n+1 = Q(hλ)y n .The local truncation error is thenτ n+1 (h) = y n+1 − z n+1h= eλh y n − Q(hλ)y nh= (eλh − Q(hλ))y n.h() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 15 / 54


Local truncation errorThis means that the truncation error is determined bye λh − Q(λh).For this, we need two things:1 The Taylor series for e λhe λh = 1+hλ+ 1 2! (hλ)2 + 1 3! (hλ)3 +· · · =r−1 ∑i=02 Q(λh), which is given by the numerical method.1i! (hλ)i +O(h r )() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 16 / 54


Local truncation errorForward EulerThe amplification factor for Forward Euler is given byQ(hλ) = 1 + hλ.Therefore, the local truncation error isτ n+1 (h) = (eλh − Q(λh))y n⎡h= 1 (h ⎢ 1 + hλ + 1 )⎣ 2! (hλ)2 + O(h 3 ) − (1 + hλ)} {{ }} {{ }Taylor series for e λh= 1 ( )1h 2! (hλ)2 + O(h 3 ) y n( )1=2! hλ2 + O(h 2 ) y n ⇒ τ n+1 (h) = O(h)⎤⎥ y n⎦Amplification factor() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 17 / 54


Forward EulerEuler forward,w n+1 = w n + hF (t n , w n ),Is an explicit method.Has amplification factor Q(hλ) = 1 + hλ.Is stable for 0 < h < 2|λ| .Has local truncation error of order one.Stability + <strong>Consistency</strong> = <strong>Convergence</strong>. It is a first ordermethod.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 18 / 54


<strong>Consistency</strong>Let us do the same for the other methods.<strong>Convergence</strong> is difficult to prove.Lax theorem says that we can instead prove stability <strong>and</strong>consistency.Stability is given by ensuring the amplification factor is lessthan one.|Q(hλ)| ≤ 1.For consistency, we need the local truncation error tovanish as the step size becomes smaller.lim τ 1n+1(h) = limh→0 h→0 h (y n+1 − z n+1 ).() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 19 / 54


Local truncation errorModified EulerFor the modified Euler, the amplification factor is given byQ(hλ) = 1 + hλ + (hλ)2 .2It is stable for 0 < h < 2|λ| .For consistency, we examine the local truncation error:τ n+1 (h) = (eλh − Q(λh))y nh= 1 [(1 + hλ + 1 h2! (hλ)2 + 1 )3! (hλ)3 + O(h 4 ) ..()].. − 1 + hλ + (hλ)2 y n2= 1 ( )1h 3! (hλ)3 + O(h 4 )=( 1 3! h2 λ 3 + O(h 3 ))y n ⇒ τ n+1 (h) = O(h 2 )() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 20 / 54y n


Modified EulerModified Euler is given by¯w n+1 = w n + hF (t n , w n ),w n+1 = w n + h 2 (F (t n, w n ) + F (t n+1 , ¯w n+1 )) (2)Is an explicit method.Has amplification factor Q(hλ) = 1 + hλ + (hλ)22.Is stable for 0 < h < 2|λ| .Has local truncation error of order two.Stability + <strong>Consistency</strong> = <strong>Convergence</strong>. It is a secondorder method.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 21 / 54


Local truncation errorImplicit methodsFor implicit methods we generally have to work a bit harder.Amplification factor is not in polynomial form.Have to put in polynomial form.⇒ Requires Taylor expansion.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 22 / 54


Local truncation errorBackward EulerFor Backward Euler, the amplification factor is given byQ(hλ) = 11 − hλ .Before we plug this into the formula for the local truncationerror, we must perform a Taylor expansion:when |hλ| < 1.11 − hλ = 1 + hλ + (hλ)2 + (hλ) 3 + O(h 4 ),() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 23 / 54


Local truncation errorBackward EulerPlugging in11−hλ = 1 + hλ + (hλ)2 + (hλ) 3 + O(h 4 ) into theformula for local truncation error givesτ n+1 (h) = (eλh − Q(λh))y nh= 1 [(1 + hλ + 1 )h2! (hλ)2 + O(h 3 ) ..].. − (1 + hλ + (hλ) 2 + O(h 3 )) y n= 1 (− 1 )h 2 (hλ)2 + O(h 3 ) y n(= − 1 )2 hλ2 + O(h 2 ) y n ⇒ τ n+1 (h) = O(h)() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 24 / 54


Backward EulerEuler backward,w n+1 = w n + hF (t n+1 , w n+1 ),Is an implicit method.Has amplification factor Q(hλ) = 11−hλ .Is stable for h > 0.Has local truncation error of order one.Stability + <strong>Consistency</strong> = <strong>Convergence</strong>. It is a first ordermethod.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 25 / 54


Local truncation errorTrapezoidal methodFor the Trapezoidal method, the amplification factor,Q(hλ) = 1 + hλ 21 − hλ 2also has to be exp<strong>and</strong>ed into a Taylor series:when1 + hλ 21 − hλ 2=∣ hλ 2 ∣ < 1.(1 + hλ 2)(1 + hλ 2 + (hλ 2 )2 + ( hλ )2 )3 + O(h 4 )= 1 + hλ + 1 2 (hλ)2 + 1 4 (hλ)3 + O(h 4 )() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 26 / 54


Local truncation errorTrapezoidal methodPlugging in 1+ hλ 2= 1 + hλ + 1 1− hλ 2 (hλ)2 + 1 4 (hλ)3 + O(h 4 ) into the2formula for local truncation error givesτ n+1 (h) = (eλh − Q(λh))y nh= 1 [(1 + hλ + 1 h2! (hλ)2 + + 1 )3! (hλ)3 + O(h 4 ) .... − (1 + hλ + 1 2 (hλ)2 + 1 ]4 (hλ)3 + O(h 4 )) y n= 1 (− 1 )h 6 (hλ)3 + O(h 4 ) y n(= − 1 )6 h2 λ 3 + O(h 3 ) y n ⇒ τ n+1 (h) = O(h 2 )() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 27 / 54


Trapezoidal methodTrapezoidal method,w n+1 = w n + h 2 (F (t n, w n ) + F (t n+1 , w n+1 )),Uses the average of Euler forward <strong>and</strong> Euler backward.Is an implicit method.Has amplification factor Q(hλ) = 1+ hλ 21− hλ 2Is stable for h > 0.Has local truncation error of order two.Stability + <strong>Consistency</strong> = <strong>Convergence</strong>. It is a secondorder method..() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 28 / 54


Local truncation errorTo find the local truncation errorwhere z n+1 = Q(hλ)y n .τ n+1 (h) = 1 h (y n+1 − z n+1 )1 Write the exact solution in terms of y n : y n+1 = y n e hλ .τ n+1 (h) = y nh (ehλ − Q(hλ))2 Exp<strong>and</strong> e hλ in a Taylor series.3 Exp<strong>and</strong> the amplification factor, Q(hλ) in a Taylor series(if necessary).4 Simplify the quantity e hλ − Q(hλ)5 Multiply by ynh .() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 29 / 54


Local truncation errorObserve: All methods can be written asw n+1 = Q(hλ)w n .Explicit methods can be written asz n+1 = y n + hΦ(z n , t n , h).This gives a truncation error of:τ n+1 (h) = 1 h [y n+1 − z n+1 ] = 1 h [y n+1 − (y n + hΦ(z n , t n , h))]= 1 h (y n+1 − y n ) − Φ(z n , t n , h)} {{ }} {{ }Depends upon methodAll explicit methods() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 30 / 54


Local truncation errorFor explicit methods, the local truncation error can be writtenasτ n+1 (h) = 1 h (y n+1 − y n ) − Φ(z n , t n , h).We can simplify this further. Exp<strong>and</strong> y n+1 around y n :y n+1 = y n + h (y n ) ′ + h2(y n ) ′′ +O(h 3 )} {{ } 2 } {{ }=f (t n,y n) =(f (t n,y n)) ′ =(f t+ff y ) n= y n + hf (t n , y n ) + h22 (f t + ff y ) n + O(h 3 )() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 31 / 54


Local truncation errorThenτ n+1 (h) = 1 h (y n+1 − y n ) − Φ(z n , t n , h)= 1 ()(y n + hf (t n , y n ) + h2h2 (f t + ff y ) n + O(h 3 )) − y n− Φ(z n , t n , h)= f (t n , y n ) + h 2 (f t + ff y ) n + O(h 2 ) − Φ(z n , t n , h)Euler Forward: Φ(z n , t n , h) = f (t n , y n )Modified Euler: Φ(z n , t n , h) = f (t n , y n ) + h(f t + ff y )() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 32 / 54


Local truncation errorFinding Φ(z n , t n , h) for modified Euler:¯z n+1 = y n + hf (t n , y n )z n+1 = y n + h 2 (f (t n, y n ) + f (t n+1 , ¯z n+1 ))We need to exp<strong>and</strong> f (t n+1 , ¯z n+1 ) in a Taylor series around(t n , y n ).f (t n+1 , ¯z n+1 ) =f (t n , y n ) + f t (t n , y n ) (t n+1 − t n )} {{ }=h(+ f tt (t n , y n )(t n+1 − t n ) 2 ..+f y (t n , y n ) (¯z n+1 − y n )} {{ }=hf (t n,y n).. + 2f ty (t n+1 − t n )(¯z n+1 − y n ) + f yy (¯z n+1 − y n ) 2)+ O(h 3 )=f (t n , y n ) + h(f t (t n , y n ) + f (t n , y n )f y (t n , y n )) + O(h 2 )() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 33 / 54


Global truncation errorThe local truncation error,τ n+1 (h) = 1 h (y n+1 − z n+1 ),says how well the method performs over one time-step. It tellsus whether the method is consistent.What is the cumulative effect?() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 34 / 54


Global truncation errorFor that we need:Definition (Global truncation error)The global truncation error of a scheme is defined ase n+1 = y n+1 − w n+1 ,where y n+1 = y(t n+1 ) is the exact solution at t n+1 <strong>and</strong>w n+1 = (Q(hλ)) n+1 y 0 is the approximation applied to the initialcondition n + 1 times.This is the cumulative effect of the errors from theapproximation over the entire interval.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 35 / 54


Global truncation errorDefinition (<strong>Convergence</strong>)A numerical method is convergent iflim e n+1 = 0.h→0The global truncation error goes to zero as we increase thenumber of subintervals.The local & global truncation errors are of the same order.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 36 / 54


<strong>Convergence</strong>We now have the three elements in the Lax EquivalenceTheorem: For a linear scheme,Stability + <strong>Consistency</strong> = <strong>Convergence</strong>Proof is in the book...() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 37 / 54


Higher Order MethodsThe methods we have discussed are all 1 st or 2 nd ordermethods. Sometimes, we would like a higher order method.When we require high accuracy.When we must solve the equation over long periods intime.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 38 / 54


Higher Order Methods4 th −order Runge-Kutta (RK4)One higher-order method is the family of Runge-Kutta methods.The 4 th −order Runge-Kutta scheme is:k 1 = hf (t n , w n )k 2 = hf (t n + h 2 , w n + k 12 )k 3 = hf (t n + h 2 , w n + k 22 )k 4 = hf (t n + h, w n + k 3 )RK4 is the average of these slopesw n+1 = w n + 1 6 (k 1 + 2(k 2 + k 3 ) + k 4 )() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 39 / 54


Higher Order Methods4 th −order Runge-Kutta (RK4)RK4:Uses an average of different slopes.This allow us to avoid taking higher derivativesThis is a 4 th −order method.The amplification factor isQ(hλ) = 1 + hλ + 1 2 (hλ)2 + 1 3! (hλ)3 + 1 4! (hλ)4The stability region is 0 < h < 2.8|λ| .() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 40 / 54


ExampleExampleConsider the numerical scheme given byu ⋆ = u n + βhf (t n , u n )u n+1 = u ⋆ + (1 − β)hf (t n + βh, u ⋆ )1 Show the truncation error is O(h) for each value of β.Show that there does not exist a β for which the scheme isO(h 2 ).2 What is the amplification factor?3 Consider the nonlinear equation y ′ = 2y − 4y 2 <strong>and</strong> takeβ = 1 2. Determine the maximal step size such that themethod is stable in the neighbourhood of y = 1 2 .() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 41 / 54


ExampleTruncation errorThe numerical method applied to the exact solution, y n , isgiven byz ⋆ = y n + βhf (t n , y n )z n+1 = z ⋆ + (1 − β)hf (t n + βh, z ⋆ )We first need to exp<strong>and</strong> f (t n + βh, z ⋆ ) in a Taylor series around(t n , y n ) :f (t n + βh, z ⋆ ) =f (t n , y n ) + (f t ) n (t n + βh − t n ) + (f y ) n (z ⋆ − y n )+ 1 2 β2 h 2 (f tt ) n (t n + βh − t n ) 2 + 1 2 (f yy) n (z ⋆ − y n ) 2+ βh(f ty ) n (t n + βh − t n )(z ⋆ − y n ) + O(h 3 )() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 42 / 54


ExampleTruncation errorSubstituting z ⋆ = y n + βhf (t n , y n ) into the expansion, we havef (t n + βh, z ⋆ ) = f (t n , y n ) + βh((f t ) n + (f f y ) n ) + O(h 2 ).Now, we can consider z n+1 :z n+1 =z ⋆ + (1 − β)hf (t n + βh, z ⋆ )=y n + βhf (t n , y n )+ (1 − β)h(f (t n , y n ) + βh((f t ) n + (f f y ) n ) + O(h 2 ))=y n + βhf (t n , y n )+ h(f (t n , y n ) + βh(f t + f f y ) n + O(h 2 ))−βh(f (t n , y n ) + βh(f t + f f y ) n + O(h 2 ))() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 43 / 54


ExampleTruncation errorTherefore we have thatz n+1 = y n +hf (t n , y n )+βh 2 (f t +f f y ) n +(βh) 2 (f t +f f y ) n +O(h 3 )We also needy n+1 = y n + h (y n ) ′ + 1 } {{ } 2 h2 (y n ) ′ ′ + O(h 3 )} {{ }=f (t n,y n) =(f t+ff y ) n= y n + hf (t n , y n ) + 1 2 h2 (f t + ff y ) n + O(h 3 ) = y n+1() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 44 / 54


ExampleTruncation errorWhich gives the local truncation error asτ n+1 (h) = 1 h (y n+1 − z n+1 )= 1 ((y n + hf (t n , y n ) + 1 h2 h2 (f t + ff y ) n + O(h 3 )) ..).. − (y n + hf (t n , y n ) + βh 2 (f t + f f y ) n + . . .)= 1 2 h(f t + ff y ) n − βh(f t + f f y ) n + . . .=O(h)The local truncation error is O(h) for any value of β.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 45 / 54


ExampleAmplification factorTo determine the amplification factor, we apply the numericalmethod to the test equation,This givesy ′ = λy, y(0) = y 0 , λ < 0.u ⋆ = u n + βhλu nu n+1 = u ⋆ + (1 − β)hλu ⋆() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 46 / 54


ExampleAmplification factorSimplifying,u n+1 = u ⋆ + (1 − β)hλu ⋆= (u n + βhλu n ) + (1 − β)hλ(u n + βhλu n )= (1 + ✟✟✯ ✟ βhλ + hλ + β(hλ) 2 − ✟✟✯ ✟ βhλ − β 2 (hλ) 2 )u n= (1 + hλ + β(1 − β)(hλ) 2 )} {{ }Q(hλ)The Amplification factor is given byu nQ(hλ) = (1 + hλ + β(1 − β)(hλ) 2 )() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 47 / 54


ExampleNonlinear equationThe nonlinear equation isy ′ = f (y) = 2y − 4y 2 .Notice, this is zero at y = 0 <strong>and</strong> y = 1 2 . If β = 1 2, we want todetermine the maximum step-size, h, for which the scheme isstable. We proceed as followsFirst, we linearize f (y) around y = 1 2 .() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 48 / 54


ExampleNonlinear equationThe linearization is given byL(y) = f ( 1 2 ) + f ′ ( 1 (2 ) y − 1 ).2This givesL(y) = 1 − 2y.Therefore, to consider the stablity of the nonlinear equationy ′ = 2y − 4y 2 .it is enough to consider the stability of the linear equationy ′ = −2yThis is just our test equation with λ = −2.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 49 / 54


ExampleNonlinear equationFor stability, we consider the amplification factor with β = 1 2<strong>and</strong> λ = −2 :The method is stable ifQ(hλ) =1 + hλ + β(1 − β)(hλ) 2(1 − 1 2=1−2h + 1 2=1 − 2h + h 2)(−2h) 2|Q(hλ)| = |1 − 2h + h 2 | ≤ 1.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 50 / 54


ExampleNonlinear equation|Q(hλ)| = |1 − 2h + h 2 | ≤ 1This means−1 ≤ 1 − 2h + h 2 ≤ 1−1 ≤ (h − 1) 2 ≤ 1−2 ≤ h(h − 2) ≤ 0Recall: h > 0. Thus:0 < h ≤ 2 for stability.() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 51 / 54


Summary tableFE BE ME TM1+ hλ 21+ hλ 2Amplification factor 1 + hλ 1 − hλ 1 + hλ + (hλ)22Type method Explicit Implicit Explicit ImplicitStability range 0 < h < 2|λ|h > 0 0 < h < 2|λ|h > 0Method order One One Two TwoΦ(z n , t n , h) f n f n + h(f t + ff y ) nFE = Forward Euler; BE = Backward Euler; ME ModifiedEuler; TM = Trapezoidal method() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 52 / 54


SummaryLax Equivalence Theorem: For a linear scheme,Stability + <strong>Consistency</strong> = <strong>Convergence</strong>Stability: given by amplification factor, choose h such that|Q(hλ)| < 1.<strong>Consistency</strong>: given by the local truncation error:τ n+1 = 1 h (y n+1 − z n+1 ).<strong>Convergence</strong>: given by the global truncation error:e n+1 = y n+1 − w n+1 .() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 53 / 54


Material addressed1 ReviewSingle Step MethodsStabilityIVP StabilityAmplification factor2 Local Truncation <strong>Error</strong> &<strong>Consistency</strong>3 Global truncation error &<strong>Convergence</strong>Material in book:Chapter 6, Sections 1-7Useful exercises: 1-5() Truncation <strong>Error</strong>, <strong>Consistency</strong>, <strong>and</strong> <strong>Convergence</strong> 8 October 2012 54 / 54

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!