part 7 ordinary differential equations odes. ordinary differential equations part 7 equations which...

25
PART 7 PART 7 Ordinary Differential Ordinary Differential Equations ODEs Equations ODEs

Upload: samuel-anthony

Post on 23-Dec-2015

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

PART 7PART 7Ordinary Differential Equations Ordinary Differential Equations

ODEsODEs

Page 2: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Ordinary Differential EquationsPart 7

• Equations which are composed of an unknown function and its derivatives are called differential equations.

• Differential equations play a fundamental role in engineering because many physical phenomena are best formulated mathematically in terms of their rate of change.

vm

cg

dt

dv

v - dependent variable

t - independent variable

Page 3: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Ordinary Differential Equations

• When a function involves one dependent

variable, the equation is called an ordinary

differential equation (ODE).

•A partial differential equation (PDE) involves

two or more independent variables.

Page 4: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Ordinary Differential Equations

Differential equations are also classified as to

their order:1. A first order equation includes a first derivative as

its highest derivative.

- - Linear 1Linear 1stst order ODE order ODE

- Non-Linear 1- Non-Linear 1stst order ODE order ODE

Where f(x,y) is nonlinearWhere f(x,y) is nonlinear

)(xfydx

dy

),( yxfdx

dy

Page 5: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Ordinary Differential Equations

)(),(),( xfyyxQdx

dyyxp

dx

yd2

2

2. A second order equation includes a second

derivative.

- - Linear 2Linear 2ndnd order ODE order ODE

- Non-Linear 2nd order ODE- Non-Linear 2nd order ODE

• Higher order equations can be reduced to a system

of first order equations, by redefining a variable.

)(xfQydx

dyp

dx

yd2

2

Page 6: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Ordinary Differential Equations

Page 7: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Runge-Kutta Methods This chapter is devoted to solving ODE of the form:

• Euler’s Method

solution

),( yxfdx

dy

Page 8: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Runge-Kutta Methods

Page 9: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Euler’s Method: Example

58x20x12x2dx

dy 23 .

Obtain a solution between x = 0 to x = 4

with a step size of 0.5 for:

Initial conditions are: x = 0 to y = 1

Solution:

1255505801200112012255

50875501f01y02y

8755505850205012502255

5025550f50y01y

25550x5801

5010f0y50y

23

23

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

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

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

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

....

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

Page 10: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Euler’s Method: Example• Although the computation captures the general trend

solution, the error is considerable.• This error can be reduced by using a smaller step size.

Page 11: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Improvements of Euler’s method• A fundamental source of error in Euler’s

method is that the derivative at the beginning of the interval is assumed to apply across the entire interval.

• Simple modifications are available:– Heun’s Method– The Midpoint Method– Ralston’s Method

Page 12: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Runge-Kutta Methods• Runge-Kutta methods achieve the accuracy of a Taylor series

approach without requiring the calculation of higher derivatives.

1

1 1 2 2

1

2 1 11 1

3 3 21 1 22 2

1 1 1 1,2 2 1, 1 1

( , , )

' constants

( , )

( , )

( , )

( , )

' and ' are constants

i i i i

n n

i i

i i

i i

n i n i n n n n n

y y x y h h

a k a k a k

a s

k f x y

k f x p h y q k h

k f x p h y q k h q k h

k f x p h y q k h q k h q k h

p s q s

Increment function (representative slope over the interval)

Page 13: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Runge-Kutta Methods• Various types of RK methods can be devised by employing

different number of terms in the increment function as specified by n.

1. First order RK method with n=1 is Euler’s method.– Error is proportional to O(h)

2. Second order RK methods:- Error is proportional to O(h2)

• Values of a1, a2, p1, and q11 are evaluated by setting the second order equation to Taylor series expansion to the second order term.

),(

),(

)(

11112

1

22111

hkqyhpxfk

yxfk

hkakayy

ii

ii

ii

Page 14: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Runge-Kutta Methods

2

12

1

1

112

12

21

qa

pa

aa

• Three equations to evaluate the four unknown constants are derived:

A value is assumed for one of the unknowns to solve for the other three.

Page 15: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Runge-Kutta Methods

2

1,

2

1,1 1121221 qapaaa

• We can choose an infinite number of values for a2,there are an infinite number of second-order RK methods.

• Every version would yield exactly the same results if the solution to ODE were quadratic, linear, or a constant.

• However, they yield different results if the solution is more complicated (typically the case).

Page 16: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Runge-Kutta MethodsThree of the most commonly used methods are:

• Huen Method with a Single Corrector (a2=1/2)

• The Midpoint Method (a2= 1)

• Raltson’s Method (a2= 2/3)

Page 17: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Runge-Kutta Methods• Heun’s Method: Involves the determination

of two derivatives for the interval at the initial point and the end point.

y

f(xi,yi)

xi xi+hx

f(xi+h,yi+k1h)

y

a

xi xi+hx

Slope: 0.5(k1+k2)

Page 18: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Runge-Kutta Methods• Midpoint Method:Uses Euler’s method to predict a value of y at the midpoint of the interval:

f(xi+h/2,yi+k1h/2)

y

a

xi xi+hx

Slope: k2

y

f(xi,yi)

xi xi+h/2x

Chapter 25

Page 19: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Runge-Kutta Methods• Ralston’s Method:

x

f(xi+ 3/4 h, yi+3/4k1h)

xi+h x

y

f(xi,yi)xi xi+3/4h

y

a

xi

Slope: (1/3k1+2/3k2)

Chapter 25

Page 20: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives
Page 21: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives
Page 22: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Chapter 25 22

Page 23: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Runge-Kutta Methods

3. Third order RK methods

Chapter 25

Page 24: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Runge-Kutta Methods4. Fourth order RK methods

hkkkkyy ii )22(6

143211

),(

)2

1,

2

1(

)2

1,

2

1(

),(

33

23

12

1

hkyhxfk

hkyhxfk

hkyhxfk

yxfk

where

ii

ii

ii

ii

Chapter 25

Page 25: PART 7 Ordinary Differential Equations ODEs. Ordinary Differential Equations Part 7 Equations which are composed of an unknown function and its derivatives

Comparison of Runge-Kutta Methods

Use first to fourth order RK methods to solve the equation from x = 0 to x = 4

Initial condition y(0) = 2, exact answer of y(4) = 75.33896

yeyxf x 5.04),( 8.0

Chapter 25