ODE - Phil Dybvig

Download Report

Transcript ODE - Phil Dybvig

Fin500J: Mathematical Foundations in Finance
Topic 6: Ordinary Differential Equations
Philip H. Dybvig
Reference: Lecture Notes by Paul Dawkins, 2007, page 20-33, page 102-121,
page 137-155 and page 340-344
http://tutorial.math.lamar.edu/terms.aspx
Slides designed by Yajun Wang
Fin500J Topic 6
Fall 2010
Olin Business School
1
Introduction to Ordinary
Differential Equations (ODE)
 Recall basic definitions of ODE,
 order
 linearity
 initial conditions
 solution
 Classify ODE based on( order, linearity, conditions)
 Classify the solution methods
Fin500J Topic 6
Fall 2010
Olin Business School
2
Derivatives
Derivatives
Ordinary Derivatives
u
y
dy
dx
y is a function of one
independent variable
Fin500J Topic 6
Partial Derivatives
Fall 2010
Olin Business School
u is a function of
more than one
independent variable
3
Differential Equations
Differential
Equations
Ordinary Differential Equations
Partial Differential Equations
2
d y
 6 xy  1
2
dx
involve one or more
Ordinary derivatives of
unknown functions
Fin500J Topic 6
Fall 2010
Olin Business School
u u


0
2
2
y
x
2
2
involve one or more
partial derivatives of
unknown functions
4
Ordinary Differential Equations
Ordinary Differential Equations (ODE) involve one or
more ordinary derivatives of unknown functions with
respect to one independent variable
Exam ples:
dy
 y  ex
dx
d2y
dy
 5  2 y  cos(x)
2
dx
dx
y(x): unknown function
x: independent variable
Fin500J Topic 6
Fall 2010
Olin Business School
5
Order of a differential equation
The order of an ordinary differential equations is the order
of the highest order derivative
Exam ples:
dy
 y  ex
dx
d2y
dy
 5  2 y  cos(x)
2
dx
dx
 d y

2
dx

2
Fin500J Topic 6
First order ODE
Second order ODE
3
 dy
   2 y 4  1
 dx
Fall 2010
Olin Business School
Second order ODE
6
Solution of a differential equation
A solution to a differential equation is a function that
satisfies the equation.
Exam ple:
dx(t )
 x(t )  0
dt
Fin500J Topic 6
Fall 2010
Solution x(t )  e t
P roof:
dx(t )
t
 e
dt
dx(t )
 x(t )  e t  e t  0
dt
Olin Business School
7
Linear ODE
An ODE is linear if the unknown function and its derivatives
appear to power one. No product of the unknown function
and/or its derivatives
an ( x) y n ( x)  an1 ( x) y n1 ( x)   a1 ( x) y' ( x)  a0 ( x) y( x)  g ( x)
Exam ples:
dy
 y  ex
dx
d2y
dy
2

5

2
x
y  cos(x)
2
dx
dx
Linear ODE
3
 d y  dy
 2    y  1
 dx  dx
2
Linear ODE
Fin500J Topic 6
Fall 2010
Non-linear ODE
Olin Business School
8
Boundary-Value and Initial value Problems
Boundary-Value Problems
Initial-Value Problems

The auxiliary conditions are
at one point of the
independent variable
y' '2 y' y  e
 The auxiliary conditions are not at
one point of the independent
variable
 More difficult to solve than initial
value problem
y' '2 y' y  e 2 x
2 x
y(0)  1, y' (0)  2.5
same
Fin500J Topic 6
y(0)  1, y(2)  1.5
different
Fall 2010
Olin Business School
9
Classification of ODE
ODE can be classified in different ways
 Order
 First order ODE
 Second order ODE
 Nth order ODE
 Linearity
 Linear ODE
 Nonlinear ODE
 Auxiliary conditions
 Initial value problems
 Boundary value problems
Fin500J Topic 6
Fall 2010
Olin Business School
10
Solutions
 Analytical Solutions to ODE are available for linear
ODE and special classes of nonlinear differential
equations.
 Numerical method are used to obtain a graph or a
table of the unknown function
 We focus on solving first order linear ODE and second
order linear ODE and Euler equation
Fin500J Topic 6
Fall 2010
Olin Business School
11
First Order Linear Differential Equations
 Def: A first order differential equation is
said to be linear if it can be written
y  p ( x) y  g ( x)
Fin500J Topic 6
Fall 2010
Olin Business School
12
First Order Linear Differential Equations
 How to solve first-order linear ODE ?
y  p( x) y  g ( x) (1)
Sol:
Multiplying both sides by  (x) , called an integrating factor,
gives
dy
 ( x)   ( x) p( x) y   ( x) g ( x) (2)
dx
assuming
 ( x) p( x)   ' ( x), (3)
we get
dy
 ( x)   ' ( x) y   ( x) g ( x) (4)
dx
Fin500J Topic 6
Fall 2010
Olin Business School
13
First Order Linear Differential Equations
By product rule, (4) becomes
(  ( x) y ( x))'  ( x) g ( x) (5)
  ( x) y ( x)    ( x) g ( x)dx  c1
 ( x) g ( x)dx  c

 y ( x) 
1
 ( x)
( 6)
 (x) from (3)
 ' ( x)
 ( x) p ( x)   ' ( x) 
 p ( x)
 ( x)
Now, we need to solve
Fin500J Topic 6
Fall 2010
Olin Business School
14
First Order Linear Differential Equations
 ' ( x)
 p( x)  (ln  ( x))' p( x)
 ( x)
 ln  ( x)   p( x)dx  c2
  ( x)  e
 p ( x ) dx  c2
 c3e
 p ( x ) dx
(7 )
to get rid of one constant, we can use
 ( x)  e  p ( x ) dx (8)
T hesolution ot a linear first order differential equationis then
 ( x) g ( x)dx  c

y ( x) 
e
Fin500J Topic 6
p ( x ) dx
Fall 2010
(9)
Olin Business School
15
Summary of the Solution Process
 Put the differential equation in the form (1)
 Find the integrating factor,  (x) using (8)
 Multiply both sides of (1) by  (x) and write the left
side of (1) as (  ( x) y( x))'
 Integrate both sides
 Solve for the solution y (x)
Fin500J Topic 6
Fall 2010
Olin Business School
16
Example 1
y  y  e
2x
Sol:
y ( x)  e 
 p ( x ) dx
e 
 ( 1) dx

 e  p ( x ) dx g ( x)dx  c 
 

 e  ( 1) dx e 2 x dx  c 
 

 e x  e  x e 2 x dx  c

 ex ex  c
 ce  e
x
Fin500J Topic 6
Fall 2010


2x
Olin Business School
17
Example 2
Sol:
1
xy '2 y  x  x, y (1) 
2
2
 y '
2
y  x 1
x
 y ( x)  e 
 p ( x ) dx
 e  p ( x ) dx g ( x)dx  c 
 


2



 x dx
2
2
e
e
(
x

1
)
dx

c

x
x
( x  1)dx  c





1
1
1
 1
 x  2  x 4  x 3  c   x 2  x  cx  2
3
3
4
 4
Apply theinitialconditionto get c,


Fin500J Topic 6
2
dx
x

1 1 1
7
  cc  .
2 4 3
12
Fall 2010
Olin Business School
18
Second Order Linear Differential Equations
 Homogeneous Second Order Linear Differential
Equations
o real roots, complex roots and repeated roots
 Non-homogeneous Second Order Linear Differential
Equations
o Undetermined Coefficients Method
 Euler Equations
Fin500J Topic 6
Fall 2010
Olin Business School
19
Second Order Linear Differential Equations
The general equation can be expressed in the form
ay' 'by'cy  g ( x)
where a, b and c are constant coefficients
Let the dependent variable y be replaced by the sum of the
two new variables: y = u + v
Therefore
au' 'bu'cu  av' 'bv'cv  g ( x)
If v is a particular solution of the original differential equation
purpose
au' 'bu'cu  0
The general solution of the linear differential equation will be the
sum of a “complementary function” and a “particular solution”.
Fin500J Topic 6
Fall 2010
Olin Business School
20
The Complementary Function (solution of the
homogeneous equation)
ay' 'by'cy  0
Let the solution assumed to be:
dy
 re rx
dx
erx (ar2  br  c)  0
y  e rx
d2y
2 rx

r
e
2
dx
characteristic equation
Real, distinct roots
Double roots
Complex roots
Fin500J Topic 6
Fall 2010
Olin Business School
21
Real, Distinct Roots to Characteristic Equation
• Let the roots of the characteristic equation be real, distinct
and of values r1 and r2. Therefore, the solutions of the
characteristic equation are:
y  e r1x
y  e r2 x
• The general solution will be
y  c1er1x  c2er2 x
• Example
y' '5 y'6 y  0
r1  2
r2  3
Fin500J Topic 6
Fall 2010
r 2  5r  6  0
y  c1e2 x  c2e3 x
Olin Business School
22
Equal Roots to Characteristic Equation
• Let the roots of the characteristic equation equal and of value r1
= r2 = r. Therefore, the solution of the characteristic equation is:
y  e rx
Let
y  Ve rx
 y'  erxV 'rVe rx
and y' '  erxV ' '2rerxV 'r 2Ve rx
where V is a
function of x
ay' 'by'cy  0
ar2  br  c  0
2ar  b  0
V ' ' ( x)  0
V  cx  d
y  berx  (cx  d )erx  c1erx  c2 xerx
Fin500J Topic 6
Fall 2010
Olin Business School
23
Complex Roots to Characteristic Equation
Let the roots of the characteristic equation be complex in the
form r1,2 =λ±µi. Therefore, the solution of the characteristic
equation is: y  e(    i ) x  ex (cos(x)  i sin(x)),
1
y2  e(    i ) x  ex (cos(x)  i sin(x)).
1
1
u ( x)  ( y1  y2 )  ex cos(x), v( x)  ( y1  y2 )  ex sin(x)
2
2i
It is easy tosee thatu and v are two solutionsto thedifferential
equation.T herefore,thegenealsolution ot thed.e. is :
y(x)  c1e λx cos(x)  c2e λx sin(x).
Fin500J Topic 6
Fall 2010
Olin Business School
24
Examples
(I) Solve y' '6 y'9 y  0
(II) Solve y' '4 y'5 y  0
characteristic equation
characteristic equation
r 2  4r  5  0
r 2  6r  9  0
r1  r2  3
y  (c1  c2 x)e
Fin500J Topic 6
r1, 2  2  i
3 x
Fall 2010
y  e2 x (c1 cos x  c2 sin x)
Olin Business School
25
Non-homogeneous Differential Equations (Method of
Undetermined Coefficients)
ay' 'by'cy  g ( x)
When g(x) is constant, say k, a particular solution of equation is
y  k /c
2
n
When g(x) is a polynomial of the form a0  a1x  a2 x  ... an x where
all the coefficients are constants. The form of a particular solution is
y  0  1 x  2 x2  ... n xn
Fin500J Topic 6
Fall 2010
Olin Business School
26
Example
Solve
y' '4 y'4 y  4x  8x3
complementary function
y' '4 y'4 y  0
y  p  qx  rx 2  sx 3
y'  q  2rx  3sx 2
y' '  2r  6sx
r 2  4r  4  0
characteristic equation
(2r  6sx)  4(q  2rx  3sx 2 )  4( p  qx  rx 2  sx3 )  4x  8x3
equating coefficients of equal powers of x
r2
2r  4 q  4 p  0
6s  8r  4q  4
4r  12s  0
4s  8
yc  (c1  c2 x)e2 x
y  yc  y p
y p  7 10x  6x2  2x3
Fin500J Topic 6
Fall 2010
 (c1  c2 x)e 2 x  7  10x  6 x 2  2 x 3
Olin Business School
27
Non-homogeneous Differential Equations
(Method of Undetermined Coefficients)
• When g(x) is of the form Te r x , where T and r are constants. The
form of a particular solution is
rx
y  Ae
A
T
ar 2  br  c
• Whe n g ( x ) i s o f th e fo r m C s i n n x + D cos n x , wh ere C a nd D a re
constants, the form of a particular solution is
y  E sin nx  F cosnx
(c  n 2 a)C  nbD
E
(c  n 2 a) 2  n 2b 2
(c  n 2 a)C  nbD
F
(c  n 2 a ) 2  n 2 b 2
Fin500J Topic 6
Fall 2010
Olin Business School
28
Example
Solve
complementary function
3 y' '6 y'  18
3 y' '6 y'  0
y  Cx
y'  C
3r 2  6r  0
y' '  0
characteristic equation
3(0)  6(C)  18
r1  0, r2  2
yc  c1  c2e2 x
C  3
y  yc  y p
y p  3x
Fin500J Topic 6
Fall 2010
 3x  c1  c2e 2 x
Olin Business School
29
Example
Solve
complementary function
3 y' '10y'8 y  7e4 x
3 y' '10y'8 y  0
y  Cxe4 x
y'  (1  4x)Ce 4 x
y' '  (16x  8)Ce
 24C  10C  7
C
4 x
3r 2  10r  8  (3r  2)(r  4)  0
characteristic equation
r1  2 / 3, r2  4
yc  Ae2 x / 3  Be4 x
1
2
y  yc  y p
1 4 x
  xe  Ae2 x / 3  Be4 x
2
1 4 x
y p   xe
2
Fin500J Topic 6
Fall 2010
Olin Business School
30
Example
Solve
complementary function
y' ' y'6 y  52cos2 x
y' ' y'6 y  0
y  C cos2 x  D sin 2 x
y'  2(C sin 2 x  D cos2 x)
y' '  4(C cos2 x  D sin 2 x)
r 2  r  6  (r  2)(r  3)  0
characteristic equation
 10C  2 D  52
 2C  10D  0
r1  2, r2  3
yc  Ae2 x  Be3x
C  5
D 1
y  yc  y p
y p  5 cos2x  sin 2x
Fin500J Topic 6
Fall 2010
 Ae2 x  Be3 x  5 cos 2 x  sin 2 x
Olin Business School
31
Euler Equations
 Def: Euler equations
ax y' 'bxy'cy  0
2
 Assuming x>0 and all solutions are of the
form y(x) = xr
 Plug into the differential equation to get the
characteristic equation
ar(r  1)  b(r )  c  0.
Fin500J Topic 6
Fall 2010
Olin Business School
32
Solving Euler Equations: (Case I)
• The characteristic equation has two different real
solutions r1 and r2.
• In this case the functions y = xr1 and y = xr2 are both
solutions to the original equation. The general solution
is:
y( x)  c xr1  c xr2
1
2
Example:
2 x 2 y ' '3xy'15y  0, thecharacteristic equationis :
5
2r(r-1 )  3r-15  0  r1  , r2  3.
2
5
2
 y(x)  c1 x  c2 x 3.
Fin500J Topic 6
Fall 2010
Olin Business School
33
Solving Euler Equations: (Case II)
• The characteristic equation has two equal roots r1 =
r2=r.
• In this case the functions y = xr and y = xr lnx are both
solutions to the original equation. The general solution
is:
y( x)  x r (c  c ln x)
1
2
Example:
x 2 y ' '7 xy'16 y  0, thecharacteristic equation is :
r(r-1 )  7 r  16  0  r  4.
 y(x)  c1 x 4  c2 x 4 ln x.
Fin500J Topic 6
Fall 2010
Olin Business School
34
Solving Euler Equations: (Case III)
• The characteristic equation has two complex roots r1,2 =
λ±µi.
x    i  e (    i ) ln x  x  cos( ln x)  ix  sin( ln x)
So, in thecase of complexroots,thegeneralsolution will be :
y(x)  x λ(c1 cos(μ ln x)  c2 sin (μ ln x))
Example:
x 2 y' '3xy'4 y  0, thecharacteristic equationis :
r(r-1 )  3r  4  0  r1, 2  1  3i.
 y(x)  c1 x 1 cos( 3 ln x)  c2 x 1 sin( 3 ln x).
Fin500J Topic 6
Fall 2010
Olin Business School
35