© Imperial College London Numerical Solution of Differential Equations 3 rd year JMC group project ● Summer Term 2004 Supervisor: Prof. Jeff Cash Saeed.

Slides:



Advertisements
Similar presentations
Adaptivity and symmetry for ODEs and PDEs Chris Budd.
Advertisements

Example Project and Numerical Integration Computational Neuroscience 03 Lecture 11.
Formal Computational Skills
Chapter 6 Differential Equations
Computational Modeling for Engineering MECN 6040
Numeriska beräkningar i Naturvetenskap och Teknik 1. Numerical differentiation and quadrature Discrete differentiation and integration Trapezoidal and.
CSE245: Computer-Aided Circuit Simulation and Verification Lecture Note 5 Numerical Integration Prof. Chung-Kuan Cheng 1.
Ordinary Differential Equations
Numerical Computation
PART 7 Ordinary Differential Equations ODEs
CSE245: Computer-Aided Circuit Simulation and Verification Lecture Note 5 Numerical Integration Spring 2010 Prof. Chung-Kuan Cheng 1.
Numerical Integration CSE245 Lecture Notes. Content Introduction Linear Multistep Formulae Local Error and The Order of Integration Time Domain Solution.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Implicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Numerical Solutions of Ordinary Differential Equations
NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
Numerical Solution of Ordinary Differential Equation
Fin500J Topic 7Fall 2010 Olin Business School 1 Fin500J Mathematical Foundations in Finance Topic 7: Numerical Methods for Solving Ordinary Differential.
PART 7 Ordinary Differential Equations ODEs
Calculus and Analytic Geometry II Cloud County Community College Spring, 2011 Instructor: Timothy L. Warkentin.
Numerical Solutions to ODEs Nancy Griffeth January 14, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis.
Boyce/DiPrima 9th ed, Ch 8.4: Multistep Methods Elementary Differential Equations and Boundary Value Problems, 9th edition, by William E. Boyce and Richard.
Lecture 35 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
EE3561_Unit 8Al-Dhaifallah14351 EE 3561 : Computational Methods Unit 8 Solution of Ordinary Differential Equations Lesson 3: Midpoint and Heun’s Predictor.
Fin500J Topic 6Fall 2010 Olin Business School 1 Fin500J: Mathematical Foundations in Finance Topic 6: Ordinary Differential Equations Philip H. Dybvig.
1 EEE 431 Computational Methods in Electrodynamics Lecture 4 By Dr. Rasime Uyguroglu
Section 2.5 – Implicit Differentiation. Explicit Equations The functions that we have differentiated and handled so far can be described by expressing.
3 DERIVATIVES. The functions that we have met so far can be described by expressing one variable explicitly in terms of another variable.  For example,,
Integration of 3-body encounter. Figure taken from
Scientific Computing Numerical Solution Of Ordinary Differential Equations - Euler’s Method.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. ~ Ordinary Differential Equations ~ Stiffness and Multistep.
Numerical Methods for Solving ODEs Euler Method. Ordinary Differential Equations  A differential equation is an equation in which includes derivatives.
+ Numerical Integration Techniques A Brief Introduction By Kai Zhao January, 2011.
SPECIALIST MATHS Differential Equations Week 1. Differential Equations The solution to a differential equations is a function that obeys it. Types of.
DIFFERENTIAL EQUATIONS 10. DIFFERENTIAL EQUATIONS Unfortunately, it’s impossible to solve most differential equations in the sense of obtaining an explicit.
Engineering Analysis – Computational Fluid Dynamics –
MECN 3500 Inter - Bayamon Lecture 9 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Implicit Differentiation. Objective To find derivatives implicitly. To find derivatives implicitly.
Today’s class Numerical differentiation Roots of equation Bracketing methods Numerical Methods, Lecture 4 1 Prof. Jinbo Bi CSE, UConn.
Numerical Analysis – Differential Equation
Chapter 10 ordinary differential equations (ODEs) Chapter 11 systems of ODEs (6 th edition)
Introduction to the Runge-Kutta algorithm for approximating derivatives PHYS 361 Spring, 2011.
Dr. Mujahed AlDhaifallah ( Term 342)
Today’s class Ordinary Differential Equations Runge-Kutta Methods
Lecture 40 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
ECE 576 – Power System Dynamics and Stability Prof. Tom Overbye Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
Ordinary Differential Equations
1/14  5.2 Euler’s Method Compute the approximations of y(t) at a set of ( usually equally-spaced ) mesh points a = t 0 < t 1
Lecture 39 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
The formulae for the roots of a 3rd degree polynomial are given below
NUMERICAL DIFFERENTIATION or DIFFERENCE APPROXIMATION Used to evaluate derivatives of a function using the functional values at grid points. They are.
This chapter is concerned with the problem in the form Chapter 6 focuses on how to find the numerical solutions of the given initial-value problems. Main.
UNIT 2 LESSON 9 IMPLICIT DIFFERENTIATION 1. 2 So far, we have been differentiating expressions of the form y = f(x), where y is written explicitly in.
1 Week 11 Numerical methods for ODEs 1.The basics: finite differences, meshes 2.The Euler method.
Ordinary Differential Equations
SLOPE FIELDS & EULER’S METHOD
SLOPE FIELDS & EULER’S METHOD
Advanced Numerical Methods (S. A. Sahu) Code: AMC 51151
ECE 576 – Power System Dynamics and Stability
CSE245: Computer-Aided Circuit Simulation and Verification
Class Notes 19: Numerical Methods (2/2)
CSE 245: Computer Aided Circuit Simulation and Verification
Chapter 26.
Numerical Integration:
CSE245: Computer-Aided Circuit Simulation and Verification
Numerical Analysis Lecture 37.
Numerical Analysis Lecture 38.
Derivatives and Gradients
Presentation transcript:

© Imperial College London Numerical Solution of Differential Equations 3 rd year JMC group project ● Summer Term 2004 Supervisor: Prof. Jeff Cash Saeed Amen Paul Bilokon Adam Brinley Codd Minal Fofaria Tejas Shah

© Imperial College London Agenda Adam: Differential equations and numerical methods Paul: Basic methods (FE, BE, TR). Problem: “ circle ” Saeed: Advanced methods (4 th order). Problem: Kepler ’ s equation Minal: Stiff equations Tejas: Derivation of 6 th order method

© Imperial College London Agenda Adam: Differential equations and numerical methods Paul: Basic methods (FE, BE, TR). Problem: “ circle ” Saeed: Advanced methods (4 th order). Problem: Kepler ’ s equation Minal: Stiff equations Tejas: Derivation of 6 th order method

© Imperial College London Introduction to Differential Equations Equations involving a function y of x, and its derivatives Model real world systems General Equation:

© Imperial College London Introduction to Differential Equations Simple example Solution obtained by integrating both sides Initial values can determine c

© Imperial College London Introduction to Differential Equations Special case when equations do not involve x E.g. Initial values y(0) = 1 and y'(0) = 0, solution is

© Imperial College London Introduction to Differential Equations Kepler ’ s Equations of Planetary Motion Difficult to solve analytically – we use numerical methods instead

© Imperial College London Introduction to Differential Equations Forward Euler and Backward Euler Trapezium Rule General method – Use initial value of y at x=0 – Calculate next value (x=h for small h) using gradient – Call this y 1 and repeat Need formula for y n+1 in terms of y n

© Imperial College London Agenda Adam: Differential equations and numerical methods Paul: Basic methods (FE, BE, TR). Problem: “ circle ” Saeed: Advanced methods (4 th order). Problem: Kepler ’ s equation Minal: Stiff equations Tejas: Derivation of 6 th order method

© Imperial College London Agenda Adam: Differential equations and numerical methods  Paul: Basic methods (FE, BE, TR). Problem: “ circle ” Saeed: Advanced methods (4 th order). Problem: Kepler ’ s equation Minal: Stiff equations Tejas: Derivation of 6 th order method

© Imperial College London Euler ’ s Methods Simplest way of solving ODEs numerically Does not always produce reasonable solutions Forward Euler (explicit) and Backward Euler (implicit)

© Imperial College London Forward Euler y(x + h) = y(x) + h y’(x) Explicit E loc = ½h 2 y (2) (  )  h 2 First order Asymmetric x0x0 x1x1 x2x2 x y y0y0 y1y1 y2y2 hh (x 0, y 0 ) (x 1, y 1 ) (x 2, y 2 ) True solution Approximated solution Slope f(x 1, y 1 ) Slope f(x 0, y 0 )

© Imperial College London Backward Euler y(x + h) = y(x) + h y’(x + h) Implicit E loc = - ½h 2 y (2) (  )  h 2 First order Asymmetric x0x0 x1x1 x2x2 x y y0y0 y1y1 y2y2 hh (x 0, y 0 ) (x 1, y 1 ) (x 2, y 2 ) True solution Approximated solution Slope f(x 2, y 2 ) Slope f(x 1, y 1 )

© Imperial College London Trapezium Rule Average of FE and BE Implicit E loc = - (h 3 /12) f (2) (  )  h 3 Second order Symmetric y(x + h) = y(x) + ½ h [y’(x) + y’(x + h)]

© Imperial College London Example Problem: “ Circle ” Consider y’’ = -y, with initial conditions – y(0) = 1 – y’(0) = 0 The analytical solution is y = cos x, that can be used for comparison with numerical solutions

© Imperial College London Plots for the True Solution Time series plot (xy)Phase plane plot (zy)

© Imperial College London Time Series y x

© Imperial College London Phase Plane Plots: FE & BE Forward EulerBackward Euler

© Imperial College London Phase Plane Plots: TR FE & BE fail: non-periodic TR: OK, periodic sol n W h y ?

© Imperial College London Symmetricity TR is symmetric, whereas FE & BE are not y(x + h) = y(x) + ½ h [y’(x) + y’(x + h)] h  -h y(x - h) = y(x) - ½ h [y’(x) + y’(x - h)] X := x - h y(X + h) = y(X) + ½ h [y’(X) + y’(X + h)] Still TR!

© Imperial College London Symmetricity TR is symmetric, whereas FE & BE are not y(x + h) = y(x) + h y’(x) h  -h y(x - h) = y(x) - h y’(x) X := x - h y(X + h) = y(X) + h y’(X + h) Still FE?

© Imperial College London Time Step h = h = 10 -2

© Imperial College London Agenda Adam: Differential equations and numerical methods  Paul: Basic methods (FE, BE, TR). Problem: “ circle ” Saeed: Advanced methods (4 th order). Problem: Kepler ’ s equation Minal: Stiff equations Tejas: Derivation of 6 th order method

© Imperial College London Agenda Adam: Differential equations and numerical methods  Paul: Basic methods (FE, BE, TR). Problem: “ circle ”  Saeed: Advanced methods (4 th order). Problem: Kepler ’ s equation Minal: Stiff equations Tejas: Derivation of 6 th order method

© Imperial College London After Euler and TR Can create higher order methods, which have far smaller global errors Methods are more complex and require more computation on each step But for same step size more accurate Introduce concept of half step

© Imperial College London Two Fourth Order Methods y n+1 – y n = y n + h/2(y’ n ) + (h 2 /12)(4y’’ n+½ + 2y’’ n ) y’ n+1 – y’ n = h/6(y’’ n+1 + 4y’’ n+½ + y’’ n )(*) Then to calculate the half-step we use either A or B – A) y n+ ½ = ½(y n+1 + y n ) – h 2 /48(y’’ n+1 + 4y’’ n+½ + y’’ n ) – B) y n+ ½ = y n + ½y’ n – h 2 /192(-2y’’ n y’’ n+½ + 14y’’ n ) Which one is more accurate? (next slide) Solve iteratively and then apply solution to find derivative (*)

© Imperial College London Creating Method A Start with – y n+1 – y n = h/6[y’ n+1 + 4y’ n+½ + y’ n ] (1) – diff. y’ n+1 – y’ n = h/6[y’’ n+1 + 4y’’ n+½ + y’’ n ] (2) – y n+½ = ½(y n+1 + y’ n ) – h/8(y’ n+1 – y’ n ) (3) – diff. y’ n+½ = ½(y’ n+1 + y’’ n ) – h/8(y’’ n+1 – y’’ n ) (4) subs (4) into (1) (to eliminate y’ n+½ ) and eliminate y’ n+1 using (2), then use (2) in (3) to get half-step

© Imperial College London Comparing Fourth Order Methods Comparing errors when solving circle problem Both A and B produce a much smaller order of error than Euler ’ s

© Imperial College London Finding Earth ’ s Orbit Around Sun Kepler ’ s Equation Can use it to find the orbit of planets Use to find orbit of earth around the sun Work in two dimensions z and y z’’ = -(GM z) / (y 2 + z 2 ) 3/2 y’’ = -(GM y) / (y 2 + z 2 ) 3/2 Constants and initial conditions in report

© Imperial College London Results Plot Solution uses small step size h = 0.01 Becomes difficult to tell difference between methods visually Using h = 0.1 difference is more marked

© Imperial College London Agenda Adam: Differential equations and numerical methods  Paul: Basic methods (FE, BE, TR). Problem: “ circle ”  Saeed: Advanced methods (4 th order). Problem: Kepler ’ s equation Minal: Stiff equations Tejas: Derivation of 6 th order method

© Imperial College London Agenda Adam: Differential equations and numerical methods  Paul: Basic methods (FE, BE, TR). Problem: “ circle ”  Saeed: Advanced methods (4 th order). Problem: Kepler ’ s equation  Minal: Stiff equations Tejas: Derivation of 6 th order method

© Imperial College London Stiff Equations Certain systems of ODEs are classified as stiff A system of ODEs is stiff if there are two or more very different scales of the independent variable on which the dependent variables are changing Some of the methods used to find numerical solutions fail to obtain the required solution

© Imperial College London Example Consider the equation: With initial conditions: There are two solutions to this problem

© Imperial College London Example continued Analytical solution: y=e -x Unwanted solution: y=e -λx We will now show how forward Euler is not stable when solving this problem under certain circumstances

© Imperial College London Example continued Let λ = 10 3 and let (the step size) h = 0.1

© Imperial College London Increasing the range of the x-axis

© Imperial College London When h = 0.001

© Imperial College London Agenda Adam: Differential equations and numerical methods  Paul: Basic methods (FE, BE, TR). Problem: “ circle ”  Saeed: Advanced methods (4 th order). Problem: Kepler ’ s equation  Minal: Stiff equations Tejas: Derivation of 6 th order method

© Imperial College London Agenda Adam: Differential equations and numerical methods  Paul: Basic methods (FE, BE, TR). Problem: “ circle ”  Saeed: Advanced methods (4 th order). Problem: Kepler ’ s equation  Minal: Stiff equations  Tejas: Derivation of 6 th order method

© Imperial College London A Sixth Order Numerical Method Has an error term with smallest h degree as h 7 Idea is to find values for α, A, B, C, D, E, F, C, D, E, F such that:

© Imperial College London Derivation Compare Taylor ’ s Expansion of LHS and RHS So for: – First expand the LHS

© Imperial College London Derivation Now expand individual terms on RHS of our expression: This gives:

© Imperial College London Derivation Equate both sides and solve for constants: Similarly we can find C, D, E, F and C, D, E, F

© Imperial College London Applying 6 th Order Method How to obtain results using derived method. Produce a set of simultaneous equations and solve. Find y ’ n+1 from old values and those just obtained. Set x, y n, y ’ n etc. to new values. Repeat above procedure with updated variables.

© Imperial College London Circle Problem Example Circle is produced for phase plane plot

© Imperial College London Kepler ’ s Equations Solution obtained from z-y plot reinforces fourth order method results.

The End But perhaps you want more? Read our report Visit our website: