finite difference method
play

Finite Difference Method Motivation For a given smooth function ! - PowerPoint PPT Presentation

Finite Difference Method Motivation For a given smooth function ! " , we want to calculate the derivative ! " at a given value of ". I = -0 Suppose we dont know how to compute the analytical expression for ! " , or


  1. Finite Difference Method

  2. Motivation For a given smooth function ! " , we want to calculate the derivative !′ " at a given value of ". I = -0 Suppose we don’t know how to compute the analytical expression for !′ " , or it is computationally very expensive. However you do know how to evaluate the function value: N We know that: I ! # + ℎ − !(#) !′ # = lim ℎ !→# ! "#$ %! " Can we just use !′ " ≈ as an approximation? How do we choose ℎ ? $ Can we get estimate the error of our approximation?

  3. Finite difference method For a differentiable function !: ℛ → ℛ , the derivative is defined as: & ( + ℎ − &(() &′ ( = lim ℎ !→# Taylor Series centered at % , where ̅ % = % + ℎ ! ! ! " & ( + ℎ = & ( + & $ ( ℎ + &′′ ( % +&′′′ ( & + ⋯ & ( + ℎ = & ( + & $ ( ℎ + 3(ℎ % ) = fGth7h-f# t O Ch ) ' f- Cx ) - We define the Forward Finite Difference as: = fGth)n = df Cx ) to Ch ) ' G) f off ( x ) → Therefore, the truncation error of the forward finite difference approximation is bounded by: I f KH / f M h - - df Cx )

  4. In a similar way, we can write: ! % − ℎ = ! % − ! ! % ℎ + +(ℎ " ) → ! ! % = ! % − ! % − ℎ + +(ℎ) ℎ And define the Backward Finite Difference as: # .! % = ! % − ! % − ℎ → ! ! % = .! % + +(ℎ) ℎ And subtracting the two Taylor approximations EEO # ! # " ! % + ℎ = ! % + ! ! % ℎ + !′′ % " +!′′′ % $ + ⋯ # ! # " ! % − ℎ = ! % − ! ! % ℎ + !′′ % " −!′′′ % $ + ⋯ ! % + ℎ − ! % − ℎ = 2! ! % ℎ + !′′′ % ℎ % ÷ h 6 + +(ℎ & ) §= = ! ! % = ! % + ℎ − ! % − ℎ + +(ℎ " ) 2ℎ And define the Central Finite Difference as: .! % = % + ℎ − ! % − ℎ → ! ! % = .! % + +(ℎ " ) 2ℎ

  5. How accurate is the finite difference approximation? How many function HAI evaluations (in additional to ! % )? Forward Finite Difference: ' ()# *' ( → ! ! % = .! % + +(ℎ) I Truncation error: +(ℎ) .! % = # Cost: 1 function evaluation Backward Finite Difference: → ! ! % = .! % + +(ℎ) ' ( *' (*# Truncation error: +(ℎ) .! % = # Cost: 1 function evaluation Central Finite Difference: → ! ! % = .! % + +(ℎ " ) Truncation error: +(ℎ " ) .! % = ' ()# *' (*# "# Cost: 2 function evaluation2 Our typical trade-off issue! We can get better accuracy with Central Finite Difference with the (possible) increased computational cost. How small should the value of ! ?

  6. Example ' the 2 f- ( x th ) = e' 34454 ℎ If = f(Xthh)-f# ! # = - $ − 2 !′ # = - $ t We want to obtain an approximation for !′ 1 /!01123# = (- $%! −2) − (- $ −2) ℎ Truncation error -2232(ℎ) = 045(!′ # − /!01123#) q = = =

  7. Example Should we just keep decreasing the perturbation ℎ , in order to approach the limit ℎ → 0 and obtain a better approximation for the derivative?

  8. Uh-Oh ! What happened here? ! # = - $ − 2, !′ # = - $ → !′ 1 ≈ 2.7 Forward Finite Difference - cancelation ! .! 1 = ! 1 + ℎ − !(1) ℎ

  9. - och ) ? → When computing the finite difference approximation, we have two competing source of errors: Truncation errors and Rounding errors I Eml H .!(%) = ! % + ℎ − !(%) ≤ 8 + |! % | ℎ O ℎ F -

  10. Loss of accuracy due to rounding / e : I ' → to Minimize the total error 34454 ~ 8 + |! % | -2232~> ℎ Optimal “h” Truncation error: + ;ℎ ℎ Gives -2232~ ? & |! # | ℎ = 8 + |! % |/; Rounding error: ℎ

  11. ⇐ Finite Difference Method - f2 → Ee Review : → f) Cx ) = fCxth)-S df ← % E h - ' In ) - ft , Is FCK ) Iz " - → R - , : IR f - = = = t.it?tSCxth#-f ÷÷÷I ' giant - ⇐ :o) Ei ? ) - µ E - h ⇐ i :*

  12. = 2X , txixz the f- ( x , , Xz ) is " " " * ⇐ t.ie/Hx-tngy#=y--f7sI%fCkthIz)-fCx ) - h

  13. f : Bing - pin ÷÷÷¥ ⇐ ÷÷ , ÷÷i÷÷÷÷÷÷÷÷÷÷ : :* .

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend