Differential Equations

Similar documents
Differential Equations

Physically Based Modeling: Principles and Practice Implicit Methods for Differential Equations

Runge-Kutta methods. With orders of Taylor methods yet without derivatives of f (t, y(t))

Physically Based Modeling Differential Equation Basics

Physically Based Modeling: Principles and Practice Differential Equation Basics

Chapter 8. Numerical Solution of Ordinary Differential Equations. Module No. 2. Predictor-Corrector Methods

AMS 147 Computational Methods and Applications Lecture 09 Copyright by Hongyun Wang, UCSC. Exact value. Effect of round-off error.

LIMITATIONS OF EULER S METHOD FOR NUMERICAL INTEGRATION

Numerical Analysis MTH603. dy dt = = (0) , y n+1. We obtain yn. Therefore. and. Copyright Virtual University of Pakistan 1

Differential equations. Differential equations

Finite Difference Methods Assignments

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

Logistic Map, Euler & Runge-Kutta Method and Lotka-Volterra Equations

Chapter 4: Numerical Methods for Common Mathematical Problems

1.72, Groundwater Hydrology Prof. Charles Harvey Lecture Packet #9: Numerical Modeling of Groundwater Flow

4.2 - Richardson Extrapolation

Lecture 21. Numerical differentiation. f ( x+h) f ( x) h h

Consider a function f we ll specify which assumptions we need to make about it in a minute. Let us reformulate the integral. 1 f(x) dx.

How to Find the Derivative of a Function: Calculus 1

Chapter XI. Solution of Ordinary Differential Equations

ETNA Kent State University

Copyright c 2008 Kevin Long

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

Function Composition and Chain Rules

The total error in numerical differentiation

HOMEWORK HELP 2 FOR MATH 151

(4.2) -Richardson Extrapolation

Chapter Seven The Quantum Mechanical Simple Harmonic Oscillator

Numerical Differentiation

New Streamfunction Approach for Magnetohydrodynamics

Name: Answer Key No calculators. Show your work! 1. (21 points) All answers should either be,, a (finite) real number, or DNE ( does not exist ).

Fall 2014 MAT 375 Numerical Methods. Numerical Differentiation (Chapter 9)

NUMERICAL SOLUTION OF ODE IVPs. Overview

Chapter 5 FINITE DIFFERENCE METHOD (FDM)

lecture 35: Linear Multistep Mehods: Truncation Error

. Compute the following limits.

A Brief Introduction to Numerical Methods for Differential Equations

NUMERICAL DIFFERENTIATION. James T. Smith San Francisco State University. In calculus classes, you compute derivatives algebraically: for example,

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

Blanca Bujanda, Juan Carlos Jorge NEW EFFICIENT TIME INTEGRATORS FOR NON-LINEAR PARABOLIC PROBLEMS

LIMITS AND DERIVATIVES CONDITIONS FOR THE EXISTENCE OF A LIMIT

Section 2.1 The Definition of the Derivative. We are interested in finding the slope of the tangent line at a specific point.

THE IDEA OF DIFFERENTIABILITY FOR FUNCTIONS OF SEVERAL VARIABLES Math 225

Mathematics 105 Calculus I. Exam 1. February 13, Solution Guide

Section 3: The Derivative Definition of the Derivative

The Verlet Algorithm for Molecular Dynamics Simulations

Simple ODE Solvers - Derivation

Application of numerical integration methods to continuously variable transmission dynamics models a

Implicit-explicit variational integration of highly oscillatory problems

Lesson 4 - Limits & Instantaneous Rates of Change

Ordinary Differential Equations

Robotic manipulation project

Fundamentals Physics

Chapter 6 - Ordinary Differential Equations

The Electron in a Potential

SECTION 3.2: DERIVATIVE FUNCTIONS and DIFFERENTIABILITY

ODE Runge-Kutta methods

We name Functions f (x) or g(x) etc.

Chap. 20: Initial-Value Problems

Constrained dynamics

2.11 That s So Derivative

Chapter 1D - Rational Expressions

Stability regions of Runge-Kutta methods. Stephan Houben Eindhoven University of Technology

2.8 The Derivative as a Function

Ordinary Differential Equations II

Solutions to the Multivariable Calculus and Linear Algebra problems on the Comprehensive Examination of January 31, 2014

Investigating Euler s Method and Differential Equations to Approximate π. Lindsay Crowl August 2, 2001

Logarithmic functions

Scientific Computing: An Introductory Survey

Solving Ordinary Differential equations

Quaternion Dynamics, Part 1 Functions, Derivatives, and Integrals. Gary D. Simpson. rev 01 Aug 08, 2016.

A = h w (1) Error Analysis Physics 141

An Approximation to the Solution of the Brusselator System by Adomian Decomposition Method and Comparing the Results with Runge-Kutta Method

Lecture 4: Numerical solution of ordinary differential equations

Dedicated to the 70th birthday of Professor Lin Qun

du(l) 5 dl = U(0) = 1 and 1.) Substitute for U an unspecified trial function into governing equation, i.e. dx + = =

Fundamentals of Concept Learning

A.P. CALCULUS (AB) Outline Chapter 3 (Derivatives)

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

Virtual Reality & Physically-Based Simulation

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

Introduction to Derivatives

3.4 Algebraic Limits. Ex 1) lim. Ex 2)

Numerical Methods for ODEs. Lectures for PSU Summer Programs Xiantao Li

= h. Geometrically this quantity represents the slope of the secant line connecting the points

Lab 6 Derivatives and Mutant Bacteria

MAT244 - Ordinary Di erential Equations - Summer 2016 Assignment 2 Due: July 20, 2016

Finite Difference Method

2.3 Product and Quotient Rules

5 Ordinary Differential Equations: Finite Difference Methods for Boundary Problems

Recall from our discussion of continuity in lecture a function is continuous at a point x = a if and only if

Calculus I Practice Exam 1A

Higher Derivatives. Differentiable Functions

Click here to see an animation of the derivative

Flavius Guiaş. X(t + h) = X(t) + F (X(s)) ds.

Ordinary Differential Equations

Butcher tableau Can summarize an s + 1 stage Runge Kutta method using a triangular grid of coefficients

Numerical Algorithms for ODEs/DAEs (Transient Analysis)

(5.5) Multistep Methods

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

Transcription:

Pysics-based simulation xi Differential Equations xi+1 xi xi+1 xi + x x Pysics-based simulation xi Wat is a differential equation? Differential equations describe te relation between an unknown function and its derivatives Newtonian laws gravity wind gust Differential equations Classes of DE xi+1 elastic force... x xi Ordinary differential equation (ODE) xi+1 xi + x Partial differential equation (PDE)

Ordinary differential equations Symbolic solutions An ODE is an equality involving a function and its derivatives known function ẋ(t) f(x(t)) time derivative state of te system Standard introductory differential equation courses focus on finding solutions analytically Linear ODEs can be solved by integral transforms Use DSolveeqn,x,t in Matematica Wat does it mean to solve an ODE? Differential equation: ẋ kx Solution: x e kt Numerical solutions Initial value problems In tis class, we will be concerned wit numerical solutions For eac iteration: 1. use f to calculate te derivative as te direction to next state. use tis direction to approximate cange x over a time interval t 3. increment x by x to obtain new value Derivative function f is regarded as a black box: given numerical values for x and t, returns a numerical value for ẋ In a canonical initial value problem, te beavior of te system is described by an ODE and its initial condition: ẋ f(x, t) x(t 0 ) x 0 To solve x(t) numerically, we start out from x 0 and follow te canges defined by f tereafter

Vector field x Integral curves Te differential equation can be visualized as a vector field Any point on te curve indicates te integral of f from t0 x f (x, t) f (x, t) t0 p x1 How does te vector field look like if f depends directly on time? Numerical metods Get confused yet? x! f (x, t)dt t0 Numerical metods Explicit metods Wat do we know about te system? Explicit Euler s metod Wat are we trying to solve? Te midpoint metod Runge-Kutta metod Implicit metods Implicit Euler s metod

Explicit Euler s metod How do we get to te next state from te current state? x(t0 + ) Problems of Euler s metod Inaccuracy x(t0 + ) x0 + x (t0 ) Te circle turns into a spiral no matter ow small te step size is Instead of following real integral curve, p follows a polygonal pat x(t0 ) p Discrete time step determines te errors Problems of Euler s metod Performance of Euler s metod Cost per step is determined by te number of evaluations per step Instability f kx Oscillation: At eac step, x(t) can be written in te form of Taylor series: Divergence: x(t0 + ) x(t0 ) + x (t0 ) + How small te step size as to be? n n x 3 x (t0 ) + x(3) (t0 ) +...! 3! n! tn Wat is te order of te error term in Euler s metod?

Te midpoint metod Performance of midpoint metod 1. Compute an Euler s step Prove tat te midpoint metod is correct witin O(3) x f (x(t0 )). Evaluate f at te midpoint fmid f (x(t0 ) + x ) 3. Take a step using fmid x(t0 + ) x(t0 ) + fmid x(t + ) x0 + f (x0 + f (x0 )) Runge-Kutta metod 4-stage 4t order Runge-Kutta Runge-Kutta is a numeric metod of integrating ODEs by using a trial step at te midpoint of an interval to cancel out lower-order error terms k1 k k3 k4 x(t0 + ) Te second order Runge-Kutta is known as te midpoint metod 1. f (x0, t0 ) q-stage p-order Runge-Kutta evaluates te derivative function q times in eac iteration and its approximation of te next state is correct witin O(p+1) f (x0, t0 ) f (x0 + k1, t0 + ) f (x0 + k, t0 + ) f (x0 + k3, t0 + ) x0 + 16 k1 + 13 k + 13 k3 + 16 k4 x0. f (x0 + x 3. f (x0 + t k, t0 + ) k1, t0 + ) x(t0 + ) 4. f (x0 + k3, t0 + )

Stage vs. order Adaptive step size p 1 3 4 5 6 7 8 9 10 q min(p) 1 3 4 6 7 9 11 1-17 13-17 Te minimum number of stages necessary for an explicit metod to attain order p is still an open problem Wy is fourt order te most popular Runge Kutta metod? Ideally, we want to coose as large as possible, but not so large as to give us big error or instability We can vary as we marc forward in time Step doubling Embedding estimate Variable step, variable order Step doubling Embedding estimate e Estimate Estimate x a by taking a full Euler step x a x 0 + f(x 0, t 0 ) x b by taking two alf Euler steps x temp x 0 + f(x 0, t 0 ) x b x temp + f(x temp, t 0 + ) e x a x b is bound by O( ) Also called Runge-Kutta-Felberg Compare two estimates of x(t 0 + ) Fift order Runge-Kutta wit 6 stages Fort order Runge-Kutta wit 6 stages Given error tolerance ɛ, wat is te optimal step size? ( ɛ e)1

Variable step, variable order Problems of explicit metods Cange between metods of different order as well as step based on obtained error estimates Tese metods are currently te last work in numerical integration Do not work well wit stiff ODEs Simulation explodes if te step size is too big Simulation progresses slowly if te step size is too small Example: a bead on te wire Stiff equations y(t) x(t) Y(t) (x(t), y(t)) Ẏ d dt ( x(t) y(t) ) ( x(t) ky(t) ) Stiffness constant: k Explicit Euler s metod: Y new Y 0 + Ẏ(t 0) ( x(t) y(t) ) ( x(t) + ky(t) ) Step size is limited by te largest k Systems tat as some big k s mixed in are called stiff system Y new ( (1 )x(t) (1 k)y(t) )

Implicit metods Implicit metod Explicit Euler: Y new Y 0 + f(y 0 ) Implicit Euler: Y new Y 0 + f(y new ) Our goal is to solve for Y new suc tat Y new Y 0 + f(y new ) Approximating f(y new ) by linearizing f(y) f(y new ) f(y 0 ) + Yf (Y 0 ), were Y Y new Y 0 Solving for Y new suc tat! f, at time t 0 +, points directly back at!!! Y 0 Y new Y 0 + f(y 0 ) + Yf (Y 0 ) ( ) 1 1 Y I f (Y 0 ) f(y 0 ) f(y, t) Ẏ(t) f (Y, t) Y(t) Y Example: A bead on te wire Example: A bead on te wire Apply te implicit Euler s metod to te bead-on-wire example ( ) 1 1 Y I f (Y 0 ) f(y 0 ) x(t) f(y(t)) ky(t) f (Y(t)) f(y(t)) Y 1+ Y 0 1+k 0 +1 0 0 1+k +1 x 0 1+k ky 0 1 0 0 k 1 x0 ky 0 x0 ky 0 Wat is te largest step size te implicit Euler s metod can take? lim Y lim +1 x 0 1+k ky 0 x 0 1 k ky 0 Y new Y 0 + ( Y 0 ) 0 x0 y 0

Implicit vs. explicit Second-order implicit Euler ẍ f(x(t), ẋ(t)) correct solution: x() e k x ẋ() kx() x(0) 1 d x(t) dt v(t) v(t) f(x, ẋ) explicit Euler: x() 1 k implicit Euler: x() 1 1 + k. I f f v f(x 0, ẋ 0 ) + f v x x v 0 Helpful ints Modular implementation Write solvers in terms of Reusable solver code Don t use explicit Euler s metod Do use adaptive step size Simple model implementation Generic operations: Get dim(x) Get/Set x and t Derivative evaluation at current (x, t)

Solver interface Summary GetDim How do we solve an ODE numerically? Wat are te drawbacks of Explicit Euler s metod? System Get/Set State Solver Wat is a stiff system? Deriv Eval Wy does implicit Euler allow us to take bigger steps tan explicit metods? Wat s next? How do we use Euler s metod to simulate te motion of a mass point? Wat are te equations of motion wen forces are applied to te mass point?