Computational Methods for Design Lecture 3 – Elementary Differential Equations John A. Burns C...

Post on 11-Jan-2016

215 views 0 download

Tags:

Transcript of Computational Methods for Design Lecture 3 – Elementary Differential Equations John A. Burns C...

Computational Methods for Design Lecture 3 – Elementary Differential

Equations

John A. Burns

Center for Optimal Design And Control

Interdisciplinary Center for Applied MathematicsVirginia Polytechnic Institute and State University

Blacksburg, Virginia 24061-0531

A Short Course in Applied Mathematics

2 February 2004 – 7 February 2004

N∞M∞T Series Two Course

Canisius College, Buffalo, NY

Today’s Topics

Lecture 3 – Elementary Differential Equations A Review of the Basics Equilibrium Stability Dependence on Parameters: Sensitivity Numerical Methods

A Falling Object

( ) ( )F t ma t“Newton’s Second Law”

. y(t)

( ) ( ) ( ) ( ) ( )g dampmy t F t F t mg y t y t

)()()( tytym

gty

)()()( tvtvm

gtv

)()( tvty

0)0(

000,10)0(

v

y

{

{

AIR RESISTANCE

Height: y(t)

)(ty

Velocity: v(t)=y’(t)

)()( tytv

System of Differential Equations

)()(

)(

)(

)(tvtv

mg

tv

tv

ty

dt

d

)()()( tvtvm

gtv

)()( tvty

0)0(

000,10)0(

v

y

)()(

)(

)(

)()(

22

2

2

1

txtxm

g

tx

tx

tx

dt

dtx

dt

d

)(

)()(

2

1

tx

txtx

State Space

)()(

)(

)(

)()(

22

2

2

1

txtxm

g

tx

tx

tx

dt

dtx

dt

d

))(),((

))(),((

)(

)(

)(

)(

212

211

2

1

2

1

txtxf

txtxf

tx

txf

tx

tx

dt

d

2

0

0

2

1

)0(

)0(R

v

y

x

x

STATE SPACE

System of Differential Equations

2

2

1

)(

)()( R

tx

txtx

2

2

121 )(

)()(),()( R

tx

txftxtxftxf

)()( txftxdt

d

THE PHYSICS – BIOLOGY – CHEMISTRY IS FINDING 21, xxf

SELECTION OF THE “CORRECT STATE SPACE” IS A COMBINATION OF PHYSICS – BIOLOGY –

CHEMISTRY AND MATHEMATICS

Parameters

),,,,(),,,( 2122

2

mgxxfxx

mg

xmgxf

IN REAL PROBLEMS THERE ARE PARAMETERS

SOLUTIONS DEPEND ON THESE PARAMETERS

),,,( mgtx

WE WILL BE INTERESTED IN COMPUTINGSENSITIVITIES WITH RESPECT TO THESE PARAMETERS

),,,(

mgtx

MORE LATER

Logistics Equation

10)0( Rpp

)()(1

1)( 0 tptpK

rtpdt

d

LE

),),(()()(1

1)( 00 KrtpftptpK

rtpdt

d

ppK

rKrpf

11),,( 00

Analytical Solution

0 5 10 150

1000

2000

3000

4000

5000

6000

7000

8000

9000

10000

K

trepKp

KpKrtp

000

00 ),,(

Initial p0: 1 < p0 < 20,000

0 5 10 15 20 250

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2x 10

4

500,9 ,9163.0 Kr

1000 p

10 p

000,150 p

100 p

000,200 p

7500 p

15000 pK

Equilibrium States

)()(1

1)( 0 tptpK

rtpdt

d

LE

EQUILIBRIUM STATES ARE CONSTANT SOLUTIONS

constant a )( eptp

Kpp ee or 0

0)( tp

0)( tp ee ppK

r

110 0

0)( tp

0)( ee ptp Kptp ee )(

Equilibrium States

0 5 10 15 20 250

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

2x 10

4

Kpp ee or 0

K

0

UNSTABLE STABLE

A Falling Object

)()()( tvtvm

gtv

)()( tvty {

. y(t)

)()(0 tvtvm

g

)(0 tv

0

0

)(

)(

tv

ty

0 0

0gNO EQUILIBRIUM STATES

Terminal Velocity2 /

2 /

1( )

1

t g mmg mgt

t g m

ev t

e

220 ft/sec 150 m/hr

( ) ( )v t y t

A Falling Object

)(ty)()( tytv

terter vvm

g

0 /gmvter

)()()( tytym

gty (0) 10,000 (0) 0y y

Systems of DEs

)()(

)(

)(

)(

)(

)(

22

2

2

1

2

1

txtxm

g

tx

tx

txf

tx

tx

dt

d

n

nn

n

n

nn

R

txtxtxf

txtxtxf

txtxtxf

tx

tx

tx

f

tx

tx

tx

dt

d

))(),...(),((

))(),...(),((

))(),...(),((

)(

)(

)(

)(

)(

)(

21

212

211

2

1

2

1

MORE EQUATIONS

Epidemic Models SIR Models (Kermak – McKendrick, 1927)

Susceptible – Infected – Recovered/Removed

( ) ( ) ( )dS t S t I t

dt

( ) ( ) ( ) ( )dI t S t I t I t

dt

( ) ( )dR t I t

dt

( ) ( ) ( ) constantS t I t R t N

Epidemic Models SIR Models (Kermak – McKendrick, 1927)

Susceptible – Infected – Recovered/Removed

)()()( tItStSdt

d

)()()()( tItItStIdt

d

)()( tItRdt

d

)()(

)()(

)()(

3

2

1

tRtx

tItx

tStx

),,(

),,(

),,(

3213

3212

3211

2

221

21

3

2

1

xxxf

xxxf

xxxf

x

xxx

xx

x

x

x

f

)()()( 211 txtxtxdt

d

)()()()( 2212 txtxtxtxdt

d

)()( 23 txtxdt

d

Systems of DEs

n

nn

n

n

nn

R

txtxtxf

txtxtxf

txtxtxf

tx

tx

tx

f

tx

tx

tx

dt

d

))(),...(),((

))(),...(),((

))(),...(),((

)(

)(

)(

)(

)(

)(

21

212

211

2

1

2

1

)()( txftxdt

d

n

n

Rx

x

x

x

2

1

nn RRf :)(

Initial Value Problems

)()( txftxdt

d nRxtx 00 )(

MOST OF THE TIME WE FORGET THE ARROW

)()( txftxdt

d nRxtx 00 )(

AND f CAN DEPEND ON TIME t AND PARAMETERS q

qtxtftxdt

d),(,)( nRxtx 00 )(

Basic Results

A solution to the ordinary differential equation (Σ) is adifferentiable function

)(,)( txtftxdt

d(Σ)

nRbatx ),(:)(

defined on a connected interval (a,b) such that x(t)

satisfies (Σ) for all t (a,b).

2)()( txtxdt

d

ttx

1

1)(

1 ,1

1)(

t

ttxl

tt

txr 1 ,1

1)(

TWO SOLUTIONS

Solutions

-3 -2 -1 0 1 2 3 4-20

-15

-10

-5

0

5

10

15

20

1 ,1

1)(

t

ttxl

tt

txr 1 ,1

1)(

Initial Condition

-3 -2 -1 0 1 2 3 4-20

-15

-10

-5

0

5

10

15

20

1)0( x

1 ,1

1)(

t

ttxl

Basic Theorems

Theorem 1. Let f: Rn ---> Rn be a continuous function on a domain D Rn, and x0 D. Then there exists at least one solution to the initial value problem (IVP).

)(,)( txtftxdt

d nRxtx 00 )((IVP)

),...,(

),...,(

),...,(

),...,,(

21

212

211

21

nn

n

n

n

xxxf

xxxf

xxxf

xxxtf

),...,,( 21 nij

xxxtfx

TO GET UNIQUENESS WE NEED MORE

Basic Theorems

Theorem 2. If there is an open rectangle about (t0, x0) such that

is continuous at all points (t, x) , then there a unique solution to the initial value problem (IVP).

),...,,( 21 nij

xxxtfx

nR

t

x0

t0

)(tx

SIR Model

)()()( 211 txtxtxdt

d

)()()()( 2212 txtxtxtxdt

d

)()( 23 txtxdt

d

2

221

21

3213

3212

3211

),,(

),,(

),,(

x

xxx

xx

xxxf

xxxf

xxxf

21211 ),,,( xxxxf

12122

),,,( xxxfx

22121

),,,( xxxfx

0),,,( 2123

xxfx

12112

),,,( xxxfx

22111

),,,( xxxfx

0),,,( 2113

xxfx

221212 ),,,( xxxxxf

SIR Model

00

0

0

),,( 12

12

3,...13,..1

321

xx

xx

xxxfx

ji

ij

ALL ENTRIES ARE CONTINUOUS FOR ALL

),,,,( 321 xxx

Theorem 1. IS OK

A Falling Object

),,,,(

),,,,(),,,,(

212

211

22

2

21

mgxxf

mgxxfxx

mg

xmgxxf

2211 ),,,,( xmgxxf

0 ,)(

0 ,)(),,,,(

22

2

22

2

212

xxm

g

xxm

gmgxxf

0),,,,( 21

2111

xx

mgxxfx

1),,,,( 22

2112

xx

mgxxfx

NO PROBLEM SO FAR

A Falling Object

0 ,)(

0 ,)(),,,,(

22

2

22

2

212

xxm

g

xxm

gmgxxf

0),,,,( 2121

mgxxfx

0 ,2

0 ,2

),,,,(

22

22

2122 xx

m

xxmmgxxf

x

AGAIN … CONTINUOUS FOR ALL ),,,,( 21 mgxx

Theorem 1. IS OK

Parameter Dependence

n

mnn

mn

mn

mn R

qqqxxxf

qqqxxxf

qqqxxxf

qqqxxxf

),...,,,...,(

),...,,,...,(

),...,,,...,(

),...,,,...,(

2121

21212

21211

2121

nn RRqf :),(

),,,,(

),,,,(),,,,(

212

211

22

2

21

mgxxf

mgxxfxx

mg

xmgxxf

FOR THE FALLING OBJECT …

Examples: n=m=1

5)0( ),()( xtqxtxdt

d

qxqxf ),(

qqxfx

),(

CONTINUOUS EVERYWHEREqteqtxtx 5),()(

UNIQUE SOLUTION

1)0( ,)(

)(

xqt

txtx

dt

d

qt

xqxtf

),,(

qtqxf

x

1

),(

CONTINUOUS WHEN 0 qt

22 /)(),( qqqtqtxq

qqtqtxtx /)(),()(

UNIQUE SOLUTION

qtteqtxq

5),(

Logistic Equation

2

2121

1),,( x

qxqqqxf x

qqqqxf

x 2121

2),,(

)()(1

1)( 0 tptpk

rtpdt

d

0)0( pp

)()(1

1)(2

1 txtxq

qtxdt

d

0)0( xx

kqrqtptx 101 , ),()(

tqexqx

xqqqtx

1020

0221 ),,(

),,( 211

qqtxq

),,( 212

qqtxq

Numerical Methods

))(,()()( 1

kk

kk

txtft

txtx

FORWARD EULER

)(,)( txtftxdt

d nRxtx 00 )((IVP)

))(,()()( 1 kkkk txttftxtx

t0

x0

t

kt1t 2t 1kt

Explicit Euler

t0

x0

t

kt1t 2t 1kt

1))(,()()( 0001 xtxttftxtxdefine

2),()( 1112 xxttfxtxdefine

))(,()()( 1112 txttftxtx

1),()( 1 k

define

kk xxttfxtx kk

Explicit Euler

t0

x0

t

kt1t 2t 1kt

ihttth i 0 ,

),(1 kkkk xtfhxx

Example 1

tetx 21)( 0)0( ),()( xxtqxtx

dt

d

qtextx 0)(

Explicit Euler

h=.2

h=.01

h=.1

tetx 21)(

k

kkk

qxhx

xtfhxx

k

k

),(1

qtextx 0)( 0)0( ),()( xxtqxtxdt

d

Example 2

02 )0( ,)()( xxtxqtx

dt

d

ttx

1

1)(

Example 2

h=.2

h=.1

02 )0( ,)()( xxtxqtx

dt

d

]1[

][

),(2

1

kk

k

k

qxhx

xqhx

xtfhxx

k

kkk

Typical MATLAB m files

Eeuler_1.m Eeuler_2.m

Simple Example 3

101)( ,1

101)( ,)),((

tx

txtxf(t)x

10 )x(

0

10 ),10(101

100 ,1

tt

ttx(t)

10

1

10

Simple Example 3

10 x),(1 kkk xfhxx

hfhxfhxx 1),1(1),( 01 0

,epsh IF

10

1

PROBLEM ISFINITE PRECISION

ARITHMETIC

MESH REFINEMENTMAKES THE PROBLEM

WORSE

11... 11 hxxx kk

101 ,1

101 ,),(

x

xxf ),1(f

hx 11 1