1 / 6

Contents

Contents. Chapter 10: Numerical Techniques. Integration Intro Euler Recall basic Predictor-Corrector C. Runge-Kutta 2. I. Numerical integration. I. NUMERICAL INTEGRATION: A. Intro. IA. Intro In a very generic manner a 1 st order differential equation can be written as:

Download Presentation

Contents

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Contents Chapter 10: Numerical Techniques Integration • Intro • Euler • Recall basic • Predictor-Corrector C. Runge-Kutta 2

  2. I. Numerical integration I. NUMERICAL INTEGRATION: A. Intro IA. Intro In a very generic manner a 1st order differential equation can be written as: As we have seen in Ch6, higher order equations can also be written if this form by introducing more dimensions. For instance: can be written as: that we then write in the form , yielding a set of coupled 1storder differential equations. The case where the equations are linear was treated in chapter 6. In general, however, we can often expect to be a function too complicated to allow a closed form solution for x(t) and thus numerical integration is required! In this chapter we’ll briefly review the Euler method from ch2, and then proceed to present a significantly more accurate and efficient method, called the Runge-Kutta (RK) method. We present with some detail the 2nd order RK to understand the idea behind this integration method, but leave it to you to look up the most often used 4th order RK.

  3. 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 tn, is not a good estimate of the tangent in the interval tn , tn+1. Given that xn is accurate, xn+1 would be just as good if we could know the tangent of the cord from xn to xn+1 (see picture below). Although we can’t because we don’t know xn+1 (since it is obviously what we are trying to estimate) we can come up with an approximation for the value of that slope: B1. Basic Euler Method We start from our standard 1st order diff eq: Discretize it: Introduce a step size we get: The error made at each step is of order h2. Calling xn the approximate value of x aftern iterations of the formula above we get:

  4. I. Numerical integration I. NUMERICAL INTEGRATION: B. Euler Methods: B2. Predictor- Corrector (cont’d)

  5. I. Numerical integration I. NUMERICAL INTEGRATION: C. Runge-Kutta Methods RungeKutta 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 [tn,tn+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 [tn,tn+1] in 2 and then approximate [tn,tn+1] by a Taylor series expansion around the middle of that interval at tn+1/2 =tn +h/2 where h=tn+1 -tnis the step size for the integration. Thus we get: Now we insert the above into our formal integration formula:

  6. 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 tn to figure it out at tn+1/2=tn+h/2: Which is accurate to order h2 included! So by just doubling the number of steps to compute xn+1/2 and xn+1 versus only xn we have squared the accuracy of our computation from h to h2: 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 h2 term. RK4 involves 2 more lines of code at tn+h/4 and tn+3h/4 but is accurate to h4 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 h2included for the second term because f is multiplied by h in that result. So our final result is:

More Related