88
Chapter 20 Chapter 20 ODEs: ODEs: Initial-Value Initial-Value Problems Problems

Chapter 20 ODEs: Initial-Value Problems. There are ordinary differential equations - functions of one variable And there are partial differential

  • View
    235

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Chapter 20Chapter 20

ODEs: ODEs:

Initial-Value ProblemsInitial-Value Problems

Page 2: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

There are ordinary differential equations - functions of one variable

And there are partial differential equations - functions of multiple variables

2d vm

cg

dt

dv

2

2

x

u

x

uu

t

u

0

yx

2

2

2

Differential EquationsDifferential Equations

Page 3: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

1st order (falling parachutist)

2nd order (mass-spring system with damping)

etc.0kx

dt

dxc

dt

xdm

2

2

2d vm

cg

dt

dv

Order of differential equationsOrder of differential equations

Page 4: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Can always turn a higher order ODE into a set of 1st order ODEs

Example:

Let then

So solutions to first-order ODEs are important

tddt

dxc

dt

xdb

dt

xda

2

2

3

3

2

2

dt

xdz ,

dt

dxy

ydt

dx

zdt

dy

cybztda

1

dt

dz)(

Higher-Order ODE’sHigher-Order ODE’s

Page 5: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Linear: No multiplicative mixing of variables, no nonlinear functions

Nonlinear: anything else

0l

g

dt

d2

2

sin

2

2

x

u

x

uu

t

u

Linear and Nonlinear ODEsLinear and Nonlinear ODEs

Page 6: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

ODEs show up everywhere in engineering

Dynamics (Newton’s 2nd law)

Heat conduction (Fourier’s law)

Diffusion (Fick’s law)

m

F

dt

dv

dx

dTkq

dx

dcDJ

Ordinary Differential EquationsOrdinary Differential Equations

Page 7: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

•Example of an ODE )(

2

2tfkx

dt

dxc

dt

xdm

mk

c

f(t)x

f(t)kx

)(2

2tfkx

dt

dxc

dt

xdm

Free-bodydiagram m

What order is this ODE?

If f(t) = 0, ODE is homogenous.

If f(t) is not equal to 0, ODE is non-homogenous.

dxcdt

Page 8: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Solutions for ODEs

1 1 2 2

1 2

1 2

( ) ( ) ( )

& are two arbitrary constants and

( ) & ( ) are two solutions.

x t C S t C S t

C C

S t S t

general

The solution for the homogenous ODE.

The solution for the non-homogenous ODE

1 1 2 2( ) ( ) ( ) ( )

( ) is the solutions.

x t C S t C S t P t

P t

particular

The arbitrary constants C1 & C2 are determined by the Initial-value or Boundary-value conditions.

Page 9: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Initial-Value & Boundary-Value Conditions

For example at 0, 0 & 0.

The two conditions are all given at 0.

dxt x

dtt

The I-V Conditions All conditions are givenat the same value of the independent variable.

The numerical schemes for solving Initial-value and boundary-value are different.

The B-V Conditions Conditions are givenat the different values of the independent variable.

.5.0,1at &1,0at exampleFor xtxt

Page 10: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Euler’s and Heun's methods Runge-Kutta methods Adaptive Runge-Kutta Multistep methods* Adams-Bashforth-Moulton methods*

Ordinary Differential EquationsOrdinary Differential EquationsI-V ProblemsI-V Problems

Page 11: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Ordinary Differential EquationsOrdinary Differential Equations

1st order Ordinary differential equations (ODEs) Initial value problems

Numerical approximationsNew value = old value + slope × step size

00 yty ;ytfdt

dy )(),(

h yy i1i

Page 12: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Runge Kutta methods (One Step Methods)

Idea is that

New value = old value + slope*step size

Slope is generally a function of t, hence y(t)

Different methods differ in how to estimate

h yy i1i

Runge-Kutta MethodsRunge-Kutta Methods

Page 13: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

One-Step MethodOne-Step Method

h yy i1i

All one-step methods can be expressed in this general form, the only difference being the manner in which the slope is estimated

Page 14: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Initial ConditionsInitial Conditions

Same ODE, but with different initial conditions

The solution of ODE depends on

the initial condition

t

Page 15: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Euler’s methodEuler’s method((First-order Taylor Series MethodFirst-order Taylor Series Method))

Approximate the derivative by finite difference

Local truncation error

or

),(),( iii1iiii1i

i1i ythfyy ytftt

yy

dt

dy

1n1n

nnn

ni2i

ii1i h1n

yR Rh

n

yh

2

yhyyy

)!(

)(;

!

)()(

)(!

),(),(),(

)(1nnii

1n2iii

iii1i hOhn

ytfh

2

ytfhytfyy

Page 16: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Euler’s MethodEuler’s Method

Euler’s (Euler-Cauchy or point-slope) method

Use the slope at ti to predict yi+1

Page 17: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Euler’s methodEuler’s method

00 yy(t ytfydt

dy ));,(

t0 t1 t2 t3

yy0

h h h h h h

Straight line approximation

Page 18: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Example: Euler’s MethodExample: Euler’s Method

Analytic solution

Euler method

h = 0.50

1t0 1,0y ytdt

dy )(,

22 4 /t1y )(

ytf hfyy ii1i ,

251015050010150hf50y01y

01100.5)10,1.0hf0y0.5y

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

.)(()()()(

Page 19: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Example: Euler’s MethodExample: Euler’s Method

h = 0.25 ytf hfyy ii1i ,

39600119134717502501913471

1913471 750hf750y01y

1913471062515025006251

06251 50hf50y750y

062510125025001

01 250hf250y50y

01100.251

1.0 0,hf0y0.25y

.)..)(.(.

).,.().().(

.)..)(.(.

).,.().().(

.)..)(.(.

).,.().().(

.))((

)()()(

Page 20: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Euler’s method:Euler’s method:

10y ytydt

dy )(;

0 0.5 0.75 1.0

1

0.25

h = 0.5

h = 0.25

t

y

Page 21: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Euler’s Method (modified M-file)Euler’s Method (modified M-file)

Page 22: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

>> tt=0:0.01*pi:pi;

>> ye=1.5*exp(-tt)+0.5*sin(tt)-0.5*cos(tt);

>> [t,y]=Eulode('example2_f',[0 pi],1,0.1*pi);

step t y

1 0.0000000000 1.0000000000

2 0.3141592654 0.6858407346

3 0.6283185307 0.5674580652

4 0.9424777961 0.5738440394

5 1.2566370614 0.6477258022

6 1.5707963268 0.7430199565

7 1.8849555922 0.8237526182

8 2.1991148575 0.8637463173

9 2.5132741229 0.8465525934

10 2.8274333882 0.7652584356

11 3.1415926536 0.6219259596

>> H=plot(t,y,'r-o',tt,ye);

>> set(H,'LineWidth',3,'MarkerSize',12)

>> print -djpeg ode01.jpg

Euler’s MethodEuler’s Method

10y tydt

dy )(;sin

Page 23: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

10y tydt

dy )(;sin

Euler’s Method Euler’s Method ((h = 0.1h = 0.1))

Page 24: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

10y tydt

dy )(;sin

Euler’s Method Euler’s Method ((h = 0.05h = 0.05))

Page 25: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

There are

Local truncation errors - error from application at a single step

Propagated truncation errors - previous errors carried forward

The sum is “global truncation error”

Truncation ErrorsTruncation Errors

Page 26: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

x

y

o xi xi+1

yi

yi+1

Local error

xixi+1 xi+2

yi

yi+1

Global & Local Errors

Global error

x

y

o

Page 27: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Euler’s method uses Taylor series with only first order terms

The true local truncation error is

Approximate local truncation error - neglect higher order terms (for sufficiently small h)

)(...!

),( 1n2iit hOh

2

ytfE

Euler’s MethodEuler’s Method

)(!

),( 22iia hOh

2

ytfE

Page 28: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Runge-Kutta MethodsRunge-Kutta Methods

Higher-order Taylor series methods (see Chapra and Canale, 2002) -- need to compute the derivatives of f(t,y)

Runge-Kutta Methods -- estimate the slope without evaluating the exact derivatives

Heun’s methodMidpoint (or improved polygon) methodThird-order Runge-Kutta methodsFourth-order Runge-Kutta methods

Page 29: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Improvements of Euler’s method - Heun’s method

Euler’s method - derivative at the beginning of interval is applied to the entire interval

Heun’s method uses average derivative for the entire interval

A second-order Runge-Kutta Method

Heun’s MethodHeun’s Method

Page 30: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Heun’s method is a predictor-corrector method

Predictor

Corrector (may be applied iteratively)

hytfyy iii0

1i ),(

h2

ytfytfyy

01i1iii

i1i

),(),(

Heun’s MethodHeun’s Method

Page 31: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Heun’s MethodHeun’s Method

Predictor Corrector

Iterate the corrector of Heun’s method to obtain an improved estimate

Page 32: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Heun’s Method with Iterative CorrectorsHeun’s Method with Iterative Correctors

Page 33: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Heun’s Method with Iterative CorrectorsHeun’s Method with Iterative Correctors» te=0:0.02*pi:pi; ye=example2_e(xe);» [t1,y1]=Euler('example2_f',[0 pi],1,0.1*pi);» [t2,y2]=Heun_iter('example2_f',[0 pi],1,0.1*pi,0);» [t3,y3]=Heun_iter('example2_f',[0 pi],1,0.1*pi,5);» H=plot(te,ye,t1,y1,'r-d',t2,y2,'g-s',t3,y3,'m-o');» set(H,'LineWidth',3,'MarkerSize',12)» [te' ye' y1',y2',y3'] t yEuler yHeun yHeun_iter ytrue 0 1.0000 1.0000 1.0000 1.0000 0.3142 0.6858 0.7837 0.7704 0.7746 0.6283 0.5675 0.7018 0.6830 0.6896 0.9425 0.5738 0.7064 0.6872 0.6951 1.2566 0.6477 0.7559 0.7395 0.7479 1.5708 0.7430 0.8152 0.8036 0.8118 1.8850 0.8238 0.8565 0.8503 0.8578 2.1991 0.8637 0.8592 0.8584 0.8648 2.5133 0.8466 0.8112 0.8149 0.8199 2.8274 0.7653 0.7082 0.7154 0.7188 3.1416 0.6219 0.5540 0.5631 0.5648

Page 34: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Heun’s Method with Iterative CorrectorsHeun’s Method with Iterative Correctors

Euler’s

Heun’s with 5 iterations

Exact

Heun’s method

10y tydt

dy )(;)sin(

t

Page 35: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Example: Heun’s MethodExample: Heun’s Method h = 0.5

First Step

1331150133115010501h2

ytfytfyy : Corrector th5

1331150133015010501h2

ytfytfyy : Corrector 4th

1330150132615010501h2

ytfytfyy :Corrector 3rd

1326150125015010501h2

ytfytfyy Corrector 2nd

1250150015010501h2

ytfytfyy : Corrector 1st

0150101hytfyy :Preditor

41100

051

31100

041

21100

031

11100

021

01100

011

00001

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

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

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

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

:

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

.).)((),(

1t0 1,0y ytdt

dy )(,

Page 36: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Example: Heun’s MethodExample: Heun’s Method h = 0.5

Second Step

580415058041011331150501h2

ytfytfyy : Corrector th5

580415058031011331150501h2

ytfytfyy : Corrector 4th

580315057861011331150501h2

ytfytfyy :Corrector 3rd

578615056191011331150501h2

ytfytfyy Corrector 2nd

561915039921011331150501h2

ytfytfyy : Corrector 1st

3992150133115013311hytfyy :Preditor

42211

152

32211

142

22211

132

12211

122

02211

112

11102

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

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

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

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

:

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

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

1x0 1,0y ytdt

dy )(,

Page 37: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

» [t1,y1]=Eulode('example3',[0 5],1,0.5);

» [t2,y2]=Heun_iter('example3',[0,5],1,0.5,0);

» [t3,y3]=Heun_iter('example3',[0 5],1,0.5,5);

» [t1' y1' y2' y3' ye']

t yEuler yHeun yHeun_iter ytrue 0 1.0000 1.0000 1.0000 1.0000 0.5000 1.0000 1.1250 1.1331 1.1289 1.0000 1.2500 1.5523 1.5804 1.5625 1.5000 1.8090 2.4169 2.4859 2.4414 2.0000 2.8178 3.9463 4.0882 4.0000 2.5000 4.4964 6.4619 6.7192 6.5664 3.0000 7.1470 10.3793 10.8046 10.5625 3.5000 11.1570 16.2082 16.8630 16.5039 4.0000 17.0024 24.5532 25.5065 25.0000 4.5000 25.2492 36.1126 37.4407 36.7539 5.0000 36.5552 51.6796 53.4643 52.5625

5t0 1,0y ytdt

dy )(,Example:Example:

Page 38: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Midpoint MethodMidpoint Method

hytfyy

ytfy2

hytfyy

21i21ii1i

21i21i21iiii21i

),(

),(;),(

//

////

Improved Polygon or Modified Euler Method Use the slope at midpoint to represent the average slope

Page 39: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Runge-Kutta Runge-Kutta ((RKRK)) Methods Methods

One-Step Method with general form

Where is an increment function which represents the weighted-average slope over the interval

Where a’s are constants and k’s are slopes evaluated at selected x locations

h hytyy iii1i ),,(

nn2211 kakaka

Page 40: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Runge-Kutta (RK) MethodsRunge-Kutta (RK) Methods One-Step Method General Form of nth-order Runge-Kutta Method

Where p’s and q’s are constants k’s are recurrence relationships

),(

),(

),(

),(

,,, hkqhkqhkqyhptfk

hkqhkqyhptfk

hkqyhptfk

ytfk

kakaka

h yy

1n1n1n221n111ni1nin

222121i2i3

111i1i2

ii1

nn2211

i1i

Page 41: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Second-Order RK MethodsSecond-Order RK Methods Taylor series expansion

Compare to the second-order Taylor formula

Three equations for four unknowns (a1, a2, k1, q11)

)()(

),(),()()(

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

),(

y111t121

111121

y111t111112

1

hfkqhfpfafahty

hkqyhptfaytfahtyhty

ytfhkqytfhpytfhkqyhptfk

ytfk

))(()()( yt2 fff/2hhftyhty

1/2qa

1/2pa

1aa

f/2)f(hffhqafhkqa

/2)f(hfhpa

1aa

112

12

21

y2

y2

112y2

1112

t2

t2

12

21

Page 42: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Second-Order RK MethodsSecond-Order RK Methods

Second-order version of Runge-Kutta Methods

3 equations for 4 unknowns

),(

),(

)(

hkqyhptfk

ytfk

hkakayy

111i1i2

ii1

2211i1i

21qa

21pa

1aa

112

12

21

/

/

Page 43: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Second-Order RK MethodsSecond-Order RK Methods

General Second-order Runge-Kutta methods

k1

k2

xi xi+p1h xi+1

= xi+h

hkakayy

hkqyhptfk

fytfk

2211i1i

111i1i2

1ii1

)(

),(

),(

Weighted-average slopeWeighted-average slope

a1 k1 + a2 k2

Page 44: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Heun’s MethodHeun’s Method

Heun’s method with a single corrector (a2 = 1/2):

Choose a2 = 1/2 and solve for the other 3 constants

a1 = 1/2, p1 = 1, q11 = 1

hk2

1k

2

1yy

hkyhtfk

ytfk

21i1i

1ii2

ii1

),(

),(

Use average slope over the interval

Page 45: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Midpoint MethodMidpoint Method Another Second-order Runge-Kutta method Choose a2 = 1 a1 = 0, p1 = 1/2, q11 = 1/2

k1

k2

xi xi+1/2 xi+1

hkyy

hk2

1y

2

htfk

ytfk

2i1i

1ii2

ii1

),(

),(

Page 46: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Midpoint Midpoint ((2nd-order RK2nd-order RK)) Method Method

Page 47: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Midpoint Midpoint ((2nd-order RK2nd-order RK)) Method Method>> [t,y] = midpoint('example2_f',[0 pi],1,0.05*pi); step t y 1 0.0000000000 1.0000000000 2 0.1570796327 0.8675816988 3 0.3141592654 0.7767452235 4 0.4712388980 0.7206165079 5 0.6283185307 0.6927855807 6 0.7853981634 0.6872735266 7 0.9424777961 0.6985164603 8 1.0995574288 0.7213629094 9 1.2566370614 0.7510812520 10 1.4137166941 0.7833740988 11 1.5707963268 0.8143967658 12 1.7278759595 0.8407772414 13 1.8849555922 0.8596353281 14 2.0420352248 0.8685989204 15 2.1991148575 0.8658156821 16 2.3561944902 0.8499586883 17 2.5132741229 0.8202249154 18 2.6703537556 0.7763257790 19 2.8274333882 0.7184692359 20 2.9845130209 0.6473332788 21 3.1415926536 0.5640309524>> tt = 0:0.01*pi:pi; yy = example2_e(tt);>> H = plot(t,y,'r-o',tt,yy);>> set(H,'LineWidth',3,'MarkerSize',12);

10y

tydt

dy

)(

)sin(

Page 48: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Midpoint Midpoint ((RK2RK2)) Method Method

10y tydt

dy )(;)sin(

Page 49: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Ralston’s MethodRalston’s MethodSecond-order Runge-Kutta methodChoose a2 = 2/3 a1 = 1/3, p1 = q11 = 3/4

k1

k2

ti ti+3h/4 xi+1 = ti+h

hk3

2k

3

1yy

hk4

3yh

4

3tfk

ytfk

21i1i

1ii2

ii1

)(

),(

),(

k1/3 + 2k2/3

Page 50: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Third-Order Runge-Kutta MethodThird-Order Runge-Kutta MethodGeneral form

Weighted slope

hkakakayy

hkqhkqyhptfk

hkqyhptfk

ytfk

332211i1i

222121i2i3

111i1i2

ii1

)(

),(

),(

),(

332211 kakaka

Page 51: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Third-Order Runge-Kutta MethodsThird-Order Runge-Kutta Methods

General Third-order Runge-Kutta methods

k1

k2

ti ti+p1h ti+1 = ti+hti+p2h

k3

Weighted-average value of three slopes k1 , k2 , k3

Page 52: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Third-order Runge-Kutta MethodsThird-order Runge-Kutta Methods

hk3k3k28

1yy

hk3

2yh

3

2tfk

hk3

2yh

3

2tfk

ytfk

321i1i

2ii3

1ii2

ii1

)(

),(

),(

),(

hk4k3k29

1yy

hk4

3yh

4

3tfk

hk2

1yh

2

1tfk

ytfk

321i1i

2ii3

1ii2

ii1

)(

),(

),(

),(

Nystrom Method Nearly Optimum MethodNystrom Method Nearly Optimum Method

Page 53: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

33rdrd-order -order Runge-Kutta MethodRunge-Kutta Method

hkk4k6

1yy

hk2hkyhtfk

hk2

1yh

2

1tfk

ytfk

321i1i

21ii3

1ii2

ii1

)(

),(

),(

),(

Reduce to Simpson’s 1/3 rule for f = f(t)

Page 54: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

33rdrd-Order Heun Method-Order Heun Method

hk3k4

1yy

hk3

2yh

3

2tfk

hk3

1yh

3

1tfk

ytfk

31i1i

2ii3

1ii2

ii1

)(

),(

),(

),(

Page 55: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Classical 4th-orderClassical 4th-orderRunge-Kutta MethodRunge-Kutta Method

hkk2k2k6

1yy

hkyhtfk

hk2

1yh

2

1tfk

hk2

1yh

2

1tfk

ytfk

4321i1i

3ii4

2ii3

1ii2

ii1

)(

),(

),(

),(

),(

One-step method

Reduce to Simpson’s 1/3 rule for f = f(t)

Page 56: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Classical 4th-orderClassical 4th-orderRunge-Kutta MethodRunge-Kutta Method

ti ti + h/2 ti + h

k1

k2

k3

k4

)( 4321 kk2k2k6

1

Page 57: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

%)..

).(.).().()(

...).,.(),(

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

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

),(

00180( 1288851

50531236025769402250206

11hkk2k2k

6

1yy

53123601288471501288471 50f hkyhtfk

25769400625125006251 250f hk50yh50tfk

250125001 250f hk50yh50tfk

01.00 ytfk

t

432101

3004

2003

1002

001

1t0 1,y(0) ytdt

dy ,

Example: Classical Example: Classical 4th-order RK Method4th-order RK Method

h = 0.5

First step, t = 0.5

Page 58: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

%)..

).(.).().(..

)(

...).,.(),(

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

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

.),(

00560( 56241271

502501588186802420284243960253123606

11288851

hkk2k2k6

1yy

250158815628971015628971 01f hkyhtfk

8680242033949517503394951 750f hk50yh50tfk

8424396026169717502616971 750f hk50yh50tfk

53123601.1288850.5 ytfk

t

432101

3114

2113

1112

111

Example: Classical Example: Classical 4th-order RK Method4th-order RK Method

Second step, t = 1.0

Page 59: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Fourth-Order Runge-Kutta MethodFourth-Order Runge-Kutta Method

Page 60: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Fourth-Order Runge-Kutta MethodFourth-Order Runge-Kutta Method>> tt=0:0.01*pi:pi; yy=example2_e(tt);>> [t,y]=RK4('example2_f',[0 pi],1,0.05*pi); step t y 1 0.0000000000 1.0000000000 2 0.1570796327 0.8663284784 3 0.3141592654 0.7745866433 4 0.4712388980 0.7178375776 5 0.6283185307 0.6896194725 6 0.7853981634 0.6839104249 7 0.9424777961 0.6951106492 8 1.0995574288 0.7180384347 9 1.2566370614 0.7479364401 10 1.4137166941 0.7804851708 11 1.5707963268 0.8118207434 12 1.7278759595 0.8385543106 13 1.8849555922 0.8577907953 14 2.0420352248 0.8671448731 15 2.1991148575 0.8647524420 16 2.3561944902 0.8492761286 17 2.5132741229 0.8199036965 18 2.6703537556 0.7763385417 19 2.8274333882 0.7187817811 20 2.9845130209 0.6479057500 21 3.1415926536 0.5648190301>> H=plot(x,y,'r-o',xx,yy);>> set(H,'LineWidth',3,'MarkerSize',12);

10y

tydt

dy

)(

)sin(

Page 61: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Fourth-Order Runge-Kutta MethodFourth-Order Runge-Kutta Method

10y tydt

dy )(;)sin(

Page 62: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Numerical AccuracyNumerical Accuracy» » tt=0:0.01*pi:pi; yy=example2_e(tt);

» t0=0; y0=example2_e(t0);

» t1=0.1*pi; y1=example2_e(t1);

» [t,ya]=Eulode('example2_f',[0 pi],y0,0.1*pi);

» [t,yb]=midpoint('example2_f',[0 pi],y0,y1,0.1*pi);

» [t,yc]=Heun_iter('example2_f',[0 pi],y0,0.1*pi,5);

» [t,yd]=RK4('example2_f',[0 pi],y0,0.1*pi);

» H=plot(t,ya,'m-*',t,yb,'c-d',t,yc,'g-s',t,yd,'r-O',tt,yy);

» set(H,'LineWidth',3,'MarkerSize',12);

»

» [t,ya]=Eulode('example2_f',[0 pi],y0,0.05*pi);

» [t,yb]=midpoint('example2_f',[0 pi],y0,y1,0.05*pi);

» [t,yc]=Heun_iter('example2_f',[0 pi],y0,0.05*pi,5);

» [t,yd]=RK4('example2_f',[0 pi],y0,0.05*pi);

» H=plot(t,ya,'m-*',t,yb,'c-d',t,yc,'g-s',t,yd,'r-O',tt,yy);

» set(H,'LineWidth',3,'MarkerSize',12);

» print -djpeg075 ode06.jpg

h = 0.1

h = 0.05

10y tydt

dy )(;)sin(

Page 63: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Numerical AccuracyNumerical Accuracy

EulerEuler

MidpointMidpoint

Heun (iterative)Heun (iterative)

RK4RK4 h = 0.1

10y tydt

dy )(;)sin(

Page 64: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Numerical AccuracyNumerical Accuracy

h = 0.05

EulerEuler

MidpointMidpoint

Heun (iterative)Heun (iterative)

RK4RK4

10y tydt

dy )(;)sin(

Page 65: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Butcher’s sixth-order Butcher’s sixth-order Runge-Kutta MethodRunge-Kutta Method

i 1 1 2 4 5 6

1

2 1

3 1 2

4 2 3

5 1 4

6 1 2 3 4 5

1 (7 32 12 32 7 )

90( , )

1 1( , )

4 41 1 1

( , )4 8 81 1

( , )2 23 3 9

( , )4 16 8

3 2 12 12 8( , )

7 7 7 7 7

i

i i

i i

i i

i i

i i

i i

y y k k k k k

k f t y

k f t h y k h

k f t h y k h k h

k f t h y k h k h

k f t h y k h k h

k f t h y k h k h k h k h k h

Page 66: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

System of ODEsSystem of ODEs

A system of simultaneous ODEsn equations with n initial conditions

),,,,(

),,,,(

),,,,(

n21nn

n2122

n2111

yyytfdt

dy

yyytfdt

dy

yyytfdt

dy

Page 67: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

System of ODEsSystem of ODEs

Bungee Jumper’s velocity and positionTwo simultaneous ODEs

00v0x

vm

cg

dt

dv

vdt

dx

2d

)()(

tm

gc

c

mtx

tm

gc

c

gmtv

d

d

d

d

coshln)(

tanh)(

Page 68: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Second-Order ODESecond-Order ODE

Convert to two first-order ODEs

1000

2

2

)(tdt

dy ty

dt

dyytg

dt

yd

,)(

),,(

102

001

212

22

21

2

1

ty

ty sCI

yytgdt

yd

dt

dy

ydt

dy

dt

dy

dt

dyy

yy let

)(

)(..

),,(

Page 69: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

System of Two first-order ODEsSystem of Two first-order ODEsEuler’s MethodEuler’s Method

Any method considered earlier can be usedEuler’s method for two ODE-IVPsBasic Euler method

Two ODE-IVPs

yythfyy

yythfyy

i2i1i2i21i2

i2i1i1i11i1

),,(

),,(

,,,,

,,,,

),( iii1i ythfyy

Page 70: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Hand Calculations: Euler’s MethodHand Calculations: Euler’s Method

Solve the following ODE from t = 0 to t = 1 with h = 0.5

Euler method

71575096303104 96h50y300.50.1y4 0.5y1.0y

2520.530.53h0.50.5y 0.5y1.0y

96506304104 6h0y3000.1y4 0y0.5y

3(0.5)0.5)(4)4h00.5y 0y0.5y

hy30y104yhyytfyy

hy50yhyytfyy

2122

111

2122

111

i2i1i2i2i1i2i21i2

i1i1i2i1i1i11i1

.).().(.)(..).(.)()()(

.)())(()()()(

.).()(.)(.)(.)()()(

()()()(

)..(),,(

).(),,(

,,,,,,,

,,,,,,

60y

40y

y30y104dt

dy

y50dt

dy

2

1

212

11

)(

)(

..

.

Page 71: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Euler’s Method for a System of ODEsEuler’s Method for a System of ODEs

y is a column vector with n variables

Page 72: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

function f = example5(t,y)% dy1/dt = f1 = -0.5 y1% dy2/dt = f2 = 4 - 0.1*y1 - 0.3*y2% let y(1) = y1, y(2) = y2% tspan = [0 1]% initial conditions y0 = [4, 6]f1 = -0.5*y(1);f2 = 4 - 0.1*y(1) - 0.3*y(2);f = [f1, f2]';

Euler Method for a System of ODEsEuler Method for a System of ODEs

>> [t,y]=Euler_sys('example5',[0 1],[4 6],0.5); t y1 y2 y3 ... 0.000 4.0000000000 6.0000000000 0.500 3.0000000000 6.9000000000 1.000 2.2500000000 7.7150000000

>> [t,y]=Euler_sys('example5',[0 1],[4 6],0.2); t y1 y2 y3 ... 0.000 4.0000000000 6.0000000000 0.200 3.6000000000 6.3600000000 0.400 3.2400000000 6.7064000000 0.600 2.9160000000 7.0392160000 0.800 2.6244000000 7.3585430400 1.000 2.3619600000 7.6645424576

(h = 0.5)

(h = 0.2)

Page 73: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Euler Method for Second-Order ODEEuler Method for Second-Order ODE

function f = pendulum(t,y)

% nonlinear pendulum d^2y/dt^2 + 0.3dy/dt = -sin(y)

% convert to two first-order ODEs

% dy1/dt = f1 = y2

% dy2/dt = f2 = -0.1*y2 - sin(y1)

% let y(1) = y1, y(2) = y2

% tspan = [0 15]

% initial conditions y0 = [pi/2, 0]

f1 = y(2);

f2 = -0.3*y(2) - sin(y(1));

f = [f1, f2]';

122

22

21

2

1

2

2

yy30ydt

dy30

dt

yd

dt

dy

ydt

dy

dt

dy

dt

dyy

yy let

ydt

dy30

dt

yd

sin.sin.

sin. Nonlinear Pendulum

Page 74: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Euler’s Method for Second-Order ODEEuler’s Method for Second-Order ODE

» [t,y1]=Euler_sys('pendulum',[0 15],[pi/2 0],15/100);» [t,y2]=Euler_sys('pendulum',[0 15],[pi/2 0],15/200);» [t,y3]=Euler_sys('pendulum',[0 15],[pi/2 0],15/500);» [t,y4]=Euler_sys('pendulum',[0 15],[pi/2 0],15/1000);» H=plot(t1,y1(:,1),t2,y2(:,1),t3,y3(:,1),t4,y4(:,1))

n = 100

n = 200

n = 500

n = 1000

Nonlinear Pendulum

Page 75: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Higher Order ODEsHigher Order ODEsIn general, nth-order ODE

αty ,y,,y,yt,fy

αty yy

αty yy

αty yy

yy

yy

yy

yy

let

1n0nn21n

20343

10232

00121

1nn

3

2

1

)()(

)(,

)(,

)(,

)(

1n01n

1000

1nn

ty ty ty

yyyytfy

)(,,)(,)(

),,,,,()(

)()(

Page 76: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

System of First-Order ODE-IVPsSystem of First-Order ODE-IVPs

Example

Convert to three first-order ODE-IVPs

10y 40y 20y

y5y3ty4tyyytfy 2

)(,)(,)(

),,,(

),(

)(

)(

)(

),,,(

),,,(

),,,(

ytfy Notation Vector In

10y

40y

20y

y5y3ty4tyyytfy

yyyytfy

yyyytfy

3

2

1

3212

32133

332122

232111

22321 dtydyy dy/dt,yy y,y let /

Page 77: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Euler’s Method for Systems ofEuler’s Method for Systems of First-Order ODEs First-Order ODEs

Euler’s Method

Example

10y 40y 20y

y5y3ty4tyyytfy 2

)(,)(,)(

),,,(

hiyiyiyitfiy1iy

hiyiyiyitfiy1iy

hiyiyiyitfiy1iy

321333

321222

321111

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

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

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

10y

40y

20y

y5y3ty4ty

yy

yy

3

2

1

3212

3

32

21

)(

)(

)(

Page 78: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Example: Euler’s MethodExample: Euler’s Method

First step: t(0) = 0, t(1) = 0.5 (h = 0.5)

Second step: t(1) = 0.5, t(2) = 1.0

5250154320401

0y50y30y0400yh0f0y1y

545014h0y0yh0f0y1y

045042h0y0yh0f0y1y

2

3212

3333

32222

21111

.).()()())(()(

)()()()()()()()(

.).)(()()()()()(

.).)(()()()()()(

3751150525543045045052

h1y51y31y504501yh1f1y2y

253505254h1y1yh1f1y2y

256505404h1y1yh1f1y2y

2

3212

3333

32222

21111

.).().().().)(.().(.

)()()().().()()()()(

.).)(.(.)()()()()(

.).)(.(.)()()()()(

Page 79: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Classical 4Classical 4thth-order Runge-Kutta Method -order Runge-Kutta Method for Systems of ODE-IVPsfor Systems of ODE-IVPs

1,1 1 1 2

1,2 2 1 2

* * *2,1 1 1 1,1 2 1,2 1 1 2

* * *2,2 2 1 1,1 2 1,2 2 1 2

( ( ), ( ), ( ))

( ( ), ( ), ( ))

k f (t( ) h/2, y ( ) k h/2, y ( ) k h/2) f (t ( ),y ( ),y ( ))

k f (t( ) h/2, y ( ) k h/2, y ( ) k h/2) f (t ( ),y ( ),y ( ))

k f t i y i y i

k f t i y i y i

i i i i i i

i i i i i i

* ** **

3,1 1 1 2,1 2 2,2 1 1 2

* ** **3,2 2 1 2,1 2 2,2 2 1 2

4,1 1 1 3,1 2

k f (t( ) h/2, y ( ) k h/2, y ( ) k h/2) f (t ( ),y ( ),y ( ))

k f (t( ) h/2, y ( ) k h/2, y ( ) k h/2) f (t ( ),y ( ),y ( ))

k f (t( ) h, y ( ) k h, y ( )

i i i i i i

i i i i i i

i i i

** *** ***

3,2 1 1 2

** *** ***4,2 2 1 3,1 2 3,2 2 1 2

k h) f (t ( ),y ( ),y ( ))

k f (t( ) h, y ( ) k h, y ( ) k h) f (t ( ),y ( ),y ( ))

i i i

i i i i i i

hkk2k2k6

1iy1iy

hkk2k2k6

1iy1iy

2423222122

1413121111

)()()(

)()()(

,,,,

,,,,

Applicable for any number of equations

2 equations

Page 80: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Hand Calculations: RK4 MethodHand Calculations: RK4 Method

Solve the following ODE from t = 0 to t = 1 with h = 0.5

Classical RK4 method

7151456305310445653250fyy250fk

751535045653250fyy250fk

4562508162hk0yy

53250242hk0yy

816304104640f0y0y0fk

2450640f0y0y0fk

221222

121112

2122

1111

221221

121111

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

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

./).)(.(/)(

./).)((/)(

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

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

**,

**,

,*

,*

,

,

60y

40y

y30y104fdt

dy

y50fdt

dy

2

1

2122

111

)(

)(

..

.

Page 81: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Continued: RK4 MethodContinued: RK4 Method

631794185756363010937531048575636109375350fyy250fk

55468811093753508575636109375350fyy50fk

85756365071512516hk0yy

1093753507812514hk0yy

7151251428756305625310442875656253250fyy250fk

781251562535042875656253250fyy250fk

428756250715162hk0yy

5625325075142hk0yy

221224

121114

2322

1311

221223

121113

2222

1211

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

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

.).)(.()(

.).)(.()(

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

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

./).)(.(/)(

./).)(.(/)(

******,

******,

,***

,***

****,

****,

,**

,**

8576706506317941715125127151281616hkk2k2k610y50y

1152343505546881781251275122614hkk2k2k610y50y

2423222122

1413121111

.).)](.().().().)[(/())(/()().(

.).](.).().())[(/())(/()().(

,,,,

,,,,

Page 82: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

44thth-order Runge-Kutta Method for ODEs-order Runge-Kutta Method for ODEs

Valid for any number of coupled ODEs

Page 83: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

44thth-order Runge-Kutta Method for ODEs-order Runge-Kutta Method for ODEs

>> [t,y]=RK4_sys('example5',[0 10],[4 6],0.5); t y1 y2 y3 ... 0.000 4.0000000000 6.0000000000 0.500 3.1152343750 6.8576703125 1.000 2.4261713028 7.6321056734 1.500 1.8895230605 8.3268859767 2.000 1.4715767976 8.9468651000 2.500 1.1460766564 9.4976013588 3.000 0.8925743491 9.9849540205 3.500 0.6951445736 10.4148035640 4.000 0.5413845678 10.7928635095 4.500 0.4216349539 11.1245594257 5.000 0.3283729256 11.4149566980 5.500 0.2557396564 11.6687232060 6.000 0.1991722422 11.8901165525 6.500 0.1551170538 12.0829881442 7.000 0.1208064946 12.2507984405 7.500 0.0940851361 12.3966392221 8.000 0.0732743126 12.5232598757 8.500 0.0570666643 12.6330955637 9.000 0.0444440086 12.7282957874 9.500 0.0346133758 12.8107523359 10.000 0.0269571946 12.8821259602

Page 84: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

4th-order Runge-Kutta Method for ODE-IVPs4th-order Runge-Kutta Method for ODE-IVPs

» tspan=[0 15]; y0=[pi/2 0];» [t1,y1]=RK4_sys(‘pendulum',tspan,y0,15/25);» [t2,y2]=RK2_sys(‘pendulum',tspan,y0,15/50);» [t3,y3]=RK2_sys(‘pendulum',tspan,y0,15/100);» H=plot(t1,y1(:,1),t2,y2(:,1),t3,y3(:,1));» set(H,'LineWidth',3.0);

n = 25

n = 50

n = 100

Nonlinear Pendulum

Page 85: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Comparison of Numerical AccuracyComparison of Numerical Accuracy

» tspan=[0 15]; y0=[pi/2 0];» [t1,y1]=Euler_sys(‘pendulum',tspan,y0,15/100);» [t2,y2]=RK2_sys(‘pendulum',tspan,y0,15/100);» [t3,y3]=RK4_sys(‘pendulum',tspan,y0,15/100);» H1=plot(t1,y1(:,1),t2,y2(:,1),t3,y3(:,1)); hold on;» H2=plot(t1,y1(:,2),'b:',t2,y2(:,2),'g:',t3,y3(:,2),'r:');

Euler

RK2

RK4

Nonlinear Pendulum

Page 86: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

Example: More than 2 ODE-IVPsExample: More than 2 ODE-IVPs

function f = example(t, y)% solve y' = Ay = f, y0 = [1 0 0 0]'% four first-order ODE-IVPs A = [ -36 30 -20 10 -61 50 -36 18 -34 29 -25 13 -10 10 -10 6];y=[ y(1) y(2) y(3) y(4)]';f = A*y;

00010t

6101010

13252934

18365061

10203036

A

0 0y ;y6y10y10y10fdt

dy

0 0y ;y13y25y29y34fdt

dy

0 0y ;y18y36y50y61fdt

dy

10y ;y10y20y30y36fdt

dy

4432144

3432133

2432122

1432111

)(

)(

)(

)(

Page 87: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

4th-order Runge-Kutta Method for ODE-IVPs4th-order Runge-Kutta Method for ODE-IVPs

» tspan=[0 2]; y0=[1 0 0 0];» [t1,y1]=RK4_sys(‘example', tspan, y0, 2/20);» [t2,y2]=RK4_sys(‘example', tspan, y0, 2/100);» H1=plot(t1,y1,'o'); set(H1,'LineWidth',3','MarkerSize',12);» hold on; H2=plot(t2,y2); set(H2,'LineWidth',3);

Symbols: n = 20

Lines : n =100

Page 88: Chapter 20 ODEs: Initial-Value Problems.   There are ordinary differential equations - functions of one variable   And there are partial differential

CVEN 302-501CVEN 302-501Homework No. 13Homework No. 13

Chapter 20Prob. 20.1 (40), (Hand Calculation, and use

MATLAB plotting for graph)

20.3 a) , b) and c) (40)(Hand Calculation)

Prob. 20.8 (30) (decomposing into two 1st ODEs and then using MATLAB Program)

Due on Wed. 11/26/2008 at the beginning of Due on Wed. 11/26/2008 at the beginning of the periodthe period