ODE / IV Problems CS3220 - Summer 2008 Jonathan Kaldor - - PowerPoint PPT Presentation

ode iv problems
SMART_READER_LITE
LIVE PREVIEW

ODE / IV Problems CS3220 - Summer 2008 Jonathan Kaldor - - PowerPoint PPT Presentation

ODE / IV Problems CS3220 - Summer 2008 Jonathan Kaldor Differential Equations So far, we have looked at problems involving one or more variables, with either linear or nonlinear relationships between them A Differential Equation is


slide-1
SLIDE 1

ODE / IV Problems

CS3220 - Summer 2008 Jonathan Kaldor

slide-2
SLIDE 2

Differential Equations

  • So far, we have looked at problems involving
  • ne or more variables, with either linear or

nonlinear relationships between them

  • A Differential Equation is simply an equation

(or system of equations) that involves both variables and their derivatives

slide-3
SLIDE 3

Differential Equations

  • For instance, a differential equation might be:

dx/dt = sin(t x)

  • This says that the change of the variable x as

the variable t changes is according to the equation sin(t x).

  • In this case, we have two variables. We call t

the independent variable (it is the variable we can change) and x the dependent variable

slide-4
SLIDE 4

Differential Equations

  • As you might imagine, including derivatives
  • f variables as well as the variables

themselves complicates things further

  • The solution methods we’ve looked at so

far are not applicable in this case

  • Special case: when the derivative of x

depends only on t (i.e. dx/dt = f(t)), in which case we can use quadrature)

slide-5
SLIDE 5

Applications

  • Differential Equations appear everywhere
  • Wave propagation
  • Heat dissipation
  • Mechanics
slide-6
SLIDE 6

Applications

  • One of the most familiar rules of mechanics

is in fact a differential equation: Newton’s Second Law of Motion: F = ma (Force = Mass x Acceleration)

  • If the position of an object is denoted by x,

then its velocity (the change in position over time) is dx/dt. The acceleration is then the change in velocity over time, or d2x/dt2 (the second derivative of x w.r.t t)

slide-7
SLIDE 7

Applications

  • The second law of motion is then:

F = m d2x / dt2

  • Oftentimes, the force on an object depends
  • nly on the current position, velocity, and

time, giving us: F(x, dx/dt, t) = m d2x / dt2

  • This is a differential equation relating the

acceleration of an object to a function of its current position, velocity, and time

slide-8
SLIDE 8

Applications

  • Some examples of force functions:
  • Planetary motion (force is due to gravity,

which is dependent on positions alone)

  • Springs (again, force is due only to position
  • f object / compression of spring)
  • Air resistance (complex function, but the

faster something is moving the more resistance it experiences - dependent on velocity and position [higher up == less air])

slide-9
SLIDE 9

Classifications of Differential Equations

  • There are two main classifications of DE

problems: Ordinary Differential Equations (ODEs) and Partial Differential Equations (PDEs)

  • An ODE has only one independent variable,

and has derivatives with respect to that independent variable

slide-10
SLIDE 10

Classifications of Differential Equations

  • So, the example we discussed is an ODE:

there is a single independent variable (t) and

  • ne or more dependent variables (x) with

derivatives taken with respect to the independent variable only

  • A PDE consists of several independent

variables, with derivatives taken with respect to each other (so you may have x, y, dx/dy, dy/dx, etc...)

slide-11
SLIDE 11

Classification of Differential Equations

  • Examples of ODEs:

dx/dt = sin(t x) d2x/dt2 = - x / ‖x‖3

  • Examples of PDEs:

du/dt = d2u/dx2 (heat dissipation) d2u/dt2 = d2u/dx2 (wave propagation)

slide-12
SLIDE 12

Classifications of Differential Equations

  • We will focus solely on ODEs in this class
  • I will use x’ or x to denote the derivative
  • f a variable with respect to the

independent variable (i.e. dx/dt)

slide-13
SLIDE 13

Classifications of Differential Equations

  • We can also talk about systems of

differential equations, much like how we had systems of linear/nonlinear equations.

  • So, for instance, our Newtonian Mechanics

ODE can be expressed in the 2D plane as fx(x, y, dx/dt, dy/dt) = m d2x/dt2 fy(x, y, dx/dt, dy/dt) = m d2y/dt2

slide-14
SLIDE 14

Classifications of Differential Equations

  • As usual, it is much easier to represent this

using vector notation. We can represent systems of ODEs as f(x, x, ... , t) = 0 where x is now an n vector, and f represents a set of n equations. This is known as the implicit form of an ODE

slide-15
SLIDE 15

Explicit Form

  • We would also like to convert our problem

into explicit form: on the right hand side is the highest derivative used, and the left hand side is a function of the variables and all lower derivatives

  • In general, for an order-n ODE we then have

f(x, x’, ... x(n-1),t) = x(n)

  • For some ODEs, this is not possible (need

root finding strategies instead)

slide-16
SLIDE 16

Classifications of Differential Equations

  • Given an ODE, the order of the problem is

the highest derivative involved in the problem.

  • For instance, Newton’s Second Law of

Motion is an order-two ODE (because it involves the second derivative of position) F = m d2x / dt2

slide-17
SLIDE 17

Converting to Order 1

  • The methods we will look at assume that we

have a first order ODE. This appears to be a rather limiting requirement

  • Fortunately, any order-2 or higher method

can be converted to an equivalent order-1 ODE

slide-18
SLIDE 18

Converting to Order 1

  • Suppose we have an order-2 ODE in one

variable (so we have some d2x/dt2 term). Create a new variable y, and add the new equation y = dx/dt It then follows that dy/dt = d2x/dt2, so we havent changed the problem at all. However, if we replace all occurrences of d2x/dt2 with dy/dt, then we have reduced the

  • rder to 1
slide-19
SLIDE 19

Converting to Order 1

  • Example: F = ma
slide-20
SLIDE 20

Classifications of ODEs

  • One final classification: in order to solve

ODEs, we need to integrate (or approximate the integral).

  • Much like indefinite integrals, we end up with

a family of possible solutions - in order to end up with a single unique solution, we also need to specify additional constraints

slide-21
SLIDE 21

Classifications of ODEs

  • Two types of additional constraints are initial

values and boundary values

  • Initial values specify initial values for each
  • f the dependent variables. Boundary

values specify the behavior of the problem

  • n the boundaries (more common in

PDEs)

  • We will use initial value conditions
slide-22
SLIDE 22

Classifications of ODEs

  • For instance, in our F=ma ODE, there are a

family of possible solutions. In order to narrow it down to one, we need to specify an initial position and initial velocity

slide-23
SLIDE 23

Initial Value Problem

  • Given all of this, we can now express our

ODE in standard form: u = f(u,t) u0 = [initial conditions]

  • Note: this gives us a starting value, and a

function that gives us the derivative of the function at u,t

slide-24
SLIDE 24

Integrating ODEs

  • For simplicity, lets assume our ODE is a

single equation in one variable; i.e. we have x’ = f(x,t) x0 = [initial conditions]

  • We would like to find the function x(t) that

represents the value of x at each time t. Obviously, we have x(0) = x0

slide-25
SLIDE 25

Integrating ODEs

t x x0 f(x0, t0)

slide-26
SLIDE 26

Integrating ODEs

  • We have the function f(x, t) which tells us

how x changes as t changes (the slope of x relative to t). Given x(0) = x0, we’d like to find x1 = x(h), where h > 0 is the timestep

  • Easiest approach: use the derivative at x(0)

and assume the function is linear. Thus, x(h) = x0 + hf(x0, t0)

slide-27
SLIDE 27

Integrating ODEs

t x x0 f(x0, t0) x1 h

slide-28
SLIDE 28

Integrating ODEs

t x x0 f(x0, t0) x1 h f(x1, t1) h x2

slide-29
SLIDE 29

Integrating ODEs

  • This is known as Forward Euler:

for k = 1, 2, ... xk = xk-1 + h f(xk-1, tk-1) tk = tk-1 + h end

slide-30
SLIDE 30

Stability and Accuracy

  • This is obviously an approximation to the

actual ODE, controlled by the choice of stepsize h

  • Leads to two questions
  • Stability of integration
  • Accuracy of result
slide-31
SLIDE 31

Stability

  • We treat the derivative as effectively

constant for the length of the stepsize

  • What happens if the derivative changes

dramatically over the length of the stepsize?

slide-32
SLIDE 32

Stability

  • An example: lets take the Newtonian

Mechanics example and include a spring force

  • For a single particle, a spring force looks

like F = -(||x - c|| - rest) (x - c)/||x - c|| where x is the particle position, c is the center of the spring, and rest is the rest length

slide-33
SLIDE 33

Stability

  • If our stepsize is too large, the force can

change dramatically between xi and xi+1, but we aren’t aware of it -- we only “see” the new force at xi+1

  • If we step too far, we can end up with an

even larger force pushing back towards the center, which if we step too far again...

slide-34
SLIDE 34

Stability

  • (Example using Springies)
slide-35
SLIDE 35

Stability

  • Formally, we say that there are restrictions
  • n the choice of stepsize h in order to

ensure stability of the integration

  • Stability of a stepsize is problem

dependent AND method-dependent (we will look at other methods later)

slide-36
SLIDE 36

Stability

  • We can sometimes find analytical bounds for

the stepsize that ensure stability

  • Analyze the integration method on a toy

example

slide-37
SLIDE 37

Accuracy

  • Even when the integration is stable, there is

some amount of error due to the stepsize h

  • Ideally, we would like to have an error

estimate to allow us to intelligently choose the stepsize

slide-38
SLIDE 38

Accuracy

  • There are two ways of looking at the

accuracy: how much error is introduced when going from xi to xi+1 (local error), and how much error is introduced when going from x0 to xn (global error)

  • Local error: assume that xi is exact (zero

error), and see how much error is introduced when moving to xi+1

slide-39
SLIDE 39

Accuracy

  • Global error: how much error is there

comparing xn and x(tn), where x(t) is the true solution started at the initial condition x0 = x(0)