Module 1 Introduction to Ordinary Differential Equations

54
Module 1 Module 1 Introduction to Ordinary Introduction to Ordinary Differential Equations Differential Equations Mr Peter Bier

description

Module 1 Introduction to Ordinary Differential Equations. Mr Peter Bier. Ordinary Differential Equations. Where do ODEs arise? Notation and Definitions Solution methods for 1 st order ODEs. Where do ODE’s arise. All branches of Engineering Economics Biology and Medicine - PowerPoint PPT Presentation

Transcript of Module 1 Introduction to Ordinary Differential Equations

Page 1: Module 1 Introduction to Ordinary Differential Equations

Module 1Module 1Introduction to Ordinary Introduction to Ordinary Differential EquationsDifferential Equations

Mr Peter Bier

Page 2: Module 1 Introduction to Ordinary Differential Equations

Slide number 2

Ordinary Differential Ordinary Differential EquationsEquations

Where do ODEs arise? Notation and Definitions Solution methods for 1st order

ODEs

Page 3: Module 1 Introduction to Ordinary Differential Equations

Slide number 3

Where do ODE’s ariseWhere do ODE’s arise

All branches of Engineering Economics Biology and Medicine Chemistry, Physics etc

Anytime you wish to find out how something changes with time (and sometimes space)

Page 4: Module 1 Introduction to Ordinary Differential Equations

Slide number 4

Example – Newton’s Law of Example – Newton’s Law of CoolingCooling

This is a model of how the temperature of an object changes as it loses heat to the surrounding atmosphere:

Temperature of the object: ObjT Room Temperature: RoomT

Newton’s laws states: “The rate of change in the temperature of an object is proportional to the difference in temperature between the object and the room temperature”

)( RoomObjObj TT

dt

dT

Form ODE

tRoominitRoomObj eTTTT )(

SolveODE

Where is the initial temperature of the object.initT

Page 5: Module 1 Introduction to Ordinary Differential Equations

Slide number 5

Example – Swinging of a Example – Swinging of a pendulumpendulum

mg

l

Newton’s 2nd law for a rotating object:

sin

2

22 mgl

dt

dml

0sin22

2

dt

d

This equation is very difficult to solve.

rearrange and divide through by ml 2

l

g2

where

Moment of inertia x angular acceleration = Net external torque

Page 6: Module 1 Introduction to Ordinary Differential Equations

Slide number 6

Notation and DefinitionsNotation and Definitions

Order Linearity Homogeneity Initial Value/Boundary value

problems

Page 7: Module 1 Introduction to Ordinary Differential Equations

Slide number 7

OrderOrder

The order of a differential equation is just the order of highest derivative used.

02

2

dt

dy

dt

yd. 2nd order

3

3

dt

xdx

dt

dx 3rd order

Page 8: Module 1 Introduction to Ordinary Differential Equations

Slide number 8

LinearityLinearity

The important issue is how the unknown y appears in the equation. A linear equation involves the dependent variable (y) and its derivatives by themselves. There must be no "unusual" nonlinear functions of y or its derivatives.

A linear equation must have constant coefficients, or coefficients which depend on the independent variable (t). If y or its derivatives appear in the coefficient the equation is non-linear.

Page 9: Module 1 Introduction to Ordinary Differential Equations

Slide number 9

Linearity - ExamplesLinearity - Examples

0 ydt

dyis linear

02 xdt

dxis non-linear

02 tdt

dyis linear

02 tdt

dyy is non-linear

Page 10: Module 1 Introduction to Ordinary Differential Equations

Slide number 10

Linearity – SummaryLinearity – Summary

y2

dt

dydt

dyy

dt

dyt

2

dt

dy

yt)sin32( yy )32( 2

Linear Non-linear

2y )sin( yor

Page 11: Module 1 Introduction to Ordinary Differential Equations

Slide number 11

Linearity – Special PropertyLinearity – Special Property

If a linear homogeneous ODE has solutions:

)(tfy )(tgy and

then:

)()( tgbtfay where a and b are constants,

is also a solution.

Page 12: Module 1 Introduction to Ordinary Differential Equations

Slide number 12

Linearity – Special PropertyLinearity – Special Property

Example:

02

2

ydt

yd

0sinsinsin)(sin

2

2

tttdt

td

0coscoscos)(cos

2

2

tttdt

td

0cossincossin

cossin)cos(sin

2

2

tttt

ttdt

ttd

ty sin ty coshas solutions and

Check

tty cossin Therefore is also a solution:

Check

Page 13: Module 1 Introduction to Ordinary Differential Equations

Slide number 13

Life is mostly linear!!!Life is mostly linear!!!

Most ODEs that arise in engineering are linear with constant coefficients.

In many cases they are approximate versions of more complex nonlinear models but they are sufficiently accurate for most purposes. Often they work OK for small amplitude disturbances but for large amplitude behaviour nonlinearities start to have some effect.

For linear systems the qualitative behaviour is independent of amplitude.

The coefficients in the ODE correspond to system parameters and are usually constant.

Sometimes nonlinearities are important and there have been some important failures because nonlinearities were not understood e.g. the collapse of the Tacoma Narrows bridge.

Page 14: Module 1 Introduction to Ordinary Differential Equations

Slide number 14

Approximately Linear – Approximately Linear – Swinging pendulum exampleSwinging pendulum example

The accurate non-linear equation for a swinging pendulum is:

0sin22

2

dt

d

But for small angles of swing this can be approximated by the linear ODE:

022

2

dt

d

Page 15: Module 1 Introduction to Ordinary Differential Equations

Slide number 15

Homogeniety Homogeniety

Put all the terms of the equation which involve the dependent variable on the LHS.

Homogeneous: If there is nothing left on the RHS the equation is homogeneous (unforced or free)

Nonhomogeneous: If there are terms involving t (or constants) - but not y - left on the RHS the equation is nonhomogeneous (forced)

Page 16: Module 1 Introduction to Ordinary Differential Equations

Slide number 16

Initial Value/Boundary value Initial Value/Boundary value problemsproblems

Problems that involve time are represented by an ODE together with initial values.

Problems that involve space (just one dimension) are also governed by an ODE but what is happening at the ends of the region of interest has to be specified as well by boundary conditions.

Page 17: Module 1 Introduction to Ordinary Differential Equations

Slide number 17

ExampleExample

1st order Linear Nonhomogeneous Initial value problem

gdt

dv

0)0( vv

wdx

Md

2

2

0)(

0)0(

and

lM

M

2nd order Linear Nonhomogeneous Boundary value

problem

Page 18: Module 1 Introduction to Ordinary Differential Equations

Slide number 18

ExampleExample

2nd order Nonlinear Homogeneous Initial value problem

2nd order Linear Homogeneous Initial value problem

0sin22

2

dt

d

0)0( ,0 0 dt

dθ)θ(

022

2

dt

d

0)0( ,0 0 dt

dθ)θ(

Page 19: Module 1 Introduction to Ordinary Differential Equations

Slide number 19

Solution Methods - Direct Solution Methods - Direct IntegrationIntegration This method works for equations

where the RHS does not depend on the unknown:

The general form is:

)(tfdt

dy

)(2

2

tfdt

yd

)(tfdt

ydn

n

Page 20: Module 1 Introduction to Ordinary Differential Equations

Slide number 20

Direct IntegrationDirect Integration

y is called the unknown or dependent variable;

t is called the independent variable; “solving” means finding a formula for

y as a function of t; Mostly we use t for time as the

independent variable but in some cases we use x for distance.

Page 21: Module 1 Introduction to Ordinary Differential Equations

Slide number 21

Direct Integration – ExampleDirect Integration – Example

Find the velocity of a car that is accelerating from rest at 3 ms-2:

3adt

dv

ctv 3

tv

ccv

3

00300)0(

If the car was initially at rest we have the condition:

Page 22: Module 1 Introduction to Ordinary Differential Equations

Slide number 22

Bending of a beam - ExampleBending of a beam - Example

Beam theory gives the governing equation:

wdx

Md

2

2

with boundary conditions:

0)( and 0)0( lMM (pinned ends)

A beam under uniform load

Page 23: Module 1 Introduction to Ordinary Differential Equations

Slide number 23

Bending of a beam - SolutionBending of a beam - Solution

wdx

Md

2

2

Step 1: Integrate

BAxwxM 2

2

1

Awxdx

dM

Step 2: Integrate again to obtain the general solution:

Page 24: Module 1 Introduction to Ordinary Differential Equations

Slide number 24

Bending of a beam - SolutionBending of a beam - Solution

Step 3: Use the boundary conditions to obtain the particular solution.

BAxwxM 2

2

1

Step 4: Substitute back the values for A and B

0002

10 2 BBAw

BlAlw 2

2

10

)(2

1xlwxM wlxwxM

2

1

2

1 2

0)0( M

0)( lMwlA

2

1

Page 25: Module 1 Introduction to Ordinary Differential Equations

Slide number 25

Solution Methods - SeparationSolution Methods - Separation

The separation method applies only to 1st order ODEs. It can be used if the RHS can be factored into a function of t multiplied by a function of y:

)()( yhtgdt

dy

Page 26: Module 1 Introduction to Ordinary Differential Equations

Slide number 26

Separation – General IdeaSeparation – General Idea

First Separate:

dttgyh

dy)(

)(

Then integrate LHS with respect to y, RHS with respect to t.

Cdttgyh

dy )(

)(

Page 27: Module 1 Introduction to Ordinary Differential Equations

Slide number 27

Separation - ExampleSeparation - Example

)sin(tydt

dy

Separate:

dttdyy

)sin(1

Now integrate:

)cos(

)cos(

)cos()ln(

)sin(1

t

ct

Aey

ey

cty

dttdyy

Page 28: Module 1 Introduction to Ordinary Differential Equations

Slide number 28

Cooling of a cup of coffeeCooling of a cup of coffee

Amount of heat in a cup of coffee:

cTVQ heat volume specific heat

density temperature

Heat balance equation (words): Rate of change of heat = heat lost to surrounding air

Page 29: Module 1 Introduction to Ordinary Differential Equations

Slide number 29

Cooling of a cup of coffeeCooling of a cup of coffee

Heat lost to the surrounding air is proportional to temperature difference between the object and the air

The proportionality constant involves the surface area multiplied by a heat tranfer coefficient

Newton’s law of cooling:

Heat balance equation (maths) :

)( RoomTThAdt

dQ

Page 30: Module 1 Introduction to Ordinary Differential Equations

Slide number 30

Cooling of a cup of coffeeCooling of a cup of coffee

)( RoomTThAdt

dQ

)( RoomTThAdt

dTcV

)( RoomTTdt

dT

cV

hA

whererearrange

cTVQ Substitute in

Now we solve the equation together with the initial condition:

InitialTT )0(

Page 31: Module 1 Introduction to Ordinary Differential Equations

Slide number 31

Cooling of a cup of coffee - Cooling of a cup of coffee - SolutionSolution

)( RoomTTdt

dT

Step 1: Separate

dtTT

dT

Room

)(

ctTT Room )ln( Step 2: Integrate

ctRoom eTT

tRoom AeTT ceA

where

Make explicit in unknown T

Page 32: Module 1 Introduction to Ordinary Differential Equations

Slide number 32

Cooling of a cup of coffee - Cooling of a cup of coffee - SolutionSolution

Step 3: Use Initial

Condition

Step 4: Substitute

back to obtain final answer

tRoom AeTT

InitialTT )0(

0 AeTT RoomInitial

)( RoomInitial TTA

tRoomInitialRoom eTTTT )(

Page 33: Module 1 Introduction to Ordinary Differential Equations

Slide number 33

Solution Methods - Integrating Solution Methods - Integrating FactorFactor

The integrating factor method is used for nonhomogeneous linear 1st order equations

The basic ideas are: Collect all the terms involving y and

on the left hand side of the equation. dt

dy

Combine them together as the derivative of a single function of y and t.

Solve by direct integration.

The cunning trick is that step 2 cannot usually be done unless you first multiply the whole equation by an integrating factor.

Page 34: Module 1 Introduction to Ordinary Differential Equations

Slide number 34

Integrating Factor – ExampleIntegrating Factor – Example

1 ydt

dy 2)0( y

There are several ways to solve this problem but we will use it to demonstrate the integrating factor method. To understand the integrating factor method you must be very familiar with the formula for the derivative of a product:

Page 35: Module 1 Introduction to Ordinary Differential Equations

Slide number 35

Integrating Factor – ExampleIntegrating Factor – Example

Product Rule:

ydt

df

dt

dyf

dt

yfd

).(

The basic idea is that if we multiply the ODE by the correct function (an integrating factor) we can make the LHS of the ODE look like the RHS of the product rule.

Page 36: Module 1 Introduction to Ordinary Differential Equations

Slide number 36

Integrating Factor – ExampleIntegrating Factor – Example

We will look ahead, use the answer and show how it is derived later. For our ODE the integrating factor is te

Thus the ODE becomes:

ttt eyedt

dye

Now the LHS of this equation looks like the RHS of the Product Rule with:

tef

Page 37: Module 1 Introduction to Ordinary Differential Equations

Slide number 37

Integrating Factor – ExampleIntegrating Factor – Example

We can rewrite the equation as:

tt

t eydt

ed

dt

dye

)(

or t

t

edt

yed

)(

Now we can use direct integration

Ceye tt

Do not forget C, the constant of integration!

Page 38: Module 1 Introduction to Ordinary Differential Equations

Slide number 38

Integrating Factor – ExampleIntegrating Factor – Example

Rearrange to make this explicit in y

tCey 1

Now use the initial condition to calculate C

1

21

212)0( 0

C

C

Cey

Substitute back to obtain the final solution

tey 1

Page 39: Module 1 Introduction to Ordinary Differential Equations

Slide number 39

How do we calculate the How do we calculate the integrating factor?integrating factor? Let us now pretend we do not know what

the integrating factor should be Call it Φ and use it to multiply the ODE

from the previous example

ydt

dy

To make the LHS of this equation look like the RHS of the Product Rule we must choose

dt

d

Page 40: Module 1 Introduction to Ordinary Differential Equations

Slide number 40

How do we calculate the How do we calculate the integrating factor?integrating factor? Then the ODE becomes

ydt

d

dt

dy

Now using the product rule in reverse the LHS can be written as a single term (a very clever trick)

dt

yd )(

Page 41: Module 1 Introduction to Ordinary Differential Equations

Slide number 41

How do we calculate the How do we calculate the integrating factor?integrating factor? Now we can integrate once we know Φ

We can separate to find Φ

t

ct

Ae

ect

dtd

dt

d

ln

The convention is to put A = 1. It appears in every term of the ODE, and therefore can be divided out. This gives the integrating factor:

te

Page 42: Module 1 Introduction to Ordinary Differential Equations

Slide number 42

Finding the integrating Finding the integrating factor in generalfactor in general

Given the general form of a nonhomogeneous 1st order equation:

)()( tfytgdt

dy

0)0( yy

How do we use the integrating factor method to find a y?

Page 43: Module 1 Introduction to Ordinary Differential Equations

Slide number 43

Finding the integrating Finding the integrating factor in generalfactor in general Step 1: Multiply by Φ:

)()( tfytgdt

dy

Step 2: Compare with the RHS of the Product Rule and set up equation for Φ:

)(tgdt

d

Step 3: Use separation to solve for Φ:

dttge

dttg

dttgd

)(

)(ln

)(

Page 44: Module 1 Introduction to Ordinary Differential Equations

Slide number 44

Finding the integrating Finding the integrating factor in generalfactor in general Step 4: Combine terms on the LHS:

)(] [

tfdt

yd

Step 5: Integrate:

Cfdty Step 6: Divide by to make explicit in y :

C

fdty 1

Step 7: Use the initial conditions to evaluate C :

Page 45: Module 1 Introduction to Ordinary Differential Equations

Slide number 45

Finding the integrating Finding the integrating factor in generalfactor in general

Notes: After you have been through the process a

few times then skip some of the steps. For example you can remember the formula for the integrating factor, you do not have to re-derive it every time.

dttg

e)(

In principle this process can be used to

solve any linear nonhomogeneous 1st order ODE but some of the details may be tricky or impossible. Both the integrals

and may be impossible to evaluate.

dttg )( dttf )(

Page 46: Module 1 Introduction to Ordinary Differential Equations

Slide number 46

Solving an example using the Solving an example using the integrating factor methodintegrating factor method

ttydt

dy 0)0( y

)()( tfytgdt

dy

Step 1: Put the ODE into the general form:

The ODE is already in that form!

Step 2: Find the integrating factor:

221

)(t

tdt

e

ettg

Page 47: Module 1 Introduction to Ordinary Differential Equations

Slide number 47

Solving an example using the Solving an example using the integrating factor methodintegrating factor method

Step 5: Integrate and make explicit in y:

Step 3: Multiply by the integrating factor:2

212

212

21 ttt

tetyedt

dye

Step 4: Use the reverse Product Rule:

221

221

][ tt

tedt

yed

221

2212

212

21

1t

ttt

Cey

CeCdtteye

Page 48: Module 1 Introduction to Ordinary Differential Equations

Slide number 48

Solving an example using the Solving an example using the integrating factor methodintegrating factor method

Step 7: Substitute back into the original equation:

Step 6: Use the initial conditions to find the exact solution:

1

01

010)0( 0

C

C

Cey

221

1t

ey

Page 49: Module 1 Introduction to Ordinary Differential Equations

Slide number 49

Exponential substitutionExponential substitution

The exponential trial or guessing method can be used for solving linear constant coefficient homogeneous differential equations.

tCey

The basic trial for the solution of the ODE is:

Page 50: Module 1 Introduction to Ordinary Differential Equations

Slide number 50

Characteristic EquationsCharacteristic Equations

gives the differentialstCey

tnn

t

t

t

Cey

Cey

Cey

Cey

)(

3)3(

2

An algebraic characteristic equation comes from substituting in for y and its derivatives and cancelling out tCe

Page 51: Module 1 Introduction to Ordinary Differential Equations

Slide number 51

Exponential Trial - ExampleExponential Trial - Example

05 yy

05 tt AeAe

Try tAey

Cancelling out gives the characteristic equation

tAe

5 05

Substituting this back into givestAey

tAey 5

Page 52: Module 1 Introduction to Ordinary Differential Equations

Slide number 52

Solving GuideSolving Guide

General Form Description Solving Method

)(tfdt

ydn

n

)()(),( yhtgytfdt

dy

)()( tfytgdt

dy

Direct Integration

Separation

Integrating Factor Method

1st order only

1st order nonhomogeneous linear equation

1st or higher order RHS does not

depend on the unknown y

Page 53: Module 1 Introduction to Ordinary Differential Equations

Slide number 53

Solving GuideSolving Guide

General Form Description Solving MethodExponential trial. See Module 2

Problems like this can be solved for some types of f.

Covered in Modules 3 and 5

001

1

1

1

yadt

dya

dt

yda

dt

ydn

n

nn

n

)(01

1

1

1

tfyadt

dya

dt

yda

dt

ydn

n

nn

n

2nd order or higher homogeneous linear equation constant

coefficients

2nd order or higher nonhomogeneous linear equation constant

coefficients

Page 54: Module 1 Introduction to Ordinary Differential Equations

Slide number 54

Solving GuideSolving Guide

General Form Description Solving MethodCan only solve a few ‘special’ problems

Not Covered in MM2

Generally can’t be solved analytically

(see Module 4 for numerical methods)

2nd order or higher nonhomogeneous linear equation variable

coefficients

2nd order Function f

contains t, y and y’ terms all mixed up

)()()(

)(

01

1

1

1

tfytgdt

dytg

dt

ydtg

dt

ydn

n

nn

n

dt

dyytf

dt

yd,,

2

2