0% found this document useful (0 votes)
4 views

4_Intro-to-ODE

Uploaded by

Mumtaza Harez
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

4_Intro-to-ODE

Uploaded by

Mumtaza Harez
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 57

Intro to

ODEAnalisis
Numerik

1
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 Room


object: TObj Temperature: TRoom
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”

For
m dTObj
ODE  (TObj  T Room )
Solv dt
e
ODE TObj  TRoom  (Tinit  T Room )et
Where Tiinsitthe initial temperature of the
Example – Swinging of a pendulum
Newton’s 2nd law for a rotating object:
 Moment of inertia x angular acceleration = Net
external torque
ml    mgl sin
d 2
2

dt 2
rearrange and
divide through by
l
ml 2 wher
d 2 e2
 sin 0
2
 l
dt 2
g
mg
This equation is very difficult to
solve.
Notation and Definitions
• Order
• Linearity
• Homogeneity
• Initial Value/Boundary value
problems
Orde
r • The order of a differential
equation is just the order of
highest derivative used.

d 2 y dy 2nd
.
 
dt 2
dt 0 order

dx d3
 3rd
xdt dt 3
order
x
Linearity
• 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.
Linearity - Examples

dy is
dt  y 
0 linear
dx
 x 2  is non-
dt 0 linear
dy
 t 2
 is
dt
0 linear
dy
y
dt t2 0 is non-
linear
Linearity –
Summary
Linear Non-linear

2y y2 or
sin( y)
dy dy
y
dt
dt

(2  3sin t) y (2  3y 2 ) y
dy dy
 
2
t
dt
dt  
Linearity – Special Property
If a linear homogeneous ODE has
solutions:
y  f (t) an y
d g(t)
then:

y  a  f (t)  b  g(t)
where a and b are
constants,

is also a solution.
Linearity – Special Property
Exampl
e:d 2 y
dt 2  y  0 has y  sin t and y  cos
solutions t
Chec d (sin t) sin t  sin t  sin t 
2

k 2 dt
2 
d (cos t) 0
   
cos t cos
dt 2
t cos
t 0
Therefore y  sin t  cos t is also a
solution:
Chec d 2 (sin t  cos t)
sin t  cos
k dt 2

 t
 sin t  cos t  sin t  cos t
0
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 importantfailures because nonlinearities
were not understood e.g. the collapse of the Tacoma
Approximately Linear – Swinging
pendulum example
The accurate non-linear equation for a
swinging
pendulum is:

d 2 sin 
2  
dt 0
2
 But for small angles of swing this can be
approximated
by the linear ODE:
d 2
  2 
0
dt 2
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)
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.
Example
• 1st order
dv
g • Linear
dt • Nonhomogeneou

v(0)  s
v0 • Initial value
 2nd order
d 2M problem
Linear

dx w
2  Nonhomogeneous
 Boundary value
M (0)  problem
0
and
M (l) 
0
Example
• 2nd order
d 
2
  2
sin 0 • Nonlinear
dt 2
• Homogeneous
θ( 0 )  0θ , dt (0)  0 • Initial value
d
problem
 2nd order
 Linear
d 22

dt  2
 0  Homogeneous
 Initial value
problem
d
θ( 0 )  0θ , dt (0)  0
Solution Methods - Direct Integration
• This method works for equations
where the RHS does not
depend on the unknown:
• The general form is:

dy
dt  f (t)
d 2y
f (t)
dt 2

⁝
d ny
f (t)
dt n


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 of
t;
• Mostly we use t for time as the independent variable
but in some cases we use x for distance.
Direct Integration – Example
Find the velocity of a car
that is accelerating from
rest at 3 ms-2:

dv
dt  a 
3 v  3t 

c
If the car was initially at
rest we have the
condition:
v(0)  0  0  3  0  c  c  0
Bending of a beam -
Example A beam under uniform
load

Beam theory gives the governing


equation:
d 2M
w
dx2

with boundary conditions:

(pinned
M (0)  0 and M ends)
(l)  0
Bending of a beam - Solution
d 2M
w
dx2

 Step 1:
Integrate dM
dx  wx 
A
 Step 2:
Integrate again 1
M  wx2  Ax 
to obtain the B
general 2
solution:
Bending of a beam - Solution
 Step 3:
Use the boundary conditions to
obtain the particular solution.
1
M  wx  Ax 
2

2 B
M (0)  0
0  2 w 02  A 0  B B  0
1

M (l)  
1
0 0  2 w l 2  A l  B A   21 wl
 Step 4: 
Substitute back the values for A
and B1 2 1
M  wx  wlx 1
2 M  2 wx(l  x)
2
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
dt 
g(t)h( y)
Separation – General
Idea
First
Separate:
dy

h( y) g(t)dt

Then integrate LHS with


respect to y, RHS with
respect to t.
h( y)
dy
   g(t)dt  C
Separation -
Example
dy
dt  y
sin(t)
Separat
e: 1
y dy  sin(t)dt
Now
integrate:
1
y dy 
 ln( y)  cos(t)  c
cos(t )c

 sin(t)dt
y  e

 y  Aecos(t )
Cooling of a cup of
coffee Amount of heat in a cup of
coffee:
heat volume specific

Q
heat

VcT
densit temperatur
y e

Heat balance equation (words):


 Rate of change of heat = heat lost to
surrounding air
Cooling acup of coffee
of 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
dt  hA(T  T
Room

)
Cooling acup of
of coffee
dQ
dt  hA(T  T
Room

Substitute ) dT
in Q 
V c  hA(T  TRoom )
VcT dt
wher
rearrang dT
e  (T  TRoom ) e hA
 Vc
dt
Now we solve the equation together with
the initial condition:

T (0)  TInitial
Cooling acup of coffee -
of Solution
dT
 (T  T Room
dt
)
 Step 1: dT
 dt
Separat (T  TRoom )
e

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


Integrat
e Make explicit in
unknown T
t c
T  TRoom  e
where
T  T Room  Aet
A  ec
Cooling acup of coffee -
of Solution
T T  Ae t
Room T (0)  TInitial

 Step 3: TInitial  T Room  Ae0


Use
Initial
Conditio
n A  (TInitial  TRoom )

 Step 4:
Substitute T  Room  (TInitial  T Room )et
back to T
obtain final
answer
Solution Methods - Integrating Factor
The integrating factor method is used
for nonhomogeneous linear 1st order
equations
The basic ideas are:
 Collect all the terms involving y on the
dy
and hand side of the equation. left dt
 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.
Integrating Factor – Example

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

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:
Integrating Factor – Example
Product Rule:

d ( f .y)
 f

dy df dt
 y

The basic idea is that if we multiply the ODE by the


dt dtfactor) we can make
correct function (an integrating
the LHS of the ODE look like the RHS of the
product rule.
Integrating Factor – Example
We will look ahead, use the answer and show how it
later.
is derived
For our ODE the integrating
factor is t
e
Thus the ODE
becomes:

e t dy
dt  e y 
t

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

f  et
Integrating Factor – Example
We can rewrite the
equation as:
t dy d t
e t y
(e
dt )e dt
o
r d (et y)
et
dt

Now we can use direct integration

et y  et  C

Do not forget C, the constant of


integration!
Integrating Factor – Example
Rearrange to make this
explicit in y

y  1  Cet
Now use the initial condition to
calculate C

y(0)  2  1  Ce0  2
1C2
C1
Substitute back to obtain the final
solution

t
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
dydty  

 To make the LHS of this equation look like the


RHS of the Product Rule we must choose

d

dt
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
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    et c
   Aet

 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:

 et
Finding the integrating factor in
general • Given the general form of a
nonhomogeneous 1st order
equation:

dy
dt  g(t) y  f (t)
y(0)  y0

 How do we use the


integrating factor method
to find a y?
Finding the integrating factor in
general • Step 1: Multiply by
Φ:
dydtg(t) y  f (t)
 Step 2: Compare with the RHS of
the
Product Rule and set up equation
for Φ: ddt g(t)
 Step 3: Use separation to solve
for Φ:
d
  g(t)dt
 ln  g(t)dt

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

y  fdt  C
 Step 6: Divide
1 by Cto make explicit
y  fdt 
in y :
 
 Step 7: Use the initial
conditions to evaluate C :
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
 g(t)dt and f (t)dt
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
dt  g(t) y  f (t)
The ODE is already in that
form!

Step 2: Find the integrating factor:

 tdt
g(t)  t 1 e
t2
 e 2
Solving an example using the
integrating factor method
Step 3: Multiply by the integrating
factor:
2
t
e2
1 dy 1t
ty  te
21t

dt  e 2
2
2
Step 4: Use the reverse Product
Rule:
d[e 1 t y]
2
2
t2
 1
2
dt te
Step 5: Integrate and make
explicit in y:

y  te dt  C e 
1 t2 21 t
2
21
e t2
 C
2

 12t
 y1
2

Ce
Solving an example using the
integrating factor method
Step 6: Use the initial conditions to find the exact solution:

y(0)  0  1  Ce0  0
1C0
 C  1
Step 7: Substitute back into the original
equation:

y  1  12 t 2

e
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:

y  Ce t
Characteristic Equations
• gives the differentials
y   Cet
y
Cet y   2Ce t

(3)   Ce
3 t
y


y

(n)  n

 Ce t
An algebraic characteristic equation comes from
substituting in for y and its derivatives and
cancelling out
t
Ce
Exponential Trial -
Example y  5 y  Try y
Ae
t
0 Ae  5Ae  0
t t

 Cancelling
gAiveest the characteristic
out
equation

 5    5
0
 Substituting this back
gyives
into

y  Ae5t Aet
Solving
Guide
General Form Description Solvin
g
Metho
d
 1st or higher Direct
d y n
 order Integrati
f (t) 
dt n RHS does on
not depend
on the
unknown y
 1st order only Separation
dy
 f (t, y) 
g(t)h( y) dt
 1st order Integrating
dy
 g(t) y  f (t)  nonhomogeneou Factor
dt s Method
 linear equation
Solving
Guide
General Form Description Solvin
g
Metho
d
 2nd order or Exponential
n n1
d y

d y
 higher trial.
 homogeneous
an1
dtn dtn1  linear equation
dy  constant
… a a
y  01 coefficients
dt
0

 2nd order or Problems like


higher this can be
dny d n1 y 
  nonhomogeneous solved for
an1  linear equation some types
dtn dtn1  of f.
constant
dy
Solving
Guide
General Form Description Solvin
g
Metho
d
dny d n1 y  2nd order or Can only
 
gn1 (t) higher solve a few
dtn dtn1
 nonhomogeneou ‘special’
dy
…  g (t)  g (t) y  f s problems
(t) 
1
dt 0 linear equation
 variable
coefficients
 2nd order Generally
 Function f can’t be
d 2y

 contains t, y solved
dy  and y’ terms analytically
f  t, y, 
dt 2
 dt  all (see Module
mixed up 4 for

You might also like