Comparison of Numerical Ordinary Differential Equation Solvers

Size: px
Start display at page:

Download "Comparison of Numerical Ordinary Differential Equation Solvers"

Transcription

1 Adrienne Criss Due: October, 008 Comparison of Numerical Ordinary Differential Equation Solvers Many interesting physical systems can be modeled by ordinary differential equations (ODEs). Since it is always possible to transform an ordinary differential equation into a set of coupled first-order differential equations, the problem of modeling the physical system can be reduced to solving a set of coupled first-order differential equations. In this project, we use the motion of a planet around a sun as our physical system in order to study three methods of solving a set of first order ODEs. The methods studied are a fourth-order Runge-Kutta with fixed step size, a fourth-order Runge-Kutta with variable step size, and the Bulirsch-Stoer method. We find that for our test system the Bulirsch-Stoer method gave the most accurate results, as determined by percent error from the true energy and angular momentum of the system. Introduction An Nth order ODE can be reduced to N coupled first-order ODEs through the process of rewriting the equations with new variables. Generally, the new variables are chosen to be the derivatives of the original ones and each other [1]. As an example, consider a general second-order equation dy dy + q(x) = r(x) dx dx (1) This can be rewritten as dy = z( x ) dx () dz = r ( x ) q ( x )z( x ) dx Therefore, the general set of equations to solve are dyi( x ) = ai( x, yi...yn ) dx (3) where i runs from 1 to N. In order to solve this system, we must have boundary conditions. The two classes of boundary conditions are initial value conditions, where we know the values of all the yi at a starting value of x, and two-point boundary value conditions, where the values of the yi are given at two values of x [1]. In this project we deal exclusively with initial value problems. Assuming we have the necessary boundary conditions, the simplest way to solve (3) is to let the dyi's and dx's go to finite steps Δyi and Δx. Then the solution at some time t + Δt is yi ( t + t ) = yi ( t ) + ai ( t ) t (4) This is called the Euler algorithm. While conceptually simple, it has very limited accuracy and stability and thus is not considered as a stand-alone ODE solver here. One problem with the Euler algorithm is that is only uses the derivative at the beginning of the interval. A modification, called the mid-point

2 algorithm, see (5), is similar to the Euler algorithm, but uses the derivative at the mid-point of the interval []. vn + 1 = vn + an ( t ) (5) 1 xn + 1 = xn + ( vn vn ) t For simplicity, we have dropped the yi notation and assumed one-dimensional motion of a particle. The subscript n denotes the value at time tn and the subscript (n+1) denotes the value at time tn + Δt. The order of an algorithm corresponds to how the global error depends on time. If the global error goes as (Δt)n, the algorithm is said to be nth order. The Euler algorithm is first-order. The midpoint method is first-order in velocity and second-order in position, which can be seen by plugging the first equation of (5) into the second; terms up to (Δt) are kept in velocity and (Δt) in position []. In the model presented here, we use the motion of one planet around a sun as our physical system. Motion is confined to the xy-plane. We assume an initial state and evolve it forward in time to a specified final time. In this example, Newton's equation of motion is d r GM = dt r (6) Rewriting the equation and working in x and y components, we obtain dx = vx ( t ) dt dvx GMx = = ax ( t ) dt r3 dy = vy ( t ) dt dvy GMy = = ay ( t ) dt r3 (7) Three separate methods of solving ODEs are compared: a fourth-order Runge-Kutta with fixed step size, a fourth-order Runge-Kutta with variable step size, and the Bulirsch-Stoer method. The methods are fed the same initial conditions. Two sets of initial conditions are considered: a stable moderate orbit and an orbit close to the sun. The ODE solvers are run from time t = 0 to time t = 40 years. The number of steps taken as well as the time and accuracy of each method are then compared. The Runge-Kutta methods and the Bulirsch-Stoer method are described below along with how they are implemented in the code. Method The first method implemented is the fourth-order Runge-Kutta method with fixed step size. To describe the fourth-order Runge-Kutta method, we will start by explaining the second-order RungeKutta method, following [1]. The basic idea is that the Euler method is used to take a step halfway across the desired interval. The derivative at that midpoint is then used to cross the full interval. This method is equivalent to the midpoint method. Writing it a different way k1 = ( t )a ( xn, yn ) k = ( t )a ( xn t, yn + k1) yn + 1 = yn + k + O( t 3 ) (8)

3 it is clear that the lowest order error term is of order (Δt)3. Lower orders have been canceled out. This is the general idea for higher order Runge-Kutta methods. The right hand side is evaluated in different ways that differ in terms higher than first-order. Judicious choices of combinations of these evaluations can cancel error terms one order at a time [1]. The form for the fourth-order Runge-Kutta is k1 = ( t )a ( xn, yn ) k = ( t )a ( xn + t k1, yn + ) k 3 = ( t )a ( xn + t k, yn + ) (9) k 4 = ( t )a ( xn + t, yn + k 3) yn + 1 = yn + k1 k k 3 k O( t 5 ) This is represented graphically by figure 1. Figure 1: The fourth-order Runge-Kutta evaluates the derivative four times over a given time step. By choosing the weights for each derivative, lower orders of error can be canceled out. [1] There are two main ways of implementing a Runge-Kutta with adaptive step size control. The first method is by step doubling. Step-doubling consists of taking each step twice, once as the full step, and again as two half steps. The truncation error is given as the difference of these two measurements. This error is kept within set bounds by adjusting Δt [1]. The second method of variable step size is called an embedded Runge-Kutta. In this method, a fifth-order Runge-Kutta that requires six evaluations of the function is also used to calculate a fourth-

4 order Runge-Kutta with the same six evaluations, but in a different combination. The form for the fifthorder Runge-Kutta is k1 = ( t )a ( xn, yn ) k = ( t )a ( xn + a t, yn + b 1k 1) (10)... k 6 = ( t )a ( xn + a 6 t, yn + b 61k1 + b 6 k + b 63k 3 + b 64 k 4 + b 65 k 5) yn + 1 = yn + c1k1 + c k + c3 k 3 + c 4 k 4 + c5 k 5 + c 6 k 6 + O(h 6 ) The embedded fourth-order formula is y * n + 1 = yn + c * 1k1 + c * k + c * 3k 3 + c * 4 k 4 + c * 5 k 5 + c * 6 k 6 + O(h 5 ) (11) The difference between these two answers gives an estimate of the error. The coefficients are listed in table 1 [1]. Cash-Karp Parameters for Embedded Runge-Kutta Method i ai bij ci c*i 37/378 85/ / / / / / /5 1/5 3 3/10 3/40 9/40 4 3/5 3/10-9/10 6/ /54 5/ -70/7 6 7/8 1631/ /51 35/7 575/ / / /1771 1/4 j= Table 1: List of the coefficients for the embedded Runge-Kutta method [1]. The embedded Runge-Kutta method is implemented in this project, since it is more efficient than stepdoubling [1]. Once the error Δ = yn+1 y*n+1 has been calculated, the step is rescaled. The relation between Δ1 corresponding to a step size Δt1 and Δ corresponding to a step size Δt is given by 0. 1 t1 = t The time steps are adjusted to maintain Δ within a prescribed level of accuracy. (1)

5 The last method implemented is the Bulirsch-Stoer method. While the first two methods take rather small steps in time, the Bulirsch-Stoer method is designed to cover much larger steps. The method first spans a large range, T, using n1 = steps and the modified midpoint method. This yields a result y1. Then the same range, T, is covered using n = 4 steps, yielding a result y. This process is repeated for some series of n, here chosen to be n=,4,6,8,10,1,14,... [1]. See figure for a schematic of this process. Figure : The modified midpoint method with increasing number of intervals is used to span a large step, H. The solutions to each modified midpoint cycle are fitted with a polynomial to extrapolate to a solution for y(h) [1]. After each repetition, a polynomial is fitted though the yi's. If the error in the fitting exceeds the accuracy desired, another repetition, with the next higher n in the sequence is calculated, and the process repeated up to a maximum n. In this program, n was chosen to be 16. If the accuracy at this point is still unacceptable, the size of the step, T, is decreased to Tk = T ( ε ε k + 1, k )1/( k + 1) (13) Here k represents the position in the sequence of n, ε is the error required, and εk+1,k is the error returned [1]. Verification Energy and angular momentum are conserved for this system. These two quantities can be calculated explicitly at every time using the formulas E= 1 GM ( vx + vy ) 3 r (14) Lz = xvy yvx Verification of each method at every step is performed by comparing the values calculated at that step with the initial values obtained using the initial conditions.

6 Data For the first run, the initial conditions were set to x = 1.0 Au, vx = 0.0 Au/yr, y = 0.0 Au, vy = 8.0 Au/yr and t = 0.0 yr. The simulation was run until t = 40 years. The step size was set to 0.01 yr for the fixed step Runge-Kutta. The same step size was suggested for the two variable step size programs. The plots produced are shown below. Figure 3: Orbit of the planet for each of the three different models. Note that the blue points are essentially covered by the green and red.

7 Figure 4: Close up of the orbits shown in the previous figure. Note that the green points tend to spiral outward in time. Also note that only two red points are visible on this plot.

8 Figure 5: Only the orbit obtained from the Bulirsch-Stoer method is plotted here in order that the spacing between the points may be seen.

9 Figure 6: Energy versus time for the different methods.

10 Figure 7: A close-up of the previous plot so that the variation in the energy from the fixed Runge-Kutta and Bulirsch-Stoer methods may be seen.

11 Figure 8: Angular momentum versus time for the different methods.

12 Figure 9: A close-up of the previous plot so that the lack of variation in the angular momentum from the fixed Runge-Kutta and Bulirsch-Stoer methods may be seen.

13 For the second run, the initial conditions were set to x = 0.5 Au, vx = 0.0 Au/yr, y = 0.0 Au, vy = 6.8 Au/yr and t = 0.0 yr. The simulation was run until t = 40 years. The step size was set to 0.01 yr for the fixed step Runge-Kutta. The same step size was suggested for the two variable step size programs. The plots produced are shown below. Figure 10: Orbit of the planet for each of the three different models. Note that the blue orbit is highly unstable and the planet eventually leaves the system.

14 Figure 11: Close up of the orbits shown in the previous figure. Note that the green points tend to spiral outward in time, while, at least initially, the blue points spiral inward.

15 Figure 1: Only the orbit obtained from the Bulirsch-Stoer method is plotted here in order that the spacing between the points may be seen.

16 Figure 13: Energy versus time for the different methods.

17 Figure 14: A close-up of the previous plot so that the variation in the energy from the Runge-Kutta adaptive step size and Bulirsch-Stoer methods may be see. Note that the blue points do not appear because they have already gone off scale.

18 Figure 15: Angular momentum versus time for the different methods.

19 Figure 16: A close-up of the previous plot so that the variation in the angular momentum from the Runge-Kutta adaptive step size and Bulirsch-Stoer methods may be see. Note that the blue points do not appear because they have already gone off scale.

20 Run 1 (time(msec) # steps) Run (time(msec) # steps) Fixed Runge-Kutta Adaptive Runge-Kutta Bulirsch-Stoer 0.0 Table : The run time and number of steps for each method. Energy (> 0.5% > 5.0%) Angular Mom. (> 0.5% > 5.0%) Run Run Adaptive Runge-Kutta Run Run Run Fixed Runge-Kutta Bulirsch-Stoer Run Table 3: The time in years at which each method reaches a certain percent error in energy and angular momentum.

21 Analysis Run 1 Looking at figure 3, the orbits of the planet for run 1, the orbits all look very similar. However, upon taking a closer look, figures 4 and 5, we see that the orbit calculated by the adaptive Runge-Kutta tends to increase, while the orbit of the fixed Runge-Kutta and the Bulirsch-Stoer do not. Indeed, from the energy and angular momentum versus time graphs, we see that the energy and angular momentum are not conserved for the adaptive Runge-Kutta, but increase rapidly relative to the other methods. From table 3 we learn that it takes approximately 4.4 years for the energy to differ from the true energy of the system by 0.5 percent and 13 years for the angular momentum to differ from the true angular momentum by 0.5 percent in the adaptive Runge-Kutta method. For these initial conditions, the other two methods never reached this error and no method reached 5 percent error within to 40 year model time. By looking at table, we can compare the run times for the different methods. Both the fixed Runge-Kutta and the Bulirsch-Stoer ran in less than one microsecond, while the adaptive Runge-Kutta took.3 microseconds to run. The adaptive Runge-Kutta also took the most steps to finish by almost a factor of 7. Given that the adaptive Runge-Kutta was the least accurate and slowest of the three methods for the initial conditions, it is the worst method for use in this particular situation with these parameters. Run From figure 10, we can already see that the fixed step Runge-Kutta breaks down. The planet spirals closer to the sun and then shoots out of the system. Looking at the energy and angular momentum graphs confirm this breakdown. The values diverge and then jump as the planet becomes unbound. From table 3, we see that the error of this method surpasses 0.5% in 0.1 years and 5.0 percent within one year, remarkably poor accuracy. The fast runtime does not make up for the lack of realism in this model. The adaptive step Runge-Kutta behaved much as it did in the previous run. The orbit gained energy and angular momentum as can be seen from the close up graph of the orbit and the energy and angular momentum graphs. However, the errors increased much faster. It took.7 years for the error in the energy to reach 5.0 percent and 6. years for the error in the angular momentum to reach 5.0 percent. This run took slightly over 00,000 steps and 30 microseconds. The Bulirsch-Stoer method performed as in run one. The errors never increased above 0.5 percent. The only difference between the runs was that this run required 3738 steps while the first run required 18 and this run took 0.6 milliseconds, while the first one required less than one microsecond. The Bulirsch-Stoer method is clearly the best of the three methods for this case; it is the most accurate and fastest method that is stable. Interpretation We can conclude that the Bulirsch-Stoer method was the most accurate and fastest method that gave reasonable results for our model of a planet around a sun for our two sets of initial conditions. We cannot conclude that the Bulirsch-Stoer method is the best in all models though. It comes with the caveat that it does not perform well with non-smooth functions [1]. The model here had smooth functions. What would happen in the case of non-smooth functions is something that can be explored at a later date. Between the fixed step Runge-Kutta and the adaptive Runge-Kutta, we found that the performance depended heavily on the initial conditions. While the adaptive Runge-Kutta gained energy and angular momentum in both cases, although at different rates, the fixed Runge-Kutta either

22 performed brilliantly for failed miserably depending on initial conditions. Therefore, we can say that the fixed Runge-Kutta seems to be more sensitive to initial conditions. In a further study, we could explore this dependence more. It should be noted that if the step size, dt in the program, is changed from 0.01 to 0.001, the fixed Runge-Kutta no longer diverges. The behavior of the other two methods does not appear to change. Critique I gained a much better understanding of the inner workings of these three ODE solvers. I learned that there is no one best method for all systems. The characteristics of the equations as well as the initial conditions dictate what method is most appropriate. These factors can have a huge impact on the performance of the solvers. While I already knew Fortran, I learned how to implement the above mentioned ODE solvers in Fortran thanks to Numerical Recipes. References [1] W. Press, S. Teukolsky, W. Vetterling, and B. Flannery, Numerical Recipes in Fortran 77, Cambridge University Press, New York, (003). [] H. Gould, J. Tobochnik, W. Christian, An Introduction to Computer Simulation Methods, Pearson Addison Wesley, New York, (007). Log Date Start Time End Time Time (hr) Activity 9/5 10:00 am 1:30 pm.5 Reading 9/5 1:15 pm :15 pm 1.0 Reading 9/9 10:00 am 7:00 pm 9.0 Programming 9/30 10:00 am 5:00 pm 7.0 Programming 9/30 10:45 pm 1:45 am.0 Reading/Programming/Writing 10/1 10:30 am 1:00 pm.5 Writing 10/1 4:30 pm 5:15 pm 0.75 Writing 10/1 10:30 pm 1:30 am.0 Writing 10/ 1:30 am 5:30 am 4.0 Writing 10/ 1:30 pm 1:00 pm 0.5 Proofreading

Ph 22.1 Return of the ODEs: higher-order methods

Ph 22.1 Return of the ODEs: higher-order methods Ph 22.1 Return of the ODEs: higher-order methods -v20130111- Introduction This week we are going to build on the experience that you gathered in the Ph20, and program more advanced (and accurate!) solvers

More information

Ordinary Differential Equations. Monday, October 10, 11

Ordinary Differential Equations. Monday, October 10, 11 Ordinary Differential Equations Monday, October 10, 11 Problems involving ODEs can always be reduced to a set of first order differential equations. For example, By introducing a new variable z, this can

More information

Solution of ordinary Differential Equations

Solution of ordinary Differential Equations 42 Chapter 4 Solution of ordinary Differential Equations Highly suggested Reading Press et al., 1992. Numerical Recipes, 2nd Edition. Chapter 16. (Good description). See also chapter 17. And Matlab help

More information

Astronomy 8824: Numerical Methods Notes 2 Ordinary Differential Equations

Astronomy 8824: Numerical Methods Notes 2 Ordinary Differential Equations Astronomy 8824: Numerical Methods Notes 2 Ordinary Differential Equations Reading: Numerical Recipes, chapter on Integration of Ordinary Differential Equations (which is ch. 15, 16, or 17 depending on

More information

AM 205 Final Project The N-Body Problem

AM 205 Final Project The N-Body Problem AM 205 Final Project The N-Body Problem Leah Birch Elizabeth Finn Karen Yu December 14, 2012 Abstract The N-Body Problem can be solved using a variety of numeric integrators. Newton s Law of Universal

More information

Ordinary Differential Equations (ODEs)

Ordinary Differential Equations (ODEs) Ordinary Differential Equations (ODEs) NRiC Chapter 16. ODEs involve derivatives wrt one independent variable, e.g. time t. ODEs can always be reduced to a set of firstorder equations (involving only first

More information

Physically Based Modeling: Principles and Practice Differential Equation Basics

Physically Based Modeling: Principles and Practice Differential Equation Basics Physically Based Modeling: Principles and Practice Differential Equation Basics Andrew Witkin and David Baraff Robotics Institute Carnegie Mellon University Please note: This document is 1997 by Andrew

More information

PH36010: Numerical Methods - Evaluating the Lorenz Attractor using Runge-Kutta methods Abstract

PH36010: Numerical Methods - Evaluating the Lorenz Attractor using Runge-Kutta methods Abstract PH36010: Numerical Methods - Evaluating the Lorenz Attractor using Runge-Kutta methods Mr. Benjamen P. Reed (110108461) IMPACS, Aberystwyth University January 31, 2014 Abstract A set of three coupled ordinary

More information

Physically Based Modeling Differential Equation Basics

Physically Based Modeling Differential Equation Basics Physically Based Modeling Differential Equation Basics Andrew Witkin and David Baraff Pixar Animation Studios Please note: This document is 2001 by Andrew Witkin and David Baraff. This chapter may be freely

More information

ODE Runge-Kutta methods

ODE Runge-Kutta methods ODE Runge-Kutta methods The theory (very short excerpts from lectures) First-order initial value problem We want to approximate the solution Y(x) of a system of first-order ordinary differential equations

More information

Simulations of Binary Star System with Earth Mass Planet Craig Swenson

Simulations of Binary Star System with Earth Mass Planet Craig Swenson Simulations of Binary Star System with Earth Mass Planet Craig Swenson For this project I wanted to investigate that stability of planetary orbits in binary systems. Logic dictates that for systems where

More information

TP 3:Runge-Kutta Methods-Solar System-The Method of Least Squares

TP 3:Runge-Kutta Methods-Solar System-The Method of Least Squares TP :Runge-Kutta Methods-Solar System-The Method of Least Squares December 8, 2009 1 Runge-Kutta Method The problem is still trying to solve the first order differential equation dy = f(y, x). (1) dx In

More information

Chapter 11 ORDINARY DIFFERENTIAL EQUATIONS

Chapter 11 ORDINARY DIFFERENTIAL EQUATIONS Chapter 11 ORDINARY DIFFERENTIAL EQUATIONS The general form of a first order differential equations is = f(x, y) with initial condition y(a) = y a We seek the solution y = y(x) for x > a This is shown

More information

+ h4. + h5. 6! f (5) i. (C.3) Since., it yields

+ h4. + h5. 6! f (5) i. (C.3) Since., it yields Appendix C. Derivation of the Numerical Integration Formulae C.1. Derivation of the Numerical Integration of dy(x) / dx = f (x) For a given analytical or taulated function f (x), the left column in Tale

More information

Maths III - Numerical Methods

Maths III - Numerical Methods Maths III - Numerical Methods Matt Probert matt.probert@york.ac.uk 4 Solving Differential Equations 4.1 Introduction Many physical problems can be expressed as differential s, but solving them is not always

More information

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations ECE257 Numerical Methods and Scientific Computing Ordinary Differential Equations Today s s class: Stiffness Multistep Methods Stiff Equations Stiffness occurs in a problem where two or more independent

More information

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by 1. QUESTION (a) Given a nth degree Taylor polynomial P n (x) of a function f(x), expanded about x = x 0, write down the Lagrange formula for the truncation error, carefully defining all its elements. How

More information

Chap. 20: Initial-Value Problems

Chap. 20: Initial-Value Problems Chap. 20: Initial-Value Problems Ordinary Differential Equations Goal: to solve differential equations of the form: dy dt f t, y The methods in this chapter are all one-step methods and have the general

More information

FORTRAN 77 Lesson 7. Reese Haywood Ayan Paul

FORTRAN 77 Lesson 7. Reese Haywood Ayan Paul FORTRAN 77 Lesson 7 Reese Haywood Ayan Paul 1 Numerical Integration A general all purpose Numerical Integration technique is the Trapezoidal Method. For most functions, this method is fast and accurate.

More information

Integration of Ordinary Differential Equations

Integration of Ordinary Differential Equations Integration of Ordinary Differential Equations Com S 477/577 Nov 7, 00 1 Introduction The solution of differential equations is an important problem that arises in a host of areas. Many differential equations

More information

Ordinary Differential Equations

Ordinary Differential Equations Ordinary Differential Equations We call Ordinary Differential Equation (ODE) of nth order in the variable x, a relation of the kind: where L is an operator. If it is a linear operator, we call the equation

More information

Computational Techniques Prof. Dr. Niket Kaisare Department of Chemical Engineering Indian Institute of Technology, Madras

Computational Techniques Prof. Dr. Niket Kaisare Department of Chemical Engineering Indian Institute of Technology, Madras Computational Techniques Prof. Dr. Niket Kaisare Department of Chemical Engineering Indian Institute of Technology, Madras Module No. # 07 Lecture No. # 04 Ordinary Differential Equations (Initial Value

More information

Lecture 7 - Separable Equations

Lecture 7 - Separable Equations Lecture 7 - Separable Equations Separable equations is a very special type of differential equations where you can separate the terms involving only y on one side of the equation and terms involving only

More information

Notes on numerical solution of differential equations

Notes on numerical solution of differential equations Notes on numerical solution of differential equations Some definitions, for those who don t know: A differential equation is any equation that relates a thing to its derivatives. For instance, Newton s

More information

Fourth Order RK-Method

Fourth Order RK-Method Fourth Order RK-Method The most commonly used method is Runge-Kutta fourth order method. The fourth order RK-method is y i+1 = y i + 1 6 (k 1 + 2k 2 + 2k 3 + k 4 ), Ordinary Differential Equations (ODE)

More information

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Part 6 Chapter 20 Initial-Value Problems PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction

More information

Numerical Methods for Ordinary Differential Equations

Numerical Methods for Ordinary Differential Equations Numerical Methods for Ordinary Differential Equations By Brian D. Storey 1. Introduction Differential equations can describe nearly all systems undergoing change. They are ubiquitous is science and engineering

More information

Computers, Lies and the Fishing Season

Computers, Lies and the Fishing Season 1/47 Computers, Lies and the Fishing Season Liz Arnold May 21, 23 Introduction Computers, lies and the fishing season takes a look at computer software programs. As mathematicians, we depend on computers

More information

Ordinary Differential Equations

Ordinary Differential Equations Chapter 7 Ordinary Differential Equations Differential equations are an extremely important tool in various science and engineering disciplines. Laws of nature are most often expressed as different equations.

More information

USING THE EXCEL CHART WIZARD TO CREATE CURVE FITS (DATA ANALYSIS).

USING THE EXCEL CHART WIZARD TO CREATE CURVE FITS (DATA ANALYSIS). USING THE EXCEL CHART WIZARD TO CREATE CURVE FITS (DATA ANALYSIS). Note to physics students: Even if this tutorial is not given as an assignment, you are responsible for knowing the material contained

More information

Consistency and Convergence

Consistency and Convergence Jim Lambers MAT 77 Fall Semester 010-11 Lecture 0 Notes These notes correspond to Sections 1.3, 1.4 and 1.5 in the text. Consistency and Convergence We have learned that the numerical solution obtained

More information

Physics 299: Computational Physics II Project II

Physics 299: Computational Physics II Project II Physics 99: Computational Physics II Project II Due: Feb 01 Handed out: 6 Jan 01 This project begins with a description of the Runge-Kutta numerical integration method, and then describes a project to

More information

Ordinary Differential equations

Ordinary Differential equations Chapter 1 Ordinary Differential equations 1.1 Introduction to Ordinary Differential equation In mathematics, an ordinary differential equation (ODE) is an equation which contains functions of only one

More information

Lecture 4: Numerical solution of ordinary differential equations

Lecture 4: Numerical solution of ordinary differential equations Lecture 4: Numerical solution of ordinary differential equations Department of Mathematics, ETH Zürich General explicit one-step method: Consistency; Stability; Convergence. High-order methods: Taylor

More information

NUMERICAL SOLUTION OF ODE IVPs. Overview

NUMERICAL SOLUTION OF ODE IVPs. Overview NUMERICAL SOLUTION OF ODE IVPs 1 Quick review of direction fields Overview 2 A reminder about and 3 Important test: Is the ODE initial value problem? 4 Fundamental concepts: Euler s Method 5 Fundamental

More information

Ordinary Differential Equations II

Ordinary Differential Equations II Ordinary Differential Equations II CS 205A: Mathematical Methods for Robotics, Vision, and Graphics Justin Solomon CS 205A: Mathematical Methods Ordinary Differential Equations II 1 / 29 Almost Done! No

More information

Ordinary Differential Equations II

Ordinary Differential Equations II Ordinary Differential Equations II CS 205A: Mathematical Methods for Robotics, Vision, and Graphics Justin Solomon CS 205A: Mathematical Methods Ordinary Differential Equations II 1 / 33 Almost Done! Last

More information

AIMS Exercise Set # 1

AIMS Exercise Set # 1 AIMS Exercise Set #. Determine the form of the single precision floating point arithmetic used in the computers at AIMS. What is the largest number that can be accurately represented? What is the smallest

More information

Differential Equations

Differential Equations Differential Equations Overview of differential equation! Initial value problem! Explicit numeric methods! Implicit numeric methods! Modular implementation Physics-based simulation An algorithm that

More information

1 Ordinary differential equations

1 Ordinary differential equations Numerical Analysis Seminar Frühjahrssemester 08 Lecturers: Prof. M. Torrilhon, Prof. D. Kressner The Störmer-Verlet method F. Crivelli (flcrivel@student.ethz.ch May 8, 2008 Introduction During this talk

More information

Advanced Partial Differential Equations with Applications

Advanced Partial Differential Equations with Applications MIT OpenCourseWare http://ocw.mit.edu 8.36 Advanced Partial Differential Equations with Applications Fall 9 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

More information

1 Functions, Graphs and Limits

1 Functions, Graphs and Limits 1 Functions, Graphs and Limits 1.1 The Cartesian Plane In this course we will be dealing a lot with the Cartesian plane (also called the xy-plane), so this section should serve as a review of it and its

More information

A Study of the Thermal Properties of a One. Dimensional Lennard-Jones System

A Study of the Thermal Properties of a One. Dimensional Lennard-Jones System A Study of the Thermal Properties of a One Dimensional Lennard-Jones System Abstract In this study, the behavior of a one dimensional (1D) Lennard-Jones (LJ) system is simulated. As part of this research,

More information

Math Numerical Analysis Homework #4 Due End of term. y = 2y t 3y2 t 3, 1 t 2, y(1) = 1. n=(b-a)/h+1; % the number of steps we need to take

Math Numerical Analysis Homework #4 Due End of term. y = 2y t 3y2 t 3, 1 t 2, y(1) = 1. n=(b-a)/h+1; % the number of steps we need to take Math 32 - Numerical Analysis Homework #4 Due End of term Note: In the following y i is approximation of y(t i ) and f i is f(t i,y i ).. Consider the initial value problem, y = 2y t 3y2 t 3, t 2, y() =.

More information

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Part 6 Chapter 20 Initial-Value Problems PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction

More information

The Definition and Numerical Method of Final Value Problem and Arbitrary Value Problem Shixiong Wang 1*, Jianhua He 1, Chen Wang 2, Xitong Li 1

The Definition and Numerical Method of Final Value Problem and Arbitrary Value Problem Shixiong Wang 1*, Jianhua He 1, Chen Wang 2, Xitong Li 1 The Definition and Numerical Method of Final Value Problem and Arbitrary Value Problem Shixiong Wang 1*, Jianhua He 1, Chen Wang 2, Xitong Li 1 1 School of Electronics and Information, Northwestern Polytechnical

More information

Numerical Methods in Physics and Astrophysics

Numerical Methods in Physics and Astrophysics Kostas Kokkotas 2 October 20, 2014 2 http://www.tat.physik.uni-tuebingen.de/ kokkotas Kostas Kokkotas 3 TOPICS 1. Solving nonlinear equations 2. Solving linear systems of equations 3. Interpolation, approximation

More information

16.1 Runge-Kutta Method

16.1 Runge-Kutta Method 704 Chapter 6. Integration of Ordinary Differential Equations CITED REFERENCES AND FURTHER READING: Gear, C.W. 97, Numerical Initial Value Problems in Ordinary Differential Equations (Englewood Cliffs,

More information

Ordinary Differential Equations (ODE)

Ordinary Differential Equations (ODE) Ordinary Differential Equations (ODE) Why study Differential Equations? Many physical phenomena are best formulated mathematically in terms of their rate of change. Motion of a swinging pendulum Bungee-jumper

More information

Systems of Linear ODEs

Systems of Linear ODEs P a g e 1 Systems of Linear ODEs Systems of ordinary differential equations can be solved in much the same way as discrete dynamical systems if the differential equations are linear. We will focus here

More information

Physics 584 Computational Methods

Physics 584 Computational Methods Physics 584 Computational Methods Introduction to Matlab and Numerical Solutions to Ordinary Differential Equations Ryan Ogliore April 18 th, 2016 Lecture Outline Introduction to Matlab Numerical Solutions

More information

MB4018 Differential equations

MB4018 Differential equations MB4018 Differential equations Part II http://www.staff.ul.ie/natalia/mb4018.html Prof. Natalia Kopteva Spring 2015 MB4018 (Spring 2015) Differential equations Part II 0 / 69 Section 1 Second-Order Linear

More information

Ordinary Differential Equations

Ordinary Differential Equations CHAPTER 8 Ordinary Differential Equations 8.1. Introduction My section 8.1 will cover the material in sections 8.1 and 8.2 in the book. Read the book sections on your own. I don t like the order of things

More information

Numerical Methods - Initial Value Problems for ODEs

Numerical Methods - Initial Value Problems for ODEs Numerical Methods - Initial Value Problems for ODEs Y. K. Goh Universiti Tunku Abdul Rahman 2013 Y. K. Goh (UTAR) Numerical Methods - Initial Value Problems for ODEs 2013 1 / 43 Outline 1 Initial Value

More information

Solutions Definition 2: a solution

Solutions Definition 2: a solution Solutions As was stated before, one of the goals in this course is to solve, or find solutions of differential equations. In the next definition we consider the concept of a solution of an ordinary differential

More information

Numerical Methods in Physics and Astrophysics

Numerical Methods in Physics and Astrophysics Kostas Kokkotas 2 October 17, 2017 2 http://www.tat.physik.uni-tuebingen.de/ kokkotas Kostas Kokkotas 3 TOPICS 1. Solving nonlinear equations 2. Solving linear systems of equations 3. Interpolation, approximation

More information

Numerical solution of ODEs

Numerical solution of ODEs Numerical solution of ODEs Arne Morten Kvarving Department of Mathematical Sciences Norwegian University of Science and Technology November 5 2007 Problem and solution strategy We want to find an approximation

More information

Scientific Computing: An Introductory Survey

Scientific Computing: An Introductory Survey Scientific Computing: An Introductory Survey Chapter 9 Initial Value Problems for Ordinary Differential Equations Prof. Michael T. Heath Department of Computer Science University of Illinois at Urbana-Champaign

More information

Numerical Analysis Exam with Solutions

Numerical Analysis Exam with Solutions Numerical Analysis Exam with Solutions Richard T. Bumby Fall 000 June 13, 001 You are expected to have books, notes and calculators available, but computers of telephones are not to be used during the

More information

INTRODUCTION TO COMPUTER METHODS FOR O.D.E.

INTRODUCTION TO COMPUTER METHODS FOR O.D.E. INTRODUCTION TO COMPUTER METHODS FOR O.D.E. 0. Introduction. The goal of this handout is to introduce some of the ideas behind the basic computer algorithms to approximate solutions to differential equations.

More information

Physics I: Oscillations and Waves Prof. S. Bharadwaj Department of Physics and Meteorology. Indian Institute of Technology, Kharagpur

Physics I: Oscillations and Waves Prof. S. Bharadwaj Department of Physics and Meteorology. Indian Institute of Technology, Kharagpur Physics I: Oscillations and Waves Prof. S. Bharadwaj Department of Physics and Meteorology Indian Institute of Technology, Kharagpur Lecture No 03 Damped Oscillator II We were discussing, the damped oscillator

More information

Computational Astrophysics

Computational Astrophysics Computational Astrophysics Lecture 1: Introduction to numerical methods Lecture 2: The SPH formulation Lecture 3: Construction of SPH smoothing functions Lecture 4: SPH for general dynamic flow Lecture

More information

Euler s Method, Taylor Series Method, Runge Kutta Methods, Multi-Step Methods and Stability.

Euler s Method, Taylor Series Method, Runge Kutta Methods, Multi-Step Methods and Stability. Euler s Method, Taylor Series Method, Runge Kutta Methods, Multi-Step Methods and Stability. REVIEW: We start with the differential equation dy(t) dt = f (t, y(t)) (1.1) y(0) = y 0 This equation can be

More information

Ordinary Differential Equations (ODEs)

Ordinary Differential Equations (ODEs) Ordinary Differential Equations (ODEs) 1 Computer Simulations Why is computation becoming so important in physics? One reason is that most of our analytical tools such as differential calculus are best

More information

Infinite series, improper integrals, and Taylor series

Infinite series, improper integrals, and Taylor series Chapter 2 Infinite series, improper integrals, and Taylor series 2. Introduction to series In studying calculus, we have explored a variety of functions. Among the most basic are polynomials, i.e. functions

More information

Intersection of Ellipsoids

Intersection of Ellipsoids Intersection of Ellipsoids David Eberly, Geometric Tools, Redmond WA 9805 https://www.geometrictools.com/ This work is licensed under the Creative Commons Attribution 4.0 International License. To view

More information

Fundamentals Physics

Fundamentals Physics Fundamentals Physics And Differential Equations 1 Dynamics Dynamics of a material point Ideal case, but often sufficient Dynamics of a solid Including rotation, torques 2 Position, Velocity, Acceleration

More information

Euler s Method and Logistic Growth (BC Only)

Euler s Method and Logistic Growth (BC Only) Euler s Method Students should be able to: Approximate numerical solutions of differential equations using Euler s method without a calculator. Recognize the method as a recursion formula extension of

More information

MTH210 DIFFERENTIAL EQUATIONS. Dr. Gizem SEYHAN ÖZTEPE

MTH210 DIFFERENTIAL EQUATIONS. Dr. Gizem SEYHAN ÖZTEPE MTH210 DIFFERENTIAL EQUATIONS Dr. Gizem SEYHAN ÖZTEPE 1 References Logan, J. David. A first course in differential equations. Springer, 2015. Zill, Dennis G. A first course in differential equations with

More information

Physics 202 Laboratory 3. Root-Finding 1. Laboratory 3. Physics 202 Laboratory

Physics 202 Laboratory 3. Root-Finding 1. Laboratory 3. Physics 202 Laboratory Physics 202 Laboratory 3 Root-Finding 1 Laboratory 3 Physics 202 Laboratory The fundamental question answered by this week s lab work will be: Given a function F (x), find some/all of the values {x i }

More information

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 9

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 9 Lecture Notes to Accompany Scientific Computing An Introductory Survey Second Edition by Michael T. Heath Chapter 9 Initial Value Problems for Ordinary Differential Equations Copyright c 2001. Reproduction

More information

Ordinary Differential Equations I

Ordinary Differential Equations I Ordinary Differential Equations I CS 205A: Mathematical Methods for Robotics, Vision, and Graphics Doug James (and Justin Solomon) CS 205A: Mathematical Methods Ordinary Differential Equations I 1 / 35

More information

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Part 5 Chapter 21 Numerical Differentiation PowerPoints organized by Dr. Michael R. Gustafson II, Duke University 1 All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction

More information

Notes for Expansions/Series and Differential Equations

Notes for Expansions/Series and Differential Equations Notes for Expansions/Series and Differential Equations In the last discussion, we considered perturbation methods for constructing solutions/roots of algebraic equations. Three types of problems were illustrated

More information

Applied Math for Engineers

Applied Math for Engineers Applied Math for Engineers Ming Zhong Lecture 15 March 28, 2018 Ming Zhong (JHU) AMS Spring 2018 1 / 28 Recap Table of Contents 1 Recap 2 Numerical ODEs: Single Step Methods 3 Multistep Methods 4 Method

More information

Integration of Differential Equations

Integration of Differential Equations Integration of Differential Equations Gabriel S. Cabrera August 4, 018 Contents 1 Introduction 1 Theory.1 Linear 1 st Order ODEs................................. 3.1.1 Analytical Solution...............................

More information

Solving PDEs with PGI CUDA Fortran Part 4: Initial value problems for ordinary differential equations

Solving PDEs with PGI CUDA Fortran Part 4: Initial value problems for ordinary differential equations Solving PDEs with PGI CUDA Fortran Part 4: Initial value problems for ordinary differential equations Outline ODEs and initial conditions. Explicit and implicit Euler methods. Runge-Kutta methods. Multistep

More information

Math From Scratch Lesson 28: Rational Exponents

Math From Scratch Lesson 28: Rational Exponents Math From Scratch Lesson 28: Rational Exponents W. Blaine Dowler October 8, 2012 Contents 1 Exponent Review 1 1.1 x m................................. 2 x 1.2 n x................................... 2 m

More information

Runge Kutta Behavior in the Presence of a Jump Discontinuity

Runge Kutta Behavior in the Presence of a Jump Discontinuity Runge Kutta Behavior in the Presence of a Jump Discontinuity Allen Back July, 5 The graphs below appear to show motion at constant speed v = 4 along a straight line They were generated by numerical integration

More information

Chapter 9b: Numerical Methods for Calculus and Differential Equations. Initial-Value Problems Euler Method Time-Step Independence MATLAB ODE Solvers

Chapter 9b: Numerical Methods for Calculus and Differential Equations. Initial-Value Problems Euler Method Time-Step Independence MATLAB ODE Solvers Chapter 9b: Numerical Methods for Calculus and Differential Equations Initial-Value Problems Euler Method Time-Step Independence MATLAB ODE Solvers Acceleration Initial-Value Problems Consider a skydiver

More information

ODEs. PHY 688: Numerical Methods for (Astro)Physics

ODEs. PHY 688: Numerical Methods for (Astro)Physics ODEs ODEs ODEs arise in many physics problems Classifications: As with the other topics, there are a large number of different methods Initial value problems Boundary value problems Eigenvalue problems

More information

e x = 1 + x + x2 2! + x3 If the function f(x) can be written as a power series on an interval I, then the power series is of the form

e x = 1 + x + x2 2! + x3 If the function f(x) can be written as a power series on an interval I, then the power series is of the form Taylor Series Given a function f(x), we would like to be able to find a power series that represents the function. For example, in the last section we noted that we can represent e x by the power series

More information

Possible commensurabilities among pairs of extrasolar planets

Possible commensurabilities among pairs of extrasolar planets Mon. Not. R. Astron. Soc. 333, L26 L30 (2002) Possible commensurabilities among pairs of extrasolar planets Richard P. Nelson P and John C. B. Papaloizou Astronomy Unit, Queen Mary, University of London,

More information

Math 216 Final Exam 14 December, 2012

Math 216 Final Exam 14 December, 2012 Math 216 Final Exam 14 December, 2012 This sample exam is provided to serve as one component of your studying for this exam in this course. Please note that it is not guaranteed to cover the material that

More information

Chapter 6 - Ordinary Differential Equations

Chapter 6 - Ordinary Differential Equations Chapter 6 - Ordinary Differential Equations 7.1 Solving Initial-Value Problems In this chapter, we will be interested in the solution of ordinary differential equations. Ordinary differential equations

More information

ODEs. PHY 688: Numerical Methods for (Astro)Physics

ODEs. PHY 688: Numerical Methods for (Astro)Physics ODEs ODEs ODEs arise in many physics problems Classifications: As with the other topics, there are a large number of different methods Initial value problems Boundary value problems Eigenvalue problems

More information

ESTIMATING THE ATTRACTOR DIMENSION OF THE EQUATORIAL WEATHER SYSTEM M. Leok B.T.

ESTIMATING THE ATTRACTOR DIMENSION OF THE EQUATORIAL WEATHER SYSTEM M. Leok B.T. This paper was awarded in the I International Competition (99/9) First Step to Nobel Prize in Physics and published in the competition proceedings (Acta Phys. Pol. A 8 Supplement, S- (99)). The paper is

More information

Marching on the BL equations

Marching on the BL equations Marching on the BL equations Harvey S. H. Lam February 10, 2004 Abstract The assumption is that you are competent in Matlab or Mathematica. White s 4-7 starting on page 275 shows us that all generic boundary

More information

Numerical differentiation

Numerical differentiation Numerical differentiation Paul Seidel 1801 Lecture Notes Fall 011 Suppose that we have a function f(x) which is not given by a formula but as a result of some measurement or simulation (computer experiment)

More information

High performance computing and numerical modeling

High performance computing and numerical modeling High performance computing and numerical modeling Volker Springel Plan for my lectures Lecture 1: Collisional and collisionless N-body dynamics Lecture 2: Gravitational force calculation Lecture 3: Basic

More information

Computational Problem: Keplerian Orbits

Computational Problem: Keplerian Orbits Computational Problem: Keplerian Orbits April 10, 2006 1 Part 1 1.1 Problem For the case of an infinite central mass and an orbiting test mass, integrate a circular orbit and an eccentric orbit. Carry

More information

CS 450 Numerical Analysis. Chapter 9: Initial Value Problems for Ordinary Differential Equations

CS 450 Numerical Analysis. Chapter 9: Initial Value Problems for Ordinary Differential Equations Lecture slides based on the textbook Scientific Computing: An Introductory Survey by Michael T. Heath, copyright c 2018 by the Society for Industrial and Applied Mathematics. http://www.siam.org/books/cl80

More information

Potential/density pairs and Gauss s law

Potential/density pairs and Gauss s law Potential/density pairs and Gauss s law We showed last time that the motion of a particle in a cluster will evolve gradually, on the relaxation time scale. This time, however, is much longer than the typical

More information

Differential Equations

Differential Equations Differential Equations Definitions Finite Differences Taylor Series based Methods: Euler Method Runge-Kutta Methods Improved Euler, Midpoint methods Runge Kutta (2nd, 4th order) methods Predictor-Corrector

More information

Numerov s Method for Approximating Solutions to Poisson s Equation

Numerov s Method for Approximating Solutions to Poisson s Equation Numerov s Method for Approximating Solutions to Poisson s Equation Matthew S. Norton February 20, 2009 Abstract In this paper, a computational approach is taken in trying to solve Poisson s equation. Poisson

More information

CS520: numerical ODEs (Ch.2)

CS520: numerical ODEs (Ch.2) .. CS520: numerical ODEs (Ch.2) Uri Ascher Department of Computer Science University of British Columbia ascher@cs.ubc.ca people.cs.ubc.ca/ ascher/520.html Uri Ascher (UBC) CPSC 520: ODEs (Ch. 2) Fall

More information

2tdt 1 y = t2 + C y = which implies C = 1 and the solution is y = 1

2tdt 1 y = t2 + C y = which implies C = 1 and the solution is y = 1 Lectures - Week 11 General First Order ODEs & Numerical Methods for IVPs In general, nonlinear problems are much more difficult to solve than linear ones. Unfortunately many phenomena exhibit nonlinear

More information

Practical in Numerical Astronomy, SS 2012 LECTURE 9

Practical in Numerical Astronomy, SS 2012 LECTURE 9 Practical in Numerical Astronomy, SS 01 Elliptic partial differential equations. Poisson solvers. LECTURE 9 1. Gravity force and the equations of hydrodynamics. Poisson equation versus Poisson integral.

More information

Numerical Algorithms for ODEs/DAEs (Transient Analysis)

Numerical Algorithms for ODEs/DAEs (Transient Analysis) Numerical Algorithms for ODEs/DAEs (Transient Analysis) Slide 1 Solving Differential Equation Systems d q ( x(t)) + f (x(t)) + b(t) = 0 dt DAEs: many types of solutions useful DC steady state: state no

More information

Math 122 Fall Handout 15: Review Problems for the Cumulative Final Exam

Math 122 Fall Handout 15: Review Problems for the Cumulative Final Exam Math 122 Fall 2008 Handout 15: Review Problems for the Cumulative Final Exam The topics that will be covered on Final Exam are as follows. Integration formulas. U-substitution. Integration by parts. Integration

More information