Download presentation
Presentation is loading. Please wait.
Published byMarvin York Modified over 9 years ago
1
PHY 301: MATH AND NUM TECH Contents Chapter 10: Numerical Techniques I. Integration A.Intro B.Euler Recall basic Predictor-Corrector C. Runge-Kutta 2
2
PHY 301: MATH AND NUM TECH I. Numerical integration I. NUMERICAL INTEGRATION: A. Intro
3
PHY 301: MATH AND NUM TECH I. Numerical integration I. NUMERICAL INTEGRATION: B. Euler Methods B2. Predictor-Corrector Euler Method It is a refinement on the above. The problem with the above is that the value of the slope of the tangent to the graph at t n, is not a good estimate of the tangent in the interval t n, t n+1. Given that x n is accurate, x n+1 would be just as good if we could know the tangent of the cord from x n to x n+1 (see picture below). Although we can’t because we don’t know x n+1 (since it is obviously what we are trying to estimate) we can come up with an approximation for the value of that slope: Discretize it: The error made at each step is of order h 2. Calling x n the approximate value of x aftern iterations of the formula above we get: We start from our standard 1 st order diff eq: B1. Basic Euler Method
4
PHY 301: MATH AND NUM TECH I. Numerical integration I. NUMERICAL INTEGRATION: B. Euler Methods: B2. Predictor- Corrector (cont’d)
5
PHY 301: MATH AND NUM TECH I. Numerical integration I. NUMERICAL INTEGRATION: C. Runge-Kutta Methods Runge Kutta Methods. Derivation of RK2 Since we can formally integrate to: or Since we assume that we got to step n with, our problem is to figure out the integral of the function of f(x,t). The idea of RK of order L is to cut up the interval [t n,t n+1 ] in L pieces and do a Taylor series expansion of f(x,t) around the boundaries of the L pieces. f(x,t) is then approximated in terms of a weighted average of these expansions. Let see in details how it works for RK2. Thus for RK2 we cut the step interval [t n,t n+1 ] in 2 and then approximate [t n,t n+1 ] by a Taylor series expansion around the middle of that interval at t n+1/2 =t n +h/2 where h= t n+1 -t n is the step size for the integration. Thus we get: Now we insert the above into our formal integration formula:
6
PHY 301: MATH AND NUM TECH I. Numerical integration Computing the second term, remembering that: and that: Which is a little messy of a calculation but ends up being zero from the fact that we integrate a function which is odd with respect to its midpoint. Since that second term thus integrates to zero we are left with: The only problem is that we don’t know and thus use yet again a Taylor series expansion, but this time around t n to figure it out at t n+1/2 = t n +h/2: Which is accurate to order h 2 included! So by just doubling the number of steps to compute x n+1/2 and x n+1 versus only xn we have squared the accuracy of our computation from h to h 2 : This is why RK is so powerful. And what allowed us the result, is the expansion around the midpoint point that gave us a vanishing h 2 term. RK4 involves 2 more lines of code at t n +h/4 and t n +3h/4 but is accurate to h 4 which is why RK4 is used so often for numerical integration. Now notice that using this in the boxed result, gives us again accuracy to order h 2 included for the second term because f is multiplied by h in that result. So our final result is:
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.