You are on page 1of 54

Introduction to Ordinary

Differential Equations
Ordinary Differential
Equations
 Where do ODEs arise?
 Notation and Definitions
 Solution methods for 1st order
ODEs

Slide number 2
Where 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)

Slide number 3
Example – Newton’s Law of
Cooling
 This is a model of how the
temperature of an object changes as
it loses heat to the surrounding
atmosphere:
Temperature of the object: T Obj Room Temperature: T Room

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”
Form
dT Obj
ODE
  ( T Obj  T Room )
Solve dt
ODE  t
T Obj  T Room  ( T init  T Room )e
Where T init is the initial temperature of the object.
Slide number 4
Example – Swinging of a
pendulum
Newton’s 2nd law for a rotating object:
 Moment of inertia x angular acceleration = Net external
torque
d
2

 ml
2
 2
 mgl sin 
dt
rearrange and divide
through byml 2
l
where
d
2
  
g
  0
2 2
sin
2 l
dt

mg
This equation is very difficult to solve.

Slide number 5
Notation and Definitions

 Order
 Linearity
 Homogeneity
 Initial Value/Boundary value
problems

Slide number 6
Order

 The order of a differential


equation is just the order of
highest derivative used.
2
d y dy
.
2
 0 2nd order
dt dt

3
dx d x
 x 3 3rd order
dt dt

Slide number 7
Linearity

 The important issue is how the


unknowny appears in the equation. A
linear equation involves the
dependent variabley ( ) and its
derivatives by themselves. There
must be no "unusual" nonlinear
functionsyof or its derivatives.
 A linear equation must have constant
coefficients, or coefficients which
depend on the independent variable
t ( ). yIf or its derivatives appear in the
coefficient the equation is non-linear.

Slide number 8
Linearity - Examples

dy
 y 0 is linear
dt
dx
 x 2  0 is non-linear
dt

dy
t2  0 is linear
dt

dy
y  t 2  0 is non-linear
dt

Slide number 9
Linearity – Summary

Linear Non-linear
2
2y y or sin( y )

dy dy
y
dt dt

(2  3 sin t) y (2 3y2)y
2
dy  dy 
t  
dt  dt 

Slide number 10
Linearity – Special Property

If a linear homogeneous ODE has solutions:

y  f (t ) and y  g (t )

then:

y a f (t )  b  g (t )
wherea andb are constants,

is also a solution.

Slide number 11
Linearity – Special Property

Example:
2
d y
2
 y 0 has solutions y  sin t and y  cos t
dt
2
Check d (sin t )
2
 sin t   sin t  sin t  0
dt
2
d (cos t )
2
 cos t   cos t  cos t  0
dt

Therefore y  sin t  cos t is also a solution:

Check
2
d (sin t  cos t )
2
 sin t  cos t
dt
  sin t  cos t  sin t  cos t  0
Slide number 12
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.

Slide number 13
Approximately Linear –
Swinging pendulum example

 The accurate non-linear equation for a


swinging pendulum is:

d
2

2
  2 sin   0
dt

 But for small angles of swing this can be


approximated by the linear ODE:

d
2

2
   0
2

dt

Slide number 14
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)

Slide number 15
Initial Value/Boundary value
problems
 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.

Slide number 16
Example

dv  1st order
 g  Linear
dt  Nonhomogeneous
v (0)  v0  Initial value problem

2  2nd order
d M
2
w  Linear
dx  Nonhomogeneous
M (0) 0  Boundary value
and problem
M (l ) 0

Slide number 17
Example

 2nd order
d
2

2
  2 sin   0  Nonlinear
dt
 Homogeneous
d
θ( 0 )  θ0 , (0) 0  Initial value problem
dt

 2nd order
d
2

2
  2  0  Linear
dt  Homogeneous
d  Initial value problem
θ( 0 )  θ0 , (0) 0
dt

Slide number 18
Solution Methods - Direct
Integration
 This method works for equations
where the RHS does not depend on
the unknown:
 The general form is:
dy
 f (t )
dt
2
d y
2
 f (t )
dt

n
d y
n
 f (t )
dt

Slide number 19
Direct 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 oft;
 Mostly we use t for time as the
independent variable but in some
cases we use x for distance.

Slide number 20
Direct Integration – Example

Find the velocity of a car that is


accelerating from rest at 3 ms-2:
dv
a 3
dt
 v  3t  c

If the car was initially at rest we


have the condition:
v (0)  0  0  30  c  c  0
 v  3t
Slide number 21
Bending of a beam - Example

A beam under uniform load

Beam theory gives the governing equation:


2
d M
2
w
dx

with boundary conditions:


M (0) 0 and M (l ) 0 (pinned ends)

Slide number 22
Bending of a beam - Solution
2
d M
2
w
dx

 Step 1: dM
Integrate  wx  A
dx

 Step 2:
Integrate again to 1
obtain the general
M  wx
2
 Ax  B
2
solution:

Slide number 23
Bending of a beam - Solution
 Step 3:
Use the boundary conditions to obtain the particular
solution.
1
M  wx
2
 Ax  B
2
M (0) 0 1
0  w 0
2
 A 0  B  B  0
2
M (l ) 0 1 1
0  w l
2
 A l  B  A  wl
2 2
 Step 4:
Substitute back the values forA andB
1 1 1
M  wx
2
 wlx M  wx ( l  x)
2 2 2
Slide number 24
Solution 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:

dy
 g (t)h( y )
dt

Slide number 25
Separation – General Idea

First Separate:
dy
 g ( t ) dt
h( y )

Then integrate LHS with


respect toy , RHS with respect
t .
to
dy
 h ( y )   g ( t ) dt  C
Slide number 26
Separation - Example

dy
 y sin( t )
dt
Separate:
1
dy  sin( t ) dt
y
Now integrate:
1
 y dy   sin( t ) dt
 ln( y)   cos( t )  c
 y  e cos( t )  c
 cos( t )
Slide number 27
 y  Ae
Cooling of a cup of coffee
Amount of heat in a cup of coffee:
heat volume specific heat

Q  V cT
densit temperatur
y e

Heat balance equation (words):


 Rate of change of heat = heat lost to surrounding air

Slide number 28
Cooling of a cup of coffee
Newton’s law of cooling:
 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

Heat balance equation (maths) :


dQ
 hA ( T  T Room )
dt

Slide number 29
Cooling of a cup of coffee
dQ
 hA ( T  T Room )
dt
Substitute in
Q  V cT dT
V c  hA ( T  T Room )
dt
rearrange where
dT
  ( T  T Room ) 
hA

dt V c

Now we solve the equation together with


the initial condition:
T (0)  T Initial

Slide number 30
Cooling of a cup of coffee -
Solution
dT
  ( T  T Room )
dt

 Step 1: dT
 dt
Separate (T  T Room )

 Step 2: ln( T  T Room )  t  c


Integrate Make explicit in unknownT

T  T Room  e t  c

 t where
 T Room 
T Ae
A e c

Slide number 31
Cooling of a cup of coffee -
Solution
 t
T  T Room  Ae T (0)  T Initial
 Step 3:  0
Use Initial T Initial  T Room  Ae
Condition
A  ( T Initial  T Room )

 Step 4:
Substitute  t
back to T  T Room  ( T Initial  T Room )e
obtain
final
answer
Slide number 32
Solution Methods - Integrating
Factor
The integrating factor method is used for
nonhomogeneous linear 1st order equations

The basic ideas are:


dy
 Collect all the terms involvingy and
on the left hand side of the equation. dt
 Combine them together as the derivative
of a single function ofy andt .
 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.
Slide number 33
Integrating Factor – Example

dy
 y 1 y (0) 2
dt

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:

Slide number 34
Integrating Factor – Example

Product Rule:

d ( f .y) dy df
 f  y
dt dt dt

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.

Slide number 35
Integrating Factor – Example

We will look ahead, use the answer and


show how it is derived later. For our ODE the
integrating factor is e
t

Thus the ODE becomes:


dy
e
t
 et y  et
dt

Now the LHS of this equation looks like the


RHS of the Product Rule with:

f  et

Slide number 36
Integrating Factor – Example

We can rewrite the equation as:


t
dy d (e )
e
t
 y  et
dt dt
or
t
d (e y )
 et
dt
Now we can use direct integration
e y
t
 et  C

Do not forgetC , the constant of integration!

Slide number 37
Integrating Factor – Example

Rearrange to make this explicit iny


t
y  1  Ce
Now use the initial condition to calculate C
0
y (0)  2  1  Ce 2
1C  2
 C 1
Substitute back to obtain the final solution

y  1  e t

Slide number 38
How do we calculate the
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
dy
  y  
dt
 To make the LHS of this equation look
like the RHS of the Product Rule we
must choose
d

dt

Slide number 39
How do we calculate the
integrating factor?
 Then the ODE becomes

dy d
  y 
dt dt
 Now using the product rule in reverse the
LHS can be written as a single term (a
very clever trick)
d ( y )

dt

Slide number 40
How do we calculate the
integrating factor?
 Now we can integrate once we knowΦ
 We can separate to find Φ
d d
   dt
dt 
 ln   t  c    e t  c
  Ae
t

 The convention is to putA = 1. It appears


in every term of the ODE, and therefore
can be divided out. This gives the
integrating factor:
  et
Slide number 41
Finding the integrating factor
in general
 Given the general form of a
nonhomogeneous 1st order
equation:
dy
 g (t ) y  f (t )
dt
y (0)  y0

 How do we use the integrating


factor method to find ay ?

Slide number 42
Finding the integrating factor
in general
 Step 1: Multiply byΦ:
dy
   g (t ) y   f (t )
dt
 Step 2: Compare with the RHS of the
Product Rule and set up equation forΦ:
d
  g (t )
dt
 Step 3: Use separation to solve forΦ:
d
 g ( t ) dt

 ln    g ( t ) dt

Slide number 43   e  g ( t )dt


Finding the integrating factor
in general
 Step 4: Combine terms on the LHS:
d [ y ]
  f (t )
dt
 Step 5: Integrate:

 y    fdt  C
 Step 6: Divide by to make explicit iny :
1 C
y 
   fdt 

 Step 7: Use the initial conditions to
evaluate C :

Slide number 44
Finding the integrating factor
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.
 e  g ( t ) dt

 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   f ( t ) dt
 g ( t ) dt
may be impossible to evaluate.
Slide number 45
Solving an example using the
integrating factor method
dy
 ty  t y (0) 0
dt

Step 1: Put the ODE into the general form:


dy
 g (t ) y  f (t )
dt
The ODE is already in that form!
Step 2: Find the integrating factor:
g (t )  t   e  tdt

  e
1 2
2
t

Slide number 46
Solving an example using the
integrating factor method
Step 3: Multiply by the integrating factor:
1 2
dy 1 2 1 2

e  te
t t t
e2 2
ty 2

dt
Step 4: Use the reverse Product Rule:
1 2
t
d[e 2
y] 1 2

 te
t
2

dt

Step 5: Integrate and make explicit iny :

  te
1 2 1 2 1 2

 C e C
t t t
e 2
y 2
dt 2

 12 t 2
 y  1  Ce

Slide number 47
Solving an example using the
integrating factor method
Step 6: Use the initial conditions to find the
exact solution:
 0  1  Ce 0  0
y (0)
1C  0
 C  1
Step 7: Substitute back into the original
equation:
 12 t 2
y 1 e

Slide number 48
Exponential substitution

 The exponential trial or guessing method can


be used for solving linear constant coefficient
homogeneous differential equations.

 The basic trial for the solution of the ODE is:

t
y  Ce

Slide number 49
Characteristic Equations

 y  Ce t gives the differentials


y   Ce
 t

y    Ce
2 t

y   Ce 
(3) 3 t


y
(n)
 n Ce t
 An algebraic characteristic equation
comes from substituting in fory and its
t
derivatives and cancelling out
Ce

Slide number 50
Exponential Trial - Example

y 5y 0 Try y  Ae t

Ae t  5 Ae t  0
t
 Cancelling out Ae gives the characteristic
equation

 5 0    5
t
 Substituting this back into y  Ae gives
5 t
y  Ae

Slide number 51
Solving Guide

General Form Description Solving


Method
 1st or higher order Direct
n
d y  RHS does not Integration
n
 f (t )
depend on the
dt
unknown y
dy  1st order only Separation
 f ( t, y )  g (t)h( y )
dt

 1st order Integrating


dy Factor Method
 g (t ) y  f (t )  nonhomogeneous
dt  linear equation

Slide number 52
Solving Guide

General Form Description Solving


Method
n n 1  2nd order or higher Exponential trial.
d y d y
n
 a n 1 n 1
  homogeneous See Module 2
dt dt
 linear equation
dy  constant
  a1  a0 y  0
dt coefficients

 2nd order or higher Problems like


n
d y d
n 1
y  nonhomogeneous this can be
n
 a n 1 n 1
  linear equation solved for some
dt dt
 constant f .
types of
dy
  a1  a0 y  f (t) coefficients Covered in
dt
Modules 3 and
5

Slide number 53
Solving Guide

General Form Description Solving


Method
n n 1  2nd order or higher Can only solve a
d y d y
n
 g n 1 ( t ) n 1
  nonhomogeneous few ‘special’
dt dt problems
 linear equation
dy
  g1 (t)  g 0 (t) y  f (t)  variable Not Covered in
dt coefficients MM2

 2nd order Generally can’t


 Functionf be solved
containst y, and analytically
 
2
d y dy
 f t, y,  y ’ terms all (see Module 4
 
2
dt dt
mixed up for numerical
methods)

Slide number 54

You might also like