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

Similar documents
Differential Equations

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.

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

Preface. Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed.

Numerical Differentiation

Differential equations. Differential equations

The derivative function

Copyright c 2008 Kevin Long

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

Differential Calculus (The basics) Prepared by Mr. C. Hull

LIMITATIONS OF EULER S METHOD FOR NUMERICAL INTEGRATION

Material for Difference Quotient

Chapter 1D - Rational Expressions

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

Finite Difference Methods Assignments

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER /2019

Combining functions: algebraic methods

Practice Problem Solutions: Exam 1

Chapter Seven The Quantum Mechanical Simple Harmonic Oscillator

Logarithmic functions

Average Rate of Change

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

SECTION 3.2: DERIVATIVE FUNCTIONS and DIFFERENTIABILITY

Polynomials 3: Powers of x 0 + h

Taylor Series and the Mean Value Theorem of Derivatives

Precalculus Test 2 Practice Questions Page 1. Note: You can expect other types of questions on the test than the ones presented here!

LIMITS AND DERIVATIVES CONDITIONS FOR THE EXISTENCE OF A LIMIT

How to Find the Derivative of a Function: Calculus 1

Notes on wavefunctions II: momentum wavefunctions

Chapter 4: Numerical Methods for Common Mathematical Problems

(4.2) -Richardson Extrapolation

4.2 - Richardson Extrapolation

1 + t5 dt with respect to x. du = 2. dg du = f(u). du dx. dg dx = dg. du du. dg du. dx = 4x3. - page 1 -

Robotic manipulation project

2.1 THE DEFINITION OF DERIVATIVE

ETNA Kent State University

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 ).

REVIEW LAB ANSWER KEY

HOMEWORK HELP 2 FOR MATH 151

1 The concept of limits (p.217 p.229, p.242 p.249, p.255 p.256) 1.1 Limits Consider the function determined by the formula 3. x since at this point

2.3 Product and Quotient Rules

Physically Based Modeling: Principles and Practice Differential Equation Basics

2.8 The Derivative as a Function

Digital Filter Structures

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

Higher Derivatives. Differentiable Functions

232 Calculus and Structures

MAT 145. Type of Calculator Used TI-89 Titanium 100 points Score 100 possible points

Exam 1 Review Solutions

The Verlet Algorithm for Molecular Dynamics Simulations

lecture 26: Richardson extrapolation

2.3 More Differentiation Patterns

Solution. Solution. f (x) = (cos x)2 cos(2x) 2 sin(2x) 2 cos x ( sin x) (cos x) 4. f (π/4) = ( 2/2) ( 2/2) ( 2/2) ( 2/2) 4.

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

Rules of Differentiation

158 Calculus and Structures

0.1 Differentiation Rules

3.4 Worksheet: Proof of the Chain Rule NAME

Pre-Calculus Review Preemptive Strike

Exercises for numerical differentiation. Øyvind Ryan

Cubic Functions: Local Analysis

Differentiation in higher dimensions

Analytic Functions. Differentiable Functions of a Complex Variable

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

Order of Accuracy. ũ h u Ch p, (1)

Continuity and Differentiability Worksheet

5 Ordinary Differential Equations: Finite Difference Methods for Boundary Problems

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

7.1 Using Antiderivatives to find Area

. If lim. x 2 x 1. f(x+h) f(x)

The Derivative as a Function

Derivatives of trigonometric functions

Derivation Of The Schwarzschild Radius Without General Relativity

Lab 6 Derivatives and Mutant Bacteria

Math 34A Practice Final Solutions Fall 2007

Lecture XVII. Abstract We introduce the concept of directional derivative of a scalar function and discuss its relation with the gradient operator.

Math 31A Discussion Notes Week 4 October 20 and October 22, 2015

Section 3.1: Derivatives of Polynomials and Exponential Functions

ALGEBRA AND TRIGONOMETRY REVIEW by Dr TEBOU, FIU. A. Fundamental identities Throughout this section, a and b denotes arbitrary real numbers.

Finite Difference Method

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

Phase space in classical physics

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

Function Composition and Chain Rules

Gradient Descent etc.

Time (hours) Morphine sulfate (mg)

Section 2: The Derivative Definition of the Derivative

2.11 That s So Derivative

Quantum Mechanics Chapter 1.5: An illustration using measurements of particle spin.

Physically Based Modeling Differential Equation Basics

lecture 35: Linear Multistep Mehods: Truncation Error

Derivatives of Exponentials

Section 15.6 Directional Derivatives and the Gradient Vector

3.1 Extreme Values of a Function

Sin, Cos and All That

The total error in numerical differentiation

1 Calculus. 1.1 Gradients and the Derivative. Q f(x+h) f(x)

Math 102 TEST CHAPTERS 3 & 4 Solutions & Comments Fall 2006

Poisson Equation in Sobolev Spaces

INTRODUCTION AND MATHEMATICAL CONCEPTS

Transcription:

Pysically Based Modeling: Principles and Practice Implicit Metods for Differential Equations David Baraff Robotics Institute Carnegie Mellon University Please note: Tis document is 997 by David Baraff Tis capter may be freely duplicated and distributed so long as no consideration is received in return, and tis copyrigt notice remains intact

Implicit Metods for Differential Equations David Baraff Robotics Institute Carnegie Mellon University Implicit Metods Te metods we ave looked at for solving differential equations in te first section of tese notes (eg Euler s metod, te midpoint metod are all called explicit metods for solving ODE s However, sometimes an ODE can become stiff, in wic case explicit metods don t do a very good job of solving tem Wenever possible, it is desirable to cange your problem formulation so tat you don t ave to solve a stiff ODE Sometimes owever tat s not possible, and you ave just ave to be able to solve stiff ODE s If tat s te case, you ll usually ave to use an ODE solution metod wic is implicit Example Stiff ODE First, wat is te meaning and cause of stiff equations? Lets consider an example tat arises frequently in dynamics Suppose tat we ave a particle, wit position (x(t, y(t, and suppose tat we want te y-coordinate to always be zero One way of doing tis is to add a component ky(t to ẏ(t were k is a large positive constant If k is large enoug, ten te particle will never move too far away from y(t, since te ky(t term always brings y(t back towards zero However, lets assume tat tere is no restriction on te x-coordinate, and tat we want a user to be able to pull te particle arbitrarily along te x-axis So lets assume tat over some time interval our differential equation is simply Ẏ(t d dt ( x(t y(t ( x(t ky(t ( (We ll also assume tat te particle doesn t start exactly wit y Wat s appening ere is tat te particle is strongly attracted to te line y, and less strongly towards x If we solve te ODE far enoug forward in time, we expect te particle s location to converge towards (, and ten stay tere once it arrives Now suppose we use Euler s metod to solve te equation If we take a step of size,weget ( ( x x Y new Y + Ẏ(t + y ky Tis yields ( x x Y new y ky ( ( x ( ky E

If we look at te y component of tis equation, we see tat if k > ten te y new we compute will ave an absolute value wic is larger tan y In oter words, if k >, Euler s metod will not converge to an answer: eac step will result in a value of y new wic is larger tan te last Tecnically, Euler s metod is unstable for k > Tus, we better ave k > ork < 2 if we ope to converge Te largest step we can ope to take is less tan 2/k Now, if k is a large number, we ll ave to take very small steps Tis means tat te particle slides towards (, excruciatingly slowly Even toug te particle may nearly satisfy y, we ave to take suc small steps tat te particles progress along te x-axis is pretty muc nonexistent Tat s te embodiment of a stiff ODE In tis case, te stiffness arises from making k very large in order to keep te particle close to te line y Later on, wen we connect particles wit secondorder dynamics togeter wit springs, we ll experience exactly te same effect: stiff ODE s Even if we use a more sopisticated explicit metod suc as fourt-order Runge-Kutta, we may do a little better in te size of our steps, but we ll still ave major problems Now as we said above, te name of te game is to pose your dynamics problems so tat you don t experience stiff ODE s However, wen you can t, you ll ave to turn towards an implicit solution metod Te metod we ll sow below is te simplest of te implicit metods, and its based on taking an Euler step backwards 2 Solving Stiff ODE s Instead of writing Y new Y + f(y(t,weuseteformula Y new Y + f(y new ( 2 Tat is, we re going to evaluate f at te point we re aiming at, rater tan were we came from (If you tink about reversing te world and running everyting backwards, te above equation makes perfect sense Ten te equation says if you were at Y new, and took a step f(y new, you d end up at Y So if your differential equation represents a system tat is reversible in time, tis step makes sense It s just finding a point Y new suc tat if you ran time backwards, you d end up at Y So, we re looking for a Y new suc tat f, evaluated tere, times, points directly back at were we came from Unfortunately, we can t in general solve for Y new, unless f appens to be a linear function To cope wit tis, we ll replace f (Y new wit a linear approximation, again based on f s Taylor series Lets define Y by Y Y new Y Using tis, we rewrite equation ( 2 as or just Next, lets approximate f (Y + Y by Y + Y Y + f(y + Y Y f(y + Y f (Y + f (Y Y (Note tat since f (Y is a vector, te derivative f (Y is a matrix Using tis approximation, we can approximate Y wit Y ( f (Y + f (Y Y SIGGRAPH 97 COURSE NOTES E2 PHYSICALLY BASED MODELING

or Y f (Y Y f(y Rewriting tis as ( I f (Y Y f (Y, were I is te identity matrix, we can solve for Y as ( Y I f (Y f (Y ( 3 Computing Y new Y + Y is clearly more work tan using an explicit metod, since we ave to solve a linear system at eac step Wile tis would seem a serious weakness, computationally speaking, don t despair (yet For many types of problems, te matrix f will be sparse for example, if we are simulating a spring-lattice, f will ave a structure wic matces te connectivity of te particles As a result, it is usually possible to solve equation ( 3 in linear time (ie time proportional to te dimension of Y In suc cases, te payoff is dramatic: we can usually take considerably large timesteps witout losing stability (ie witout divergence, as appens wit te explicit case if te stepsize is too large Te time taken in solving eac linear system is tus more tan offset by te fact tat our timesteps are often orders of magnitude bigger tan we could manage using an explicit metod (Of course, te code needed to do all tis is muc more complicated tan in te explicit case; like we said, make your problems un-stiff if you can, and if not, pay te price Lets apply te implicit metod to equation ( We ave tat f (Y(t is ( x(t f (Y(t ky(t Differentiating wit respect to Y yields f (Y(t Y f (Y(t Ten te matrix I f (Y is ( + +k ( k ( + +k Inverting tis matrix, and multiplying by f (Y yields ( + ( Y x +k ky ( ( + x +k ky + x +k ky SIGGRAPH 97 COURSE NOTES E3 PHYSICALLY BASED MODELING

Wat is te limit on te stepsize in tis case? Te answer is: tere is no limit! In tis case, if we let grow to infinity, we get lim Y lim + x + k ky x k ky x ( y Tis means tat we acieve Y new Y + ( Y in a single step! For a general stiff ODE, we won t be able to take steps of arbitrary size, but we will be able to take muc larger steps using an implicit metod tan using an explicit metod Te extra cost of solving a linear equation is more tan made up by te time saved by taking large timesteps SIGGRAPH 97 COURSE NOTES E4 PHYSICALLY BASED MODELING