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

Size: px
Start display at page:

Download "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"

Transcription

1 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() =. (a) (b) The exact solution to () is y(t) = t 2 +3ln(t). (a) Approximate the solution to () using Euler s method with h =.2 and h =.. Verify that the global error is O(h). Here is my code for Euler s method, function y=euler(f,a,b,h,y) n=(b-a)/h+; % the number of steps we need to take y=zeros(n,); % reserve space for the solution xi=a; % start at a with y(a)=y y()=y; % This is the Euler loop for i=2:n y(i,:)=y(i-)+h*feval(f,xi,y(i-)); xi=xi+h; Here is a graph of the two solutions and a graph of the two error functions. You can see from the graph that the error goes down by a factor of one half when we halve the step size Solution line 2 line

2 .2 Error line (b) Approximate the solution to () using Taylor s method of order 2 with h =.2 and h =.. Verify that the global error is O(h 2 ). When we use a Taylor method, we must find the Taylor polynomial for each problem. Since this is a 2 nd order method, we only need to find d dt (f(t,y(t))) = d ( ) 2y dt t 3y2 t 3, ( 2y = 2y ) t t 2 3yy t 3 + 9y2 t 4, ( 2 = t 3y )( ) ( 2y t 3 t 3y2 ) 9y 2 t 3 + t 4 2y ) t 2. We can sub the above expression into the formula for T (2), T (2) (t,y) = f(t,y)+ h d 2 dt f(t,y(t)), ( ) 2y = t 3y2 t 3 + h 2 (( 2 t 3y t 3 )( ) ( 2y t 3y2 9y 2 t 3 + t 4 2y )) t 2. Now we can plug this into the Taylor method. Here is a listing of my code for Taylor s Method of order 2 and the function I pass, function y=tay2(h,t,a,b,y) n=(b-a)/h+; y=zeros(n,); y()=y; t=a; for i=:(n-) y(i+)=y(i)+h*feval(t,t,y(i),h); t=t+h; 2

3 function f=t3(t,y,h) tmp=2*y/t-3*y^2/t^3; tmp2=tmp*(2/t-6*y/t^3)-2*y/t^2+9*y^2/t^4; f=tmp+h/2*tmp2; Note that I have reused the value of f(t,y) this saves on computations and also makes it easier to debug. Here is a graph of the two solutions obtained using Taylor s method. Note the difference between the second order and first order methods line 2 line 3 line 4 line 5 line Here is a graph of the error for both methods. You can see that the error is reduced by a factor of 4 when we halve the step size line e

4 2. Construct a 3-step method to solve the ODE, of the form, y = f(t,y), y() = α, y(h) = α, y(2h) = α 2, y i+ = y i 2 +b f i 2 +b f i +b 2 f i. Here f i = f(t i,y i ). Construct the method by considering a polynomial interpolating f(t,y(t)) at the points t i 2,t i,t i and using this polynomial to find an approximation of the following form, 3h To construct this method, we will use, f(t,y(t))dt = b f i 2 +b f i +b 2 f i + y(t i+ ) y(t i 2 ) = ti+ t i 2 f(t,y)dt. To form the approximation, we will let P(t) be the quadratic that goes through the points (t i 2,f i 2 ), (t i,f i ) and (t i,f i ). The method will then be given by, ti+ w i+ = w i 2 + P(t)dt. t i 2 All we need to do is find P(t) and evaluate the integral. We construct P(t) using Lagrangian interpolation. In this form P is given by, P(t) = (t t i )(t t i ) f i 2 2h 2 (t t i)(t t i 2 ) f i h 2 +(t t i 2 )(t t i ) f i 2h 2. Now we need to evaluate t i+ t i 2 P(t)dt. To simplify the integration, we will use the substitution x = t t i 2. We then get, ti+ t i 2 P(t)dt = f i 2 2h 2 3h (x 2h)(x h)dx f i h 2 3h x(x 2h)dx+ f i 2h 2 3h x(x h)dx After solving the above integrals and subbing back into the method, we find the approximation is given by, w i+ = w i 2 + h 4 (3f i 2 +9f i ). 3. A chemical reaction is modeled by the differential equation, dx (n dt = K x ) 2 ( n 2 x ) ( 2 n 3 3x ) 3, where K is the rate constant of the reaction, the n i s are the initial amounts of reactant and x is the amount of product. If K = M 6 s, n = n 2 = M and n 3 = 5M, how many moles of product have been formed after two seconds? Use both Runge-Kutta 4 th order method with h =. and the Midpoint method with h =.5. Both methods require the same number of function evaluations to approximate x(2). Which method do you think is providing the most accurate solution? Why? Here is a listing of the midpoint code: function y=rk2(f,a,b,y,h) n=(b-a)/h+; y=zeros(n,); t=a; 4

5 y()=y; for i=2:n K=h*feval(f,t,y(i-)); y(i)=y(i-)+h*feval(f,t+h/2,y(i-)+k/2); t=t+h; Here is the Runge-Kutta 4 th order code: function y=rk4(f,a,b,y,h) n=(b-a)/h+; y=zeros(n,); t=a; y()=y; for i=2:n K=h*feval(f,t,y(i-)); K2=h*feval(f,t+h/2,y(i-)+K/2); K3=h*feval(f,t+h/2,y(i-)+K2/2); K4=h*feval(f,t+h,y(i-)+K3); y(i)=y(i-)+(k+2*k2+2*k3+k4)/6; t=t+h; The code for the function: function f=f3(t,y) K=6.22e-9; n=; n2=; n3=5; f=k*(n-y/2)^2*(n2-y/2)^2*(n3-3*y/4)^3; The output from Octave: octave:29> y=rk2( f3,,2,,.5); octave:3> y2=rk4( f3,,2,,.); octave:3> t=:.5:2; octave:32> t2=:.:2; octave:33> plot(t,y); octave:34> hold on octave:35> plot(t2,y2); octave:36> y(max(size(y))) ans = octave:37> y2(max(size(y2))) ans = octave:38> diary off So using the Midpoint method, we have x(2) Using the 4 th order Runge-Kutta method, we get x(2)

6 8 line The two solution plots from Octave. The difference between the two approximations cannot be seen from the graph. Now which approximation is more accurate? We have a higher order method with a larger step size and a lower order method with a smaller step size. It is not possible to say for certain which approximation is more accurate. However, since The midpoint method is O(h 2 ), we do know that the error is given by, The error for the 4 th order Runge-Kutta method is given by, e = C h 2 = C (.5) 2 = C (.25). (2) e = C 2 h 4 = C 2 (.) 4 = C 2 (.). (3) We do not know the constants C and C 2. We do know that if C 2 < 25C then the error for the 4 th order method will be smaller. This is very likely. 4. The family of implicit multi-step methods, know as backward difference formula or BDF methods, is given by, w = α, w = α,,w m = α m, w i+ = a w i +a 2 w i + +a m w i (m ) +hb f i+. To make an m-step BDF method, we construct a polynomial, P(t), which interpolates the points (t i+,y i+ ), (t i,y i ),...,(t i (m ),y i (m ) ). We then use the approximation, P (t i+ ) = f i+. Solving for w i+ from P (t i+ ) = f i+ gives us our method. These implicit methods have very nice stability properties as we will see later. Find the second order BDF method by constructing the polynomial P(t) which interpolates (t i+,y i+ ), (t i,y i ) and (t i,y i ) and equating P (t i+ ) = f i+. We begin by constructing the polynomial P(t). We have 3 points, so P(t) will be a quadratic in general. As this step is similar to previous work, I will just give P, P(t) = (t t i+ )(t t i ) w i 2h 2 (t t i+)(t t i ) w i h 2 +(t t i)(t t i ) w i+ 2h 2. Now we differentiate P, Finally, P (t) = (t t i+ +t t i ) w i 2h 2 (t t i+ +t t i ) w i h 2 +(t t i +t t i ) w i+ 2h 2. P (t i+ ) = h w i 2h 2 2hw i h 2 +3hw i+ 2h 2, = w i 2h 2w i h + 3w i+ 2h. 6

7 Now all we need to do is set P (t i+ ) = f i+ and solve for w i+. f i+ = w i 2h 2w i h + 3w i+ 2h, w i+ = 4 3 w i 3 w i +h 2 3 f i+. The above equation defines the second order BDF method. 5. Find and plot the region of absolute stability for the following methods: 2-step Adams-Bashford This is done in the notes. 2-step Adams-Moulton We solve for hλ and get, Plotting, as in the notes, results in the following stability region. z 2 z hλ = 5 5 z z. (4) We must determine if the region of stability is inside the closed region or outside. If we let z = 2 in (4) then we find hλ = This is outside the closed region. Since z = 2 corresponds to an unstable method, the region outside must be the unstable region. Hence the stable region is inside the closed loop. 2-step BDF (Make sure you choose the right region) Using question and solving for hλ, we find, Plotting the region results in, hλ = 3(z2 4 3 z + 3 ) 2z 2. (5) 7

8 Again we must determine which region of the complex plain corresponds to the stable region. Using z = 2 in (5), we find hλ = 5 8. Hence the unstable region is inside the closed curve. It would appear that the 2 nd -order BDF method is A-stable. In the text and in class I have said that the only A-stable methods are Forward Euler and Trapezoidal. Our results seems to contradict this, however if you can zoom in around, you will find that the unstable region does enter the negative half plane slightly above and below on the complex axis. BDF methods (only order 2 to 6) have the entire negative real axis within their stability regions. It is this property which makes them very popular for stiff problems. I will demonstrate how to plot these regions in the notes. 6. Write a subroutine which solves an initial value problem using the two-step Adams-Bashford method. You may use the mid-point subroutine from the last assignment to bootstrap the method. Apply the method to the following problem. y = 2y, y() =, t, (6) with time steps h =. and h =.25. Plot the two solutions and comment on the results. Here is a listing of the subroutine I used to solve this problem. The rk2 refers to the midpoint subroutine from homework 2. A listing of rk2 is included in the solutions to HW2. function y=ab2(f,a,b,y,h) n=(b-a)/h+; % number of steps y=rk2(f,a,a+h,y,h); % I am boot strapping the system % using the midpoint method % this returns a vector with y() and y(2) t=a+2*h; % We start here since the first two time steps are done y=[y ; zeros(n-2,)]; % I am reserving space for the rest of the solution fi=feval(f,a+h,y(2)); % The first function value used in the loop fim=feval(f,a,y()); % The second function value used in the loop for i=2:n- y(i+)=y(i)+h/2*(3*fi-fim); % Next value of y 8

9 t=t+h; fim=fi; % this is f_i fi=feval(f,t,y(i+)); % f_{i-} Running the above code for our problem with h =. produces the following solution The exact solution is given by y = e 2t. As you can see, our approximation is dreadful. This is to be expected. From the first question 2, we can see that if λ is real, < hλ < to be in the stable region. For this problem, λ = 2, so we need h < 2 =.5. With h =. we are well outside the stability region and can expect poor results. If we set h =.25, we are inside the stability region and we should expect reasonable results. The following approximation is quite reasonable

10 We define h max as the largest time step which can be used on this problem which results in an A-stable approximation for a chosen method. Give h max for each of the methods considered in question 5. I have already discussed the Adams-Bashforth method. We just need to look at the stability diagrams found in question 2. For the Addams-Moulton, we will need 2h < 6 or h <.3. This is much better than the Addams-Basho-rd. For the BDF method, we have no restriction. We may set h as large as we like and the only loss of accuracy will be due to truncation error.

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

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

Numerical Differential Equations: IVP

Numerical Differential Equations: IVP Chapter 11 Numerical Differential Equations: IVP **** 4/16/13 EC (Incomplete) 11.1 Initial Value Problem for Ordinary Differential Equations We consider the problem of numerically solving a differential

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

MTH 452/552 Homework 3

MTH 452/552 Homework 3 MTH 452/552 Homework 3 Do either 1 or 2. 1. (40 points) [Use of ode113 and ode45] This problem can be solved by a modifying the m-files odesample.m and odesampletest.m available from the author s webpage.

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

Multistage Methods I: Runge-Kutta Methods

Multistage Methods I: Runge-Kutta Methods Multistage Methods I: Runge-Kutta Methods Varun Shankar January, 0 Introduction Previously, we saw that explicit multistep methods (AB methods) have shrinking stability regions as their orders are increased.

More information

Module 4: Numerical Methods for ODE. Michael Bader. Winter 2007/2008

Module 4: Numerical Methods for ODE. Michael Bader. Winter 2007/2008 Outlines Module 4: for ODE Part I: Basic Part II: Advanced Lehrstuhl Informatik V Winter 2007/2008 Part I: Basic 1 Direction Fields 2 Euler s Method Outlines Part I: Basic Part II: Advanced 3 Discretized

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

You may not use your books, notes; calculators are highly recommended.

You may not use your books, notes; calculators are highly recommended. Math 301 Winter 2013-14 Midterm 1 02/06/2014 Time Limit: 60 Minutes Name (Print): Instructor This exam contains 8 pages (including this cover page) and 6 problems. Check to see if any pages are missing.

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

Jim Lambers MAT 772 Fall Semester Lecture 21 Notes

Jim Lambers MAT 772 Fall Semester Lecture 21 Notes Jim Lambers MAT 772 Fall Semester 21-11 Lecture 21 Notes These notes correspond to Sections 12.6, 12.7 and 12.8 in the text. Multistep Methods All of the numerical methods that we have developed for solving

More information

Numerical methods for solving ODEs

Numerical methods for solving ODEs Chapter 2 Numerical methods for solving ODEs We will study two methods for finding approximate solutions of ODEs. Such methods may be used for (at least) two reasons the ODE does not have an exact solution

More information

Math 128A Spring 2003 Week 12 Solutions

Math 128A Spring 2003 Week 12 Solutions Math 128A Spring 2003 Week 12 Solutions Burden & Faires 5.9: 1b, 2b, 3, 5, 6, 7 Burden & Faires 5.10: 4, 5, 8 Burden & Faires 5.11: 1c, 2, 5, 6, 8 Burden & Faires 5.9. Higher-Order Equations and Systems

More information

Multistep Methods for IVPs. t 0 < t < T

Multistep Methods for IVPs. t 0 < t < T Multistep Methods for IVPs We are still considering the IVP dy dt = f(t,y) t 0 < t < T y(t 0 ) = y 0 So far we have looked at Euler s method, which was a first order method and Runge Kutta (RK) methods

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

Numerical Methods for Differential Equations

Numerical Methods for Differential Equations Numerical Methods for Differential Equations Chapter 2: Runge Kutta and Linear Multistep methods Gustaf Söderlind and Carmen Arévalo Numerical Analysis, Lund University Textbooks: A First Course in the

More information

Linear Multistep Methods I: Adams and BDF Methods

Linear Multistep Methods I: Adams and BDF Methods Linear Multistep Methods I: Adams and BDF Methods Varun Shankar January 1, 016 1 Introduction In our review of 5610 material, we have discussed polynomial interpolation and its application to generating

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

COSC 3361 Numerical Analysis I Ordinary Differential Equations (II) - Multistep methods

COSC 3361 Numerical Analysis I Ordinary Differential Equations (II) - Multistep methods COSC 336 Numerical Analysis I Ordinary Differential Equations (II) - Multistep methods Fall 2005 Repetition from the last lecture (I) Initial value problems: dy = f ( t, y) dt y ( a) = y 0 a t b Goal:

More information

Numerical Methods for Differential Equations

Numerical Methods for Differential Equations Numerical Methods for Differential Equations Chapter 2: Runge Kutta and Multistep Methods Gustaf Söderlind Numerical Analysis, Lund University Contents V4.16 1. Runge Kutta methods 2. Embedded RK methods

More information

Numerical Methods for the Solution of Differential Equations

Numerical Methods for the Solution of Differential Equations Numerical Methods for the Solution of Differential Equations Markus Grasmair Vienna, winter term 2011 2012 Analytical Solutions of Ordinary Differential Equations 1. Find the general solution of the differential

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

multistep methods Last modified: November 28, 2017 Recall that we are interested in the numerical solution of the initial value problem (IVP):

multistep methods Last modified: November 28, 2017 Recall that we are interested in the numerical solution of the initial value problem (IVP): MATH 351 Fall 217 multistep methods http://www.phys.uconn.edu/ rozman/courses/m351_17f/ Last modified: November 28, 217 Recall that we are interested in the numerical solution of the initial value problem

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

Initial value problems for ordinary differential equations

Initial value problems for ordinary differential equations AMSC/CMSC 660 Scientific Computing I Fall 2008 UNIT 5: Numerical Solution of Ordinary Differential Equations Part 1 Dianne P. O Leary c 2008 The Plan Initial value problems (ivps) for ordinary differential

More information

Part IB Numerical Analysis

Part IB Numerical Analysis Part IB Numerical Analysis Definitions Based on lectures by G. Moore Notes taken by Dexter Chua Lent 206 These notes are not endorsed by the lecturers, and I have modified them (often significantly) after

More information

Solving Ordinary Differential equations

Solving Ordinary Differential equations Solving Ordinary Differential equations Taylor methods can be used to build explicit methods with higher order of convergence than Euler s method. The main difficult of these methods is the computation

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

Scientific Computing with Case Studies SIAM Press, Lecture Notes for Unit V Solution of

Scientific Computing with Case Studies SIAM Press, Lecture Notes for Unit V Solution of Scientific Computing with Case Studies SIAM Press, 2009 http://www.cs.umd.edu/users/oleary/sccswebpage Lecture Notes for Unit V Solution of Differential Equations Part 1 Dianne P. O Leary c 2008 1 The

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

CHAPTER 5: Linear Multistep Methods

CHAPTER 5: Linear Multistep Methods CHAPTER 5: Linear Multistep Methods Multistep: use information from many steps Higher order possible with fewer function evaluations than with RK. Convenient error estimates. Changing stepsize or order

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

Ordinary differential equations - Initial value problems

Ordinary differential equations - Initial value problems Education has produced a vast population able to read but unable to distinguish what is worth reading. G.M. TREVELYAN Chapter 6 Ordinary differential equations - Initial value problems In this chapter

More information

Section 7.4 Runge-Kutta Methods

Section 7.4 Runge-Kutta Methods Section 7.4 Runge-Kutta Methods Key terms: Taylor methods Taylor series Runge-Kutta; methods linear combinations of function values at intermediate points Alternatives to second order Taylor methods Fourth

More information

Bindel, Fall 2011 Intro to Scientific Computing (CS 3220) Week 12: Monday, Apr 18. HW 7 is posted, and will be due in class on 4/25.

Bindel, Fall 2011 Intro to Scientific Computing (CS 3220) Week 12: Monday, Apr 18. HW 7 is posted, and will be due in class on 4/25. Logistics Week 12: Monday, Apr 18 HW 6 is due at 11:59 tonight. HW 7 is posted, and will be due in class on 4/25. The prelim is graded. An analysis and rubric are on CMS. Problem du jour For implicit methods

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

Initial-Value Problems for ODEs. Introduction to Linear Multistep Methods

Initial-Value Problems for ODEs. Introduction to Linear Multistep Methods Initial-Value Problems for ODEs Introduction to Linear Multistep Methods Numerical Analysis (9th Edition) R L Burden & J D Faires Beamer Presentation Slides prepared by John Carroll Dublin City University

More information

Chapter 10. Initial value Ordinary Differential Equations

Chapter 10. Initial value Ordinary Differential Equations Chapter 10 Initial value Ordinary Differential Equations Consider the problem of finding a function y(t) that satisfies the following ordinary differential equation (ODE): dy dt = f(t, y), a t b. The function

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

Ordinary differential equation II

Ordinary differential equation II Ordinary Differential Equations ISC-5315 1 Ordinary differential equation II 1 Some Basic Methods 1.1 Backward Euler method (implicit method) The algorithm looks like this: y n = y n 1 + hf n (1) In contrast

More information

4.4 Computing π, ln 2 and e

4.4 Computing π, ln 2 and e 252 4.4 Computing π, ln 2 and e The approximations π 3.1415927, ln 2 0.69314718, e 2.7182818 can be obtained by numerical methods applied to the following initial value problems: (1) y = 4, 1 + x2 y(0)

More information

Lecture IV: Time Discretization

Lecture IV: Time Discretization Lecture IV: Time Discretization Motivation Kinematics: continuous motion in continuous time Computer simulation: Discrete time steps t Discrete Space (mesh particles) Updating Position Force induces acceleration.

More information

2.29 Numerical Fluid Mechanics Fall 2011 Lecture 20

2.29 Numerical Fluid Mechanics Fall 2011 Lecture 20 2.29 Numerical Fluid Mechanics Fall 2011 Lecture 20 REVIEW Lecture 19: Finite Volume Methods Review: Basic elements of a FV scheme and steps to step-up a FV scheme One Dimensional examples d x j x j 1/2

More information

9.6 Predictor-Corrector Methods

9.6 Predictor-Corrector Methods SEC. 9.6 PREDICTOR-CORRECTOR METHODS 505 Adams-Bashforth-Moulton Method 9.6 Predictor-Corrector Methods The methods of Euler, Heun, Taylor, and Runge-Kutta are called single-step methods because they use

More information

Review Higher Order methods Multistep methods Summary HIGHER ORDER METHODS. P.V. Johnson. School of Mathematics. Semester

Review Higher Order methods Multistep methods Summary HIGHER ORDER METHODS. P.V. Johnson. School of Mathematics. Semester HIGHER ORDER METHODS School of Mathematics Semester 1 2008 OUTLINE 1 REVIEW 2 HIGHER ORDER METHODS 3 MULTISTEP METHODS 4 SUMMARY OUTLINE 1 REVIEW 2 HIGHER ORDER METHODS 3 MULTISTEP METHODS 4 SUMMARY OUTLINE

More information

Initial value problems for ordinary differential equations

Initial value problems for ordinary differential equations Initial value problems for ordinary differential equations Xiaojing Ye, Math & Stat, Georgia State University Spring 2019 Numerical Analysis II Xiaojing Ye, Math & Stat, Georgia State University 1 IVP

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

Chapter 5 Exercises. (a) Determine the best possible Lipschitz constant for this function over 2 u <. u (t) = log(u(t)), u(0) = 2.

Chapter 5 Exercises. (a) Determine the best possible Lipschitz constant for this function over 2 u <. u (t) = log(u(t)), u(0) = 2. Chapter 5 Exercises From: Finite Difference Methods for Ordinary and Partial Differential Equations by R. J. LeVeque, SIAM, 2007. http://www.amath.washington.edu/ rjl/fdmbook Exercise 5. (Uniqueness for

More information

Notes for Numerical Analysis Math 5466 by S. Adjerid Virginia Polytechnic Institute and State University (A Rough Draft) Contents Numerical Methods for ODEs 5. Introduction............................

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

Solving Ordinary Differential Equations

Solving Ordinary Differential Equations Solving Ordinary Differential Equations Sanzheng Qiao Department of Computing and Software McMaster University March, 2014 Outline 1 Initial Value Problem Euler s Method Runge-Kutta Methods Multistep Methods

More information

Math 660 Lecture 4: FDM for evolutionary equations: ODE solvers

Math 660 Lecture 4: FDM for evolutionary equations: ODE solvers Math 660 Lecture 4: FDM for evolutionary equations: ODE solvers Consider the ODE u (t) = f(t, u(t)), u(0) = u 0, where u could be a vector valued function. Any ODE can be reduced to a first order system,

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

Review. Numerical Methods Lecture 22. Prof. Jinbo Bi CSE, UConn

Review. Numerical Methods Lecture 22. Prof. Jinbo Bi CSE, UConn Review Taylor Series and Error Analysis Roots of Equations Linear Algebraic Equations Optimization Numerical Differentiation and Integration Ordinary Differential Equations Partial Differential Equations

More information

Differential equations and numerical methods / M.E. Mincsovics

Differential equations and numerical methods / M.E. Mincsovics General information: You can use any help possible when solving the programming tasks. Every correct answer is 5 points. Everybody has a number, you can find it in the first column of the table. Convert

More information

Lecture V: The game-engine loop & Time Integration

Lecture V: The game-engine loop & Time Integration Lecture V: The game-engine loop & Time Integration The Basic Game-Engine Loop Previous state: " #, %(#) ( #, )(#) Forces -(#) Integrate velocities and positions Resolve Interpenetrations Per-body change

More information

Lecture 8: Calculus and Differential Equations

Lecture 8: Calculus and Differential Equations Lecture 8: Calculus and Differential Equations Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE201: Computer Applications. See Textbook Chapter 9. Numerical Methods MATLAB provides

More information

Lecture 8: Calculus and Differential Equations

Lecture 8: Calculus and Differential Equations Lecture 8: Calculus and Differential Equations Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE21: Computer Applications. See Textbook Chapter 9. Numerical Methods MATLAB provides

More information

Graded Project #1. Part 1. Explicit Runge Kutta methods. Goals Differential Equations FMN130 Gustaf Söderlind and Carmen Arévalo

Graded Project #1. Part 1. Explicit Runge Kutta methods. Goals Differential Equations FMN130 Gustaf Söderlind and Carmen Arévalo 2008-11-07 Graded Project #1 Differential Equations FMN130 Gustaf Söderlind and Carmen Arévalo This homework is due to be handed in on Wednesday 12 November 2008 before 13:00 in the post box of the numerical

More information

Euler s Method, cont d

Euler s Method, cont d Jim Lambers MAT 461/561 Spring Semester 009-10 Lecture 3 Notes These notes correspond to Sections 5. and 5.4 in the text. Euler s Method, cont d We conclude our discussion of Euler s method with an example

More information

8.1 Introduction. Consider the initial value problem (IVP):

8.1 Introduction. Consider the initial value problem (IVP): 8.1 Introduction Consider the initial value problem (IVP): y dy dt = f(t, y), y(t 0)=y 0, t 0 t T. Geometrically: solutions are a one parameter family of curves y = y(t) in(t, y)-plane. Assume solution

More information

HIGHER ORDER METHODS. There are two principal means to derive higher order methods. b j f(x n j,y n j )

HIGHER ORDER METHODS. There are two principal means to derive higher order methods. b j f(x n j,y n j ) HIGHER ORDER METHODS There are two principal means to derive higher order methods y n+1 = p j=0 a j y n j + h p j= 1 b j f(x n j,y n j ) (a) Method of Undetermined Coefficients (b) Numerical Integration

More information

What we ll do: Lecture 21. Ordinary Differential Equations (ODEs) Differential Equations. Ordinary Differential Equations

What we ll do: Lecture 21. Ordinary Differential Equations (ODEs) Differential Equations. Ordinary Differential Equations What we ll do: Lecture Ordinary Differential Equations J. Chaudhry Department of Mathematics and Statistics University of New Mexico Review ODEs Single Step Methods Euler s method (st order accurate) Runge-Kutta

More information

1 Error Analysis for Solving IVP

1 Error Analysis for Solving IVP cs412: introduction to numerical analysis 12/9/10 Lecture 25: Numerical Solution of Differential Equations Error Analysis Instructor: Professor Amos Ron Scribes: Yunpeng Li, Mark Cowlishaw, Nathanael Fillmore

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

Do not turn over until you are told to do so by the Invigilator.

Do not turn over until you are told to do so by the Invigilator. UNIVERSITY OF EAST ANGLIA School of Mathematics Main Series UG Examination 216 17 INTRODUCTION TO NUMERICAL ANALYSIS MTHE612B Time allowed: 3 Hours Attempt QUESTIONS 1 and 2, and THREE other questions.

More information

Math 128A Spring 2003 Week 11 Solutions Burden & Faires 5.6: 1b, 3b, 7, 9, 12 Burden & Faires 5.7: 1b, 3b, 5 Burden & Faires 5.

Math 128A Spring 2003 Week 11 Solutions Burden & Faires 5.6: 1b, 3b, 7, 9, 12 Burden & Faires 5.7: 1b, 3b, 5 Burden & Faires 5. Math 128A Spring 2003 Week 11 Solutions Burden & Faires 5.6: 1b, 3b, 7, 9, 12 Burden & Faires 5.7: 1b, 3b, 5 Burden & Faires 5.8: 1b, 3b, 4 Burden & Faires 5.6. Multistep Methods 1. Use all the Adams-Bashforth

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

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

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

Ordinary Differential Equations

Ordinary Differential Equations Ordinary Differential Equations Introduction: first order ODE We are given a function f(t,y) which describes a direction field in the (t,y) plane an initial point (t 0,y 0 ) We want to find a function

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

1 Ordinary Differential Equations

1 Ordinary Differential Equations Ordinary Differential Equations.0 Mathematical Background.0. Smoothness Definition. A function f defined on [a, b] is continuous at ξ [a, b] if lim x ξ f(x) = f(ξ). Remark Note that this implies existence

More information

Ordinary Differential Equations I

Ordinary Differential Equations I Ordinary Differential Equations I CS 205A: Mathematical Methods for Robotics, Vision, and Graphics Justin Solomon CS 205A: Mathematical Methods Ordinary Differential Equations I 1 / 27 Theme of Last Three

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

FIRST-ORDER ORDINARY DIFFERENTIAL EQUATIONS III: Numerical and More Analytic Methods David Levermore Department of Mathematics University of Maryland

FIRST-ORDER ORDINARY DIFFERENTIAL EQUATIONS III: Numerical and More Analytic Methods David Levermore Department of Mathematics University of Maryland FIRST-ORDER ORDINARY DIFFERENTIAL EQUATIONS III: Numerical and More Analytic Methods David Levermore Department of Mathematics University of Maryland 30 September 0 Because the presentation of this material

More information

Fixed point iteration and root finding

Fixed point iteration and root finding Fixed point iteration and root finding The sign function is defined as x > 0 sign(x) = 0 x = 0 x < 0. It can be evaluated via an iteration which is useful for some problems. One such iteration is given

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

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

EXAMPLE OF ONE-STEP METHOD

EXAMPLE OF ONE-STEP METHOD EXAMPLE OF ONE-STEP METHOD Consider solving y = y cos x, y(0) = 1 Imagine writing a Taylor series for the solution Y (x), say initially about x = 0. Then Y (h) = Y (0) + hy (0) + h2 2 Y (0) + h3 6 Y (0)

More information

10 Numerical Solutions of PDEs

10 Numerical Solutions of PDEs 10 Numerical Solutions of PDEs There s no sense in being precise when you don t even know what you re talking about.- John von Neumann (1903-1957) Most of the book has dealt with finding exact solutions

More information

CS 257: Numerical Methods

CS 257: Numerical Methods CS 57: Numerical Methods Final Exam Study Guide Version 1.00 Created by Charles Feng http://www.fenguin.net CS 57: Numerical Methods Final Exam Study Guide 1 Contents 1 Introductory Matter 3 1.1 Calculus

More information

Southern Methodist University.

Southern Methodist University. Title: Continuous extensions Name: Lawrence F. Shampine 1, Laurent O. Jay 2 Affil./Addr. 1: Department of Mathematics Southern Methodist University Dallas, TX 75275 USA Phone: +1 (972) 690-8439 E-mail:

More information

Ordinary Differential Equations

Ordinary Differential Equations Chapter 13 Ordinary Differential Equations We motivated the problem of interpolation in Chapter 11 by transitioning from analzying to finding functions. That is, in problems like interpolation and regression,

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

24, B = 59 24, A = 55

24, B = 59 24, A = 55 Math 128a - Homework 8 - Due May 2 1) Problem 8.4.4 (Page 555) Solution: As discussed in the text, the fourth-order Adams-Bashforth formula is a formula of the type x n+1 = x n + h[af n + Bf n 1 + Cf n

More information

CHAPTER 10: Numerical Methods for DAEs

CHAPTER 10: Numerical Methods for DAEs CHAPTER 10: Numerical Methods for DAEs Numerical approaches for the solution of DAEs divide roughly into two classes: 1. direct discretization 2. reformulation (index reduction) plus discretization Direct

More information

Chapter 2: First Order DE 2.4 Linear vs. Nonlinear DEs

Chapter 2: First Order DE 2.4 Linear vs. Nonlinear DEs Chapter 2: First Order DE 2.4 Linear vs. Nonlinear DEs First Order DE 2.4 Linear vs. Nonlinear DE We recall the general form of the First Oreder DEs (FODE): dy = f(t, y) (1) dt where f(t, y) is a function

More information

Math Homework 3 Solutions. (1 y sin x) dx + (cos x) dy = 0. = sin x =

Math Homework 3 Solutions. (1 y sin x) dx + (cos x) dy = 0. = sin x = 2.6 #10: Determine if the equation is exact. If so, solve it. Math 315-01 Homework 3 Solutions (1 y sin x) dx + (cos x) dy = 0 Solution: Let P (x, y) = 1 y sin x and Q(x, y) = cos x. Note P = sin x = Q

More information

On interval predictor-corrector methods

On interval predictor-corrector methods DOI 10.1007/s11075-016-0220-x ORIGINAL PAPER On interval predictor-corrector methods Andrzej Marcinia 1,2 Malgorzata A. Janowsa 3 Tomasz Hoffmann 4 Received: 26 March 2016 / Accepted: 3 October 2016 The

More information

2 Numerical Methods for Initial Value Problems

2 Numerical Methods for Initial Value Problems Numerical Analysis of Differential Equations 44 2 Numerical Methods for Initial Value Problems Contents 2.1 Some Simple Methods 2.2 One-Step Methods Definition and Properties 2.3 Runge-Kutta-Methods 2.4

More information

Solution: (a) Before opening the parachute, the differential equation is given by: dv dt. = v. v(0) = 0

Solution: (a) Before opening the parachute, the differential equation is given by: dv dt. = v. v(0) = 0 Math 2250 Lab 4 Name/Unid: 1. (25 points) A man bails out of an airplane at the altitute of 12,000 ft, falls freely for 20 s, then opens his parachute. Assuming linear air resistance ρv ft/s 2, taking

More information

Modeling & Simulation 2018 Lecture 12. Simulations

Modeling & Simulation 2018 Lecture 12. Simulations Modeling & Simulation 2018 Lecture 12. Simulations Claudio Altafini Automatic Control, ISY Linköping University, Sweden Summary of lecture 7-11 1 / 32 Models of complex systems physical interconnections,

More information

Differential equations. Differential equations

Differential equations. Differential equations Differential equations A differential equation (DE) describes ow a quantity canges (as a function of time, position, ) d - A ball dropped from a building: t gt () dt d S qx - Uniformly loaded beam: wx

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

Lecture Notes on Numerical Differential Equations: IVP

Lecture Notes on Numerical Differential Equations: IVP Lecture Notes on Numerical Differential Equations: IVP Professor Biswa Nath Datta Department of Mathematical Sciences Northern Illinois University DeKalb, IL. 60115 USA E mail: dattab@math.niu.edu URL:

More information

Solving scalar IVP s : Runge-Kutta Methods

Solving scalar IVP s : Runge-Kutta Methods Solving scalar IVP s : Runge-Kutta Methods Josh Engwer Texas Tech University March 7, NOTATION: h step size x n xt) t n+ t + h x n+ xt n+ ) xt + h) dx = ft, x) SCALAR IVP ASSUMED THROUGHOUT: dt xt ) =

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

Astrodynamics (AERO0024)

Astrodynamics (AERO0024) Astrodynamics (AERO0024) 5. Numerical Methods Gaëtan Kerschen Space Structures & Systems Lab (S3L) Why Different Propagators? Analytic propagation: Better understanding of the perturbing forces. Useful

More information