31 Oct. 200015-859B - Introduction to Scientific Computing1 Initial Value Problems Paul Heckbert Computer Science Department Carnegie Mellon University.

Slides:



Advertisements
Similar presentations
MATLAB EXAMPLES Initial-value problems
Advertisements

1cs533d-winter-2005 Notes  Assignment 1 is not out yet :-)  courses/533d-winter-2005.
Integration Techniques
Ordinary Differential Equations
1cs542g-term Notes  Notes for last part of Oct 11 and all of Oct 12 lecture online now  Another extra class this Friday 1-2pm.
1cs542g-term Notes  Final exam: December 10, 10am-1pm X736 (CS Boardroom)  Another extra class this Friday 1-2pm.
Dr. Jie Zou PHY Chapter 9 Ordinary Differential Equations: Initial-Value Problems Lecture (I) 1 1 Besides the main textbook, also see Ref.: “Applied.
1 EE 616 Computer Aided Analysis of Electronic Networks Lecture 12 Instructor: Dr. J. A. Starzyk, Professor School of EECS Ohio University Athens, OH,
Lecture on Stiff Systems (Section 1-6 of Chua and Lin) ECE 546 Jan. 15, 2008.
Initial-Value Problems
Partial Differential Equations
Dr. Jie Zou PHY Chapter 9 Ordinary Differential Equations: Initial-Value Problems Lecture (II) 1 1 Besides the main textbook, also see Ref.: “Applied.
1 EE 616 Computer Aided Analysis of Electronic Networks Lecture 12 Instructor: Dr. J. A. Starzyk, Professor School of EECS Ohio University Athens, OH,
Efficient Simulation of Physical System Models Using Inlined Implicit Runge-Kutta Algorithms Vicha Treeaporn Department of Electrical & Computer Engineering.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Implicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Ordinary Differential Equations (ODEs)
Numerical Methods for Partial Differential Equations CAAM 452 Spring 2005 Lecture 2 Instructor: Tim Warburton.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Implicit ODE Solvers Daniel Baur ETH Zurich, Institut.
MATH 685/ CSI 700/ OR 682 Lecture Notes Lecture 10. Ordinary differential equations. Initial value problems.
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Numerical Solutions to ODEs Nancy Griffeth January 14, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis.
Professor Walter W. Olson Department of Mechanical, Industrial and Manufacturing Engineering University of Toledo Solving ODE.
Selected Differential System Examples from Lectures.
Gerschgorin Circle Theorem. Eigenvalues In linear algebra Eigenvalues are defined for a square matrix M. An Eigenvalue for the matrix M is a scalar such.
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
John J. Tyson Virginia Polytechnic Institute
Most physically significant large-scale atmospheric circulations have time scales on the order of Rossby waves but much larger than the time scales.
Selected Differential System Examples from Lectures
Romantic Relationships Background –Life would be very dull without the excitement (and sometimes pain) of romance! –Love affairs can be modelled by differential.
Boyce/DiPrima 9 th ed, Ch 8.5: More on Errors; Stability Elementary Differential Equations and Boundary Value Problems, 9 th edition, by William E. Boyce.
Scientific Computing Partial Differential Equations Implicit Solution of Heat Equation.
Modelling & Simulation of Chemical Engineering Systems Department of Chemical Engineering King Saud University 501 هعم : تمثيل الأنظمة الهندسية على الحاسب.
Integration of 3-body encounter. Figure taken from
Workshop on Stochastic Differential Equations and Statistical Inference for Markov Processes Day 3: Numerical Methods for Stochastic Differential.
Professor Walter W. Olson Department of Mechanical, Industrial and Manufacturing Engineering University of Toledo Performance & Stability Analysis.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. ~ Ordinary Differential Equations ~ Stiffness and Multistep.
Programming assignment #2 Solving a parabolic PDE using finite differences Numerical Methods for PDEs Spring 2007 Jim E. Jones.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 261 Stiffness.
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.
MA/CS 375 Fall MA/CS 375 Fall 2002 Lecture 12.
Beginning Programming for Engineers
Large Timestep Issues Lecture 12 Alessandra Nardi Thanks to Prof. Sangiovanni, Prof. Newton, Prof. White, Deepak Ramaswamy, Michal Rewienski, and Karen.
© Imperial College London Numerical Solution of Differential Equations 3 rd year JMC group project ● Summer Term 2004 Supervisor: Prof. Jeff Cash Saeed.
5. Integration method for Hamiltonian system. In many of formulas (e.g. the classical RK4), the errors in conserved quantities (energy, angular momentum)
Numerical Analysis – Differential Equation
Chapter 10 ordinary differential equations (ODEs) Chapter 11 systems of ODEs (6 th edition)
1 EE 616 Computer Aided Analysis of Electronic Networks Lecture 12 Instructor: Dr. J. A. Starzyk, Professor School of EECS Ohio University Athens, OH,
Please remember: When you me, do it to Please type “numerical-15” at the beginning of the subject line Do not reply to my gmail,
ME451 Kinematics and Dynamics of Machine Systems Numerical Integration. Stiffness: Implicit Methods. October 30, 2013 Radu Serban University of Wisconsin-Madison.
2D Henon Map The 2D Henon Map is similar to a real model of the forced nonlinear oscillator. The Purpose is The Investigation of The Period Doubling Transition.
Dr. Mujahed AlDhaifallah ( Term 342)
ECE 576 – Power System Dynamics and Stability Prof. Tom Overbye Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
Game Technology Animation V Generate motion of objects using numerical simulation methods Physically Based Animation.
Ordinary Differential Equations
9 Nov B - Introduction to Scientific Computing1 Sparse Systems and Iterative Methods Paul Heckbert Computer Science Department Carnegie Mellon.
Dr. Mubashir Alam King Saud University. Outline Ordinary Differential Equations (ODE) ODE: An Introduction (8.1) ODE Solution: Euler’s Method (8.2) ODE.
1 Spring 2003 Prof. Tim Warburton MA557/MA578/CS557 Lecture 32.
Mechanical Engineering at Virginia Tech
Paul Heckbert Computer Science Department Carnegie Mellon University
CSE 245: Computer Aided Circuit Simulation and Verification
Chapter 26.
Scientific Computing Partial Differential Equations Implicit Solution of Heat Equation.
MATH 175: NUMERICAL ANALYSIS II
An example of using euler.m
Overview Class #2 (Jan 16) Brief introduction to time-stepping ODEs
MATH 175: Numerical Analysis II
EE 616 Computer Aided Analysis of Electronic Networks Lecture 12
Presentation transcript:

31 Oct B - Introduction to Scientific Computing1 Initial Value Problems Paul Heckbert Computer Science Department Carnegie Mellon University

31 Oct B - Introduction to Scientific Computing2 Generic First Order ODE given y’=f(t,y) y(t 0 )=y 0 solve for y(t) for t>t 0

31 Oct B - Introduction to Scientific Computing3 First ODE: y’=y ODE is unstable (solution is y(t)=ce t ) we show solutions with Euler’s method

31 Oct B - Introduction to Scientific Computing4 y’=y

31 Oct B - Introduction to Scientific Computing5 Second ODE: y’=-y ODE is stable (solution is y(t)= ce -t ) if h too large, numerical solution is unstable we show solutions with Euler’s method in red

31 Oct B - Introduction to Scientific Computing6 y’=-y, stable but slow solution

31 Oct B - Introduction to Scientific Computing7 y’=-y, stable, a bit inaccurate soln.

31 Oct B - Introduction to Scientific Computing8 y’=-y, stable, rather inaccurate soln.

31 Oct B - Introduction to Scientific Computing9 y’=-y, stable but poor solution

31 Oct B - Introduction to Scientific Computing10 y’=-y, oscillating solution

31 Oct B - Introduction to Scientific Computing11 y’=-y, unstable solution

31 Oct B - Introduction to Scientific Computing12 Jacobian of ODE ODE: y’=f(t,y), where y is n-dimensional Jacobian of f isa square matrix if ODE homogeneous and linear then J is constant and y’=Jy but in general J varies with t and y

31 Oct B - Introduction to Scientific Computing13 Stability of ODE depends on Jacobian At a given (t,y) find J(t,y) and its eigenvalues find r max = max i { Re[ i (J)] } if r max <0, ODE stable, locally r max =0, ODE neutrally stable, locally r max >0, ODE unstable, locally

31 Oct B - Introduction to Scientific Computing14 Stability of Numerical Solution Stability of numerical solution is related to, but not the same as stability of ODE! Amplification factor of a numerical solution is the factor by which global error grows or shrinks each iteration.

31 Oct B - Introduction to Scientific Computing15 Stability of Euler’s Method Amplification factor of Euler’s method is I+hJ Note that it depends on h and, in general, on t & y. Stability of Euler’s method is determined by eigenvalues of I+hJ spectral radius  (I+hJ)= max i | i (I+hJ) | if  (I+hJ)<1 then Euler’s method stable –if all eigenvalues of hJ lie inside unit circle centered at –1, E.M. is stable –scalar case: 0<|hJ|<2 iff stable, so choose h < 2/|J| What if one eigenvalue of J is much larger than the others?

31 Oct B - Introduction to Scientific Computing16 Stiff ODE An ODE is stiff if its eigenvalues have greatly differing magnitudes. With a stiff ODE, one eigenvalue can force use of small h when using Euler’s method

31 Oct B - Introduction to Scientific Computing17 Implicit Methods use information from future time t k+1 to take a step from t k Euler method: y k+1 = y k +f(t k,y k )h k backward Euler method: y k+1 = y k +f(t k+1,y k+1 )h k example: y’=Ay f(t,y)=Ay y k+1 = y k +Ay k+1 h k (I-h k A)y k+1 =y k -- solve this system each iteration

31 Oct B - Introduction to Scientific Computing18 Stability of Backward Euler’s Method Amplification factor of B.E.M. is (I-hJ) -1 B.E.M. is stable independent of h (unconditionally stable) as long as r max <0, i.e. as long as ODE is stable Implicit methods such as this permit bigger steps to be taken (larger h)

31 Oct B - Introduction to Scientific Computing19 y’=-y, B.E.M. with large step

31 Oct B - Introduction to Scientific Computing20 y’=-y, B.E.M. with very large step

31 Oct B - Introduction to Scientific Computing21 Third ODE: y’=-100y+100t+101 ODE is stable, very stiff (solution is y(t)= 1+t+ce -100t ) we show solutions: –Euler’s method in red –Backward Euler in green

31 Oct B - Introduction to Scientific Computing22 Euler’s method requires tiny step

31 Oct B - Introduction to Scientific Computing23 Euler’s method, with larger step

31 Oct B - Introduction to Scientific Computing24 Euler’s method with too large a step three solutions started at y 0 =.99, 1, 1.01

31 Oct B - Introduction to Scientific Computing25 Large steps OK with Backward Euler’s method

31 Oct B - Introduction to Scientific Computing26 Very large steps OK, too

31 Oct B - Introduction to Scientific Computing27 Popular IVP Solution Methods Euler’s method, 1 st order backward Euler’s method, 1 st order trapezoid method (a.k.a. 2 nd order Adams-Moulton) 4 th order Runge-Kutta If a method is p th order accurate then its global error is O(h p )

31 Oct B - Introduction to Scientific Computing28 Matlab code used to make E.M. plots function [tv,yv] = euler(funcname,h,t0,tmax,y0) % use Euler's method to solve y'=func(t,y) % return tvec and yvec sampled at t=(t0:h:tmax) as col. vectors % funcname is a string containing the name of func % apparently func has to be in this file?? % Paul Heckbert30 Oct 2000 y = y0; tv = [t0]; yv = [y0]; for t = t0:h:tmax f = eval([funcname '(t,y)']); y = y+f*h; tv = [tv; t+h]; yv = [yv; y]; end function f = func1(t,y)% Heath fig 9.6 f = y; return; function f = func2(t,y)% Heath fig 9.7 f = -y; return; function f = func3(t,y)% Heath example 9.11 f = -100*y+100*t+101; return;

31 Oct B - Introduction to Scientific Computing29 Matlab code used to make E.M. plots function e3(h,file) figure(4); clf; hold on; tmax =.4; axis([0 tmax -5 15]); % axis([ ]); % first draw "exact" solution in blue y0v = 2.^(0:4:80); for y0 = [y0v -y0v] [tv,yv] = euler('func3',.005, 0, tmax, y0); plot(tv,yv,'b--'); end % then draw approximate solution in red for y0 = [(.95:.05:1.05) ] [tv,yv] = euler('func3', h, 0, tmax, y0); plot(tv,yv,'ro-', 'LineWidth',2, 'MarkerSize',4); end text(.32,-3, sprintf('h=%g', h), 'FontSize',20, 'Color','r'); eval(['print -depsc2 ' file]); run, e.g. e3(.1, ‘a.eps’)