Ordinary Differential Equations II

Similar documents
Ordinary Differential Equations II

Ordinary Differential Equations

Ordinary Differential Equations I

Ordinary Differential Equations I

Ordinary Differential Equations I

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

Lecture IV: Time Discretization

Lecture V: The game-engine loop & Time Integration

Consistency and Convergence

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

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

Ordinary Differential Equations

Chap. 20: Initial-Value Problems

Ordinary Differential Equations (ODEs)

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

Partial Differential Equations II

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

Ordinary differential equation II

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

Euler s Method, cont d

Numerical Methods - Initial Value Problems for ODEs

Lecture 4: Numerical solution of ordinary differential equations

The family of Runge Kutta methods with two intermediate evaluations is defined by

NUMERICAL SOLUTION OF ODE IVPs. Overview

Numerical Methods for the Solution of Differential Equations

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

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

Final Examination. CS 205A: Mathematical Methods for Robotics, Vision, and Graphics (Fall 2013), Stanford University

Ordinary Differential Equations

CS205b/CME306. Lecture 4. x v. + t

Jim Lambers MAT 772 Fall Semester Lecture 21 Notes

Solving Ordinary Differential equations

Scientific Computing: An Introductory Survey

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

Applied Math for Engineers

Differential Equations

MTH 452/552 Homework 3

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

Differential Equations

TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1. Chapter Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9

Initial value problems for ordinary differential equations

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

CS 257: Numerical Methods

AM205: Assignment 3 (due 5 PM, October 20)

ODE Runge-Kutta methods

Ph 22.1 Return of the ODEs: higher-order methods

Ordinary Differential Equations

Exam in TMA4215 December 7th 2012

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

DELFT UNIVERSITY OF TECHNOLOGY Faculty of Electrical Engineering, Mathematics and Computer Science

1 Error Analysis for Solving IVP

Multistage Methods I: Runge-Kutta Methods

2.29 Numerical Fluid Mechanics Fall 2011 Lecture 20

Ordinary Differential Equations

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

Solving scalar IVP s : Runge-Kutta Methods

Chapter 6 - Ordinary Differential Equations

Numerical solution of ODEs

Numerical Differential Equations: IVP

CS520: numerical ODEs (Ch.2)

Numerical Methods for Differential Equations

Fundamentals Physics

Chapter 8. Numerical Solution of Ordinary Differential Equations. Module No. 1. Runge-Kutta Methods

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

Part IB Numerical Analysis

Numerical Methods for Initial Value Problems; Harmonic Oscillators

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

Numerical Methods for Initial Value Problems; Harmonic Oscillators

Course Information Course Overview Study Skills Background Material. Introduction. CS 205A: Mathematical Methods for Robotics, Vision, and Graphics

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

Multistep Methods for IVPs. t 0 < t < T

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

Scientific Computing II

Introduction to the Numerical Solution of IVP for ODE

Cyber-Physical Systems Modeling and Simulation of Continuous Systems

Numerical Analysis Solution of Algebraic Equation (non-linear equation) 1- Trial and Error. 2- Fixed point

FDM for parabolic equations

Optimization II: Unconstrained Multivariable

Fourth Order RK-Method

Research Computing with Python, Lecture 7, Numerical Integration and Solving Ordinary Differential Equations

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.

Time scales. Notes. Mixed Implicit/Explicit. Newmark Methods [ ] [ ] "!t = O 1 %

Ordinary differential equations. Phys 420/580 Lecture 8

Department of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004

1 Systems of First Order IVP

Lecture 17: Ordinary Differential Equation II. First Order (continued)

Backward error analysis

Lösning: Tenta Numerical Analysis för D, L. FMN011,

2 Numerical Methods for Initial Value Problems

Practice Exam 2 (Solutions)

Simple ODE Solvers - Derivation

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

Finite Differences for Differential Equations 28 PART II. Finite Difference Methods for Differential Equations

Optimization II: Unconstrained Multivariable

Review for Exam 2 Ben Wang and Mark Styczynski

MecE 390 Final examination, Winter 2014

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

[ ] is a vector of size p.

The Finite Element Method for the Analysis of Non-Linear and Dynamic Systems. Prof. Dr. Eleni Chatzi Lecture 6-5 November, 2015

Numerical Methods for Differential Equations

Transcription:

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 lecture on Wednesday! Homework 7: 6/3 (late days OK) Optional coding: 6/3 (no late days) Final exam review: 6/5 (if someone attends) Final exam: 6/8, 12:15pm-3:15pm (Hewlett 201; confirm make-up) CS 205A: Mathematical Methods Ordinary Differential Equations II 2 / 33

Study Tips Practice Especially on modeling problems! Do sanity checks Come up with a function and minimize it. Factor a matrix. Implement and experiment Iterate Look at solution, put it away, and try again. Time your practices Ask lots of questions! CS 205A: Mathematical Methods Ordinary Differential Equations II 3 / 33

Initial Value Problems Find f(t) : R R n Satisfying F [t, f(t), f (t), f (t),..., f (k) (t)] = 0 Given f(0), f (0), f (0),..., f (k 1) (0) CS 205A: Mathematical Methods Ordinary Differential Equations II 4 / 33

Most Famous Example F = m a Newton s second law CS 205A: Mathematical Methods Ordinary Differential Equations II 5 / 33

Reasonable Assumption Explicit ODE An ODE is explicit if can be written in the form f (k) (t) = F [t, f(t), f (t), f (t),..., f (k 1) (t)]. CS 205A: Mathematical Methods Ordinary Differential Equations II 6 / 33

d y After Reduction dt = F [ y] CS 205A: Mathematical Methods Ordinary Differential Equations II 7 / 33

Forward Euler y k+1 = y k + hf [ y k ] Explicit method O(h 2 ) localized truncation error O(h) global truncation error; first order accurate CS 205A: Mathematical Methods Ordinary Differential Equations II 8 / 33

Backward Euler y k+1 = y k + hf [ y k+1 ] Implicit method O(h 2 ) localized truncation error O(h) global truncation error; first order accurate CS 205A: Mathematical Methods Ordinary Differential Equations II 9 / 33

Trapezoid Method y k+1 = y k + h F [ y k] + F [ y k+1 ] 2 Implicit method O(h 3 ) localized truncation error O(h 2 ) global truncation error; second order accurate CS 205A: Mathematical Methods Ordinary Differential Equations II 10 / 33

Example y = A y CS 205A: Mathematical Methods Ordinary Differential Equations II 11 / 33

Example y = A y y k+1 = ( I n n ha 2 ) 1 ( I n n + ha 2 ) y k CS 205A: Mathematical Methods Ordinary Differential Equations II 11 / 33

Model Equation y = ay, a < 0 y k+1 = y k + h ay k + ay k+1 2 CS 205A: Mathematical Methods Ordinary Differential Equations II 12 / 33

Model Equation y = ay, a < 0 y k+1 = y k + h ay k + ay k+1 2 ( 1 + 1 2 y k = ha ) k 1 1 2 ha y 0 CS 205A: Mathematical Methods Ordinary Differential Equations II 12 / 33

Model Equation y = ay, a < 0 y k+1 = y k + h ay k + ay k+1 2 ( 1 + 1 2 y k = ha ) k 1 1 2 ha y 0 CS 205A: Mathematical Methods Ordinary Differential Equations II 12 / 33

Model Equation y = ay, a < 0 y k+1 = y k + h ay k + ay k+1 2 ( 1 + 1 2 y k = ha ) k 1 1 2 ha y 0 Unconditionally stable! CS 205A: Mathematical Methods Ordinary Differential Equations II 12 / 33

Model Equation y = ay, a < 0 y k+1 = y k + h ay k + ay k+1 2 ( 1 + 1 2 y k = ha ) k 1 1 2 ha y 0 Unconditionally stable! But this has nothing to do with accuracy. CS 205A: Mathematical Methods Ordinary Differential Equations II 12 / 33

Is Stability Useful Here? R = y k+1 y k CS 205A: Mathematical Methods Ordinary Differential Equations II 13 / 33

Is Stability Useful Here? R = y k+1 y k Oscillatory behavior! CS 205A: Mathematical Methods Ordinary Differential Equations II 13 / 33

Example Useful for mid-size time steps CS 205A: Mathematical Methods Ordinary Differential Equations II 14 / 33

Pattern Convergence as h 0 is not the whole story nor is stability. Often should consider behavior for fixed h > 0. CS 205A: Mathematical Methods Ordinary Differential Equations II 15 / 33

Pattern Convergence as h 0 is not the whole story nor is stability. Often should consider behavior for fixed h > 0. Qualitative and quantitative analysis needed! CS 205A: Mathematical Methods Ordinary Differential Equations II 15 / 33

Observation y k+1 = y k + tk +h t k F [ y(t)] dt CS 205A: Mathematical Methods Ordinary Differential Equations II 16 / 33

Alternative Derivation of Trapezoid Method y k+1 = y k + h 2 (F [ y k] + F [ y k+1 ]) + O(h 3 ) Implicit method CS 205A: Mathematical Methods Ordinary Differential Equations II 17 / 33

Heun s Method y k+1 = y k + h 2 (F [ y k] + F [ y k + hf [ y k ]]) + O(h 3 ) Replace implicit part with lower-order integrator! CS 205A: Mathematical Methods Ordinary Differential Equations II 18 / 33

Stability of Heun s Method y k+1 = y = ay, a < 0 (1 + ha + 12 ) h2 a 2 y k CS 205A: Mathematical Methods Ordinary Differential Equations II 19 / 33

Stability of Heun s Method y k+1 = y = ay, a < 0 (1 + ha + 12 ) h2 a 2 y k = h < 2 a CS 205A: Mathematical Methods Ordinary Differential Equations II 19 / 33

Stability of Heun s Method y k+1 = y = ay, a < 0 (1 + ha + 12 ) h2 a 2 y k = h < 2 a Forward Euler: h < 2 a CS 205A: Mathematical Methods Ordinary Differential Equations II 19 / 33

Runge-Kutta Methods Apply quadrature to: y k+1 = y k + tk+1 t k F [ y(t)] dt CS 205A: Mathematical Methods Ordinary Differential Equations II 20 / 33

Runge-Kutta Methods Apply quadrature to: y k+1 = y k + tk+1 t k Use low-order integrators F [ y(t)] dt CS 205A: Mathematical Methods Ordinary Differential Equations II 20 / 33

RK4: Simpson s Rule y k+1 = y k + h 6 ( k 1 + 2 k 2 + 2 k 3 + k 4 ) where k 1 = F [ y k ] k2 = F [ y k + 12 ] h k 1 k3 = F [ y k + 12 ] h k 2 k4 = F [ y k + h ] k 3 CS 205A: Mathematical Methods Ordinary Differential Equations II 21 / 33

Using the Model Equation y A y = y(t) e At y 0 CS 205A: Mathematical Methods Ordinary Differential Equations II 22 / 33

Exponential Integrators y = A y + G[ y] CS 205A: Mathematical Methods Ordinary Differential Equations II 23 / 33

Exponential Integrators y = A y + G[ y] First-order exponential integrator: y k+1 = e Ah y k + A 1 (e Ah I n n )G[ y k ] CS 205A: Mathematical Methods Ordinary Differential Equations II 23 / 33

Returning to Our Reduction y (t) = v(t) v (t) = a(t) a(t) = F [t, y(t), v(t)] CS 205A: Mathematical Methods Ordinary Differential Equations II 24 / 33

Returning to Our Reduction y (t) = v(t) v (t) = a(t) a(t) = F [t, y(t), v(t)] y(t k + h) = y(t k ) + h y (t k ) + h2 2 y (t k ) + O(h 3 ) Don t need high-order estimators for derivatives. CS 205A: Mathematical Methods Ordinary Differential Equations II 24 / 33

New Formulae v k+1 = v k + tk+1 t k a(t) dt CS 205A: Mathematical Methods Ordinary Differential Equations II 25 / 33

New Formulae v k+1 = v k + y k+1 = y k + h v k + tk+1 t k tk+1 t k a(t) dt (t k+1 t) a(t) dt CS 205A: Mathematical Methods Ordinary Differential Equations II 25 / 33

New Formulae v k+1 = v k + y k+1 = y k + h v k + tk+1 t k tk+1 t k a(t) dt (t k+1 t) a(t) dt a(τ) = (1 γ) a k + γ a k+1 + a (τ)(τ hγ t k ) + O(h 2 ) for τ [a, b] CS 205A: Mathematical Methods Ordinary Differential Equations II 25 / 33

Newmark Class y k+1 = y k + h v k + ( ) 1 2 β h 2 a k + βh 2 a k+1 v k+1 = v k + (1 γ)h a k + γh a k+1 a k = F [t k, y k, v k ] CS 205A: Mathematical Methods Ordinary Differential Equations II 26 / 33

Newmark Class y k+1 = y k + h v k + ( ) 1 2 β h 2 a k + βh 2 a k+1 v k+1 = v k + (1 γ)h a k + γh a k+1 a k = F [t k, y k, v k ] Parameters: β, γ (can be implicit or explicit!) CS 205A: Mathematical Methods Ordinary Differential Equations II 26 / 33

Constant Acceleration: β = γ = 0 y k+1 = y k + h v k + 1 2 h2 a k v k+1 = v k + h a k Explicit, exact for constant acceleration, linear accuracy CS 205A: Mathematical Methods Ordinary Differential Equations II 27 / 33

Constant Implicit Acceleration: β = 1 /2, γ = 1 y k+1 = y k + h v k + 1 2 h2 a k+1 v k+1 = v k + h a k+1 Backward Euler for velocity, midpoint for position; globally first-order accurate CS 205A: Mathematical Methods Ordinary Differential Equations II 28 / 33

Trapezoid: β = 1 /4, γ = 1 /2 x k+1 = x k + 1 2 h( v k + v k+1 ) v k+1 = v k + 1 2 h( a k + a k+1 ) Trapezoid for position and velocity; globally second-order accurate CS 205A: Mathematical Methods Ordinary Differential Equations II 29 / 33

Central Differencing: β = 0, γ = 1 /2 v k+1 = y k+2 y k 2h a k+1 = y k+1 2 y k+1 + y k h 2 Central difference for position and velocity; globally second-order accurate CS 205A: Mathematical Methods Ordinary Differential Equations II 30 / 33

Newmark Schemes Generalizes large class of integrators Second-order accuracy (exactly) when γ = 1 /2 Unconditional stability when 4β > 2γ > 1 (otherwise radius is function of β, γ) CS 205A: Mathematical Methods Ordinary Differential Equations II 31 / 33

Staggered Grid y k+1 = y k + h v k+ 1/2 v k+ 3/2 = v k+ 1/2 + h a k+1 [ a k+1 = F t k+1, x k+1, 1 ] 2 ( v k+1/2 + v k+ 3/2) CS 205A: Mathematical Methods Ordinary Differential Equations II 32 / 33

Staggered Grid y k+1 = y k + h v k+ 1/2 v k+ 3/2 = v k+ 1/2 + h a k+1 [ a k+1 = F t k+1, x k+1, 1 ] 2 ( v k+1/2 + v k+ 3/2) Leapfrog: a not a function of v; explicit CS 205A: Mathematical Methods Ordinary Differential Equations II 32 / 33

Staggered Grid y k+1 = y k + h v k+ 1/2 v k+ 3/2 = v k+ 1/2 + h a k+1 [ a k+1 = F t k+1, x k+1, 1 ] 2 ( v k+1/2 + v k+ 3/2) Leapfrog: a not a function of v; explicit Otherwise: Symmetry in v dependence CS 205A: Mathematical Methods Ordinary Differential Equations II 32 / 33

Leapfrog Integration y 0 y 1 y 2 y 3 y 4 v 0 v1/2 v3/2 v5/2 v7/2 a 0 a 1 a 2 a 3 a 4 +t Next CS 205A: Mathematical Methods Ordinary Differential Equations II 33 / 33