Ordinary Differential Equations

advertisement
ODEs
Summer08
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Ordinary Differential Equations
Exact Equation
Linear ODE
Conclusion
Esteban Arcaute1
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
1 Institute
for Computational and Mathematical Engineering
Stanford University
Variation of
Parameters
Conclusion
Power Series
iCME and MSandE Math Refresher Course
ODEs Special Session
ODEs
Summer08
Outline
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
1 Introduction
2 First Order ODEs
Separation of Variables
Exact Equation
Linear ODE
Conclusion
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
3 Second Order ODEs
Roadmap
Reduction of Order
Constant Coefficients
Variation of Parameters
Conclusion
4 Power Series
ODEs
Summer08
Esteban
Arcaute
Why do I need ODEs?
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
• Massively used to model physical systems
• Building block to solve PDEs
• Neat Linear Algebra connections
• Most importantly, it doesn’t get simpler than this
ODEs
Summer08
Let’s Solve ODEs!
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
What this course is not about.
• How to model a system/problem using ODEs
• Why such system/problem is modeled using ODEs
• Theoretical considerations about ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
What this course is about.
• First and second order ODEs
• When possible, how to get analytical solutions
• When necessary, how to get approximate solutions
• When needed, how to get numerical solutions
ODEs
Summer08
What is Assumed
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
It is assumed that you are sufficiently comfortable with real
analysis to know what assumptions are needed on all the
functions used in an ODE for the equation to be well
defined.
Common assumptions are
• all functions are sufficiently regular
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
• all functions are real, scalar functions
• domains are properly adjusted for expressions to make
sense
• the letters x and t usually correspond to scalar
variables
• the letters f and g are usually given functions
• the letters y , u, v and w are used for undetermined
functions
ODEs
Summer08
Esteban
Arcaute
Definition
The most general form to write a first order ODE is
Introduction
dy
= f (x, y )
dx
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Examples
• Temperature of a hot body
Second Order
ODEs
dT
= −k (T − Ta )
dt
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
• Object free fall with friction
Conclusion
Power Series
du
λ
=g− u
dt
m
• Logistics Equation
dy
= (r − ay )y
dt
ODEs
Summer08
What is Known
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
• Analytical form for all first order linear ODEs
• Analytical form for some special first order ODEs
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
• Closed form not always available (in real life, mostly
never)
• Need one boundary condition y (x0 ) = y0 to uniquely
determine solution
• Any k th order ODE can be written as a first order ODE
where y is a function into <k
The last is an important point used to numerically solve
ODEs.
ODEs
Summer08
Esteban
Arcaute
Separation of Variables
So Lucky!
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
Assume that f (x, y ) = M(x)N(y ). We then can solve those
ODEs. The general technique is to put all the factors
depending on y on the left hand side, and all those
depending on x on the right hand side.
dy
= M(x)dx.
N(y )
Thus the general solution is given by
Z
Z
dy
= M(x)dx + c
N(y )
where c is an integration constant.
ODEs
Summer08
Examples
Esteban
Arcaute
Introduction
First Order
ODEs
• Hot body temperature
Separation of
Variables
T (t) = Ta + T (0)e−kt
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
• Object free fall with friction
Roadmap
Reduction of Order
u(t) =
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
g
+ u(0)eλt
λ
• Can you solve
dy
dy
= cos2 (y )? or
= y cos2 (y )?
dx
dx
ODEs
Summer08
Partial Fractions
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
What if the function N(y ) is a rational function, i.e. of the
form
Conclusion
Second Order
ODEs
Roadmap
N(y ) =
P(y )
with P and Q polynomials?
Q(y )
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
We then need partial fractions to calculate
Z
Z
dy
Q(y )
=
dy
N(y )
P(y )
ODEs
Summer08
Logistics Equation
Esteban
Arcaute
Introduction
First Order
ODEs
We can rewrite the logistics equation as
dy
y
r
=r 1−
y with K =
dt
K
a
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
and we get
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Z
dy
=
1 − Ky y
Z
rdt + c = rt + c
Conclusion
Power Series
Note that, from partial fractions we get
1
1
1
=
+
y
K −y
y
1− K y
ODEs
Summer08
Logistics Equation
End
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Thus we get
Z
Z
Z
1
1
|y |
dy
=
dy +
dy = log
N(y )
K −y
y
|K − y |
Roadmap
Reduction of Order
Constant
Coefficients
and thus we get, after some math here and there
Variation of
Parameters
y (t) =
Conclusion
Power Series
K
exp(−rt)
c0
.
+1
Note that the logistics equation is a non-linear ordinary
differential equation.
ODEs
Summer08
Esteban
Arcaute
Exact Equation Technique
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Recall that f is a function of two variables. Its total
differential is
∂f
∂f
dx +
dy
df =
∂x
∂y
if f (x, y ) = c, then we have df = 0, or
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
∂f
∂f dy
+
=0
∂x
∂y dx
Conclusion
Power Series
which is an ODE. Thus the solutions are given by
f (x, y ) = c
which is only an implicit definition of the solution.
ODEs
Summer08
Esteban
Arcaute
When can we use the
Exact Equation Technique?
Introduction
First Order
ODEs
Separation of
Variables
Rewrite the first order ODE into
Exact Equation
M(x, y )dx + N(x, y )dy = 0.
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
We say that a differential equation is exact if there exists a
function f (x, y ) such that
∂f
∂f
= M(x, y ) and
= N(x, y ).
∂x
∂y
or, equivalently,
∂M
∂N
=
∂y
∂x
ODEs
Summer08
Esteban
Arcaute
Exact Equation
End
Introduction
First Order
ODEs
Thus, if the equation is exact, we have f (x, y ) = c
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
Example: 2xydx + (x 2 − 1)dy = 0.
ODEs
Summer08
Esteban
Arcaute
Exact Equation
End
Introduction
First Order
ODEs
Thus, if the equation is exact, we have f (x, y ) = c
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Example: 2xydx + (x 2 − 1)dy = 0.
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Solution: f (x, y ) = c with f (x, y ) = x 2 y − y .
Power Series
What if equation is not exact? There exists a method called
the Integrating Factors Method. We will not cover such
technique as it is somehow lengthy.
ODEs
Summer08
Esteban
Arcaute
Linear ODEs
We Can Solve Them!
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
In standard form, we have
dy
+ p(x)y (x) = r (x)
dx
If r (x) = 0, we have an homogeneous linear ODE
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
dy
+ p(x)y (x) = 0
dx
which can be solved using separation of variables
Z
Z
R
dy
= − p(x)dx or y (x) = c0 e− p(x)dx .
y
for a well defined constant c0 .
ODEs
Summer08
Variation of Parameters
Esteban
Arcaute
Introduction
First Order
ODEs
If r (x) 6= 0, we look for a solution of the form
Separation of
Variables
y (x) = u(x)e−
Exact Equation
R
p(x)dx
;
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
which is leads to
R
du
= r (x)e p(x)dx or u(x) =
dx
Z
r (x)e
R
p(x)dx
dx + c
Variation of
Parameters
Conclusion
and finally
Power Series
y (x) = e
−
R
p(x)dx
Z
r (x)e
R
p(x)dx
dx + c
ODEs
Summer08
Linear ODE
Example
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Consider the following Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
0
y −
4
y = x 5 ex .
x
ODEs
Summer08
Linear ODE
Example
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Consider the following Equation
Linear ODE
Conclusion
0
y −
Second Order
ODEs
Roadmap
4
y = x 5 ex .
x
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
The solution is
Power Series
y (x) = x 4 [(x − 1)ex + c]
ODEs
Summer08
Wait, Can We Do Better?
YES! (sometimes)
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Assume that
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
• yh (x) is the general solution to the homogeneous
equation
• yp (x) is a solution to the non-homogeneous equation
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Then the general solution to the non-homogeneous
equation is given by
Power Series
y (x) = yh (x) + yp (x)
Thus, if you can find yh (x) and guess a particular solution
yp (x), then you are done!
ODEs
Summer08
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
Simple Example
Assume you want to find the general solution to
dy
y
− =x
dx
x
ODEs
Summer08
Simple Example
Esteban
Arcaute
Introduction
Assume you want to find the general solution to
First Order
ODEs
dy
y
− =x
dx
x
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Then one can see that
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
• yp (x) = x 2 is a particular solution
• yh (x) = ax is the solution to the homogeneous
equation
Power Series
The general solution is given by
y (x) = x 2 + ax
ODEs
Summer08
Conclusion for First Order
ODEs
Esteban
Arcaute
Introduction
First Order
ODEs
1
Separable Equation: dy /N(y ) = M(x)dx
We can solve them by integrating directly the ODE.
2
Exact Equations.
An exact equation is of the form
M(x, y )dx + N(x, y )dy = 0 such that there exists a
function f (x, y ) whose total differential is
df = M(x, y )dx + N(x, y )dy . Thus the solutions of this
equation are given by f (x, y ) = c for c constant.
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
3
Linear Equations: dy
dx + p(x)y = r (x)
We can provide an analytical solution to such equation:
Z
R
R
− p(x)dx
p(x)dx
y (x) = e
r (x)e
dx + c
ODEs
Summer08
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
General Considerations
Second order ODEs are, in general, equations of the form
d 2y
dy
= f x, y ,
dx
dx 2
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
But such equations are too hard to solve. We will thus focus
on linear second order ODEs. The general form is
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
d 2y
dy
+ p(x)
+ q(x)y = r (x)
2
dx
dx
Conclusion
Power Series
We just gave a general formula for first order linear ODEs.
That is impossible for second order ODEs. We will only give
general techniques for the even simpler case of constant
coefficients.
d 2y
dy
a 2 +b
+ cy = r (x)
dx
dx
ODEs
Summer08
Important Result
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Theorem
Let y1 (x) and y2 (x) be two linearly independent solutions to
the homogeneous equation.
Let yp (x) be a particular solution to the ODE.
Then the general solution to the ODE is given by
Variation of
Parameters
Conclusion
Power Series
y (x) = c1 y1 (x) + c2 y2 (x) + yp (x)
ODEs
Summer08
Roadmap to Second Order
ODEs
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
1
Second Order
ODEs
• Method of Reduction of Order
• Constant Coefficients
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
Homogeneous Equation
2
Non-homogeneous Equation
• Variation of Parameters
ODEs
Summer08
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
Method of Reduction of Order
Getting to a First Order ODE
Assume that you know a solution y1 to the homogeneous
equation. From Theorem 1, to get the general solution we
only need to find a second solution y2 that is linearly
independent from y1 .
We look for solutions of the form y2 (x) = u(x)y1 (x). This
yields
du
dy1
d 2u
y
+
2
+
p(x)y
1
1 = 0.
dx
dx
dx 2
But this equation is independent of u. Thus, if we set w = u 0
and divide by y1 , we get
0
y1
dw
+ w 2 + p(x) = 0
dx
y1
which is a first order separable ODE!
ODEs
Summer08
Reduction of Order
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Thus we get
w(x) = c0
e−
R
p(x)dx
y12
.
Given that if y2 is a solution to the ODE, cy2 is a solution for
any c, we can set c0 = 1. Then we have
!
R
Z
e− p(x)dx
dx + c 0
u(x) =
y12
Conclusion
Power Series
But recall that y2 (x) = u(x)y1 (x). We can drop the
integration constant c 0 to get
!
R
Z
e− p(x)dx
y2 (x) = y1 (x)
dx.
y12
ODEs
Summer08
Reduction of Order
Summary
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
• For homogeneous equation
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
• Assume y1 (x) a non trivial solution known
• Set y2 (x) = u(x)y1 (x)
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
• Solve for u(x)
• Get general solution
Z
yh (x) = c1 y1 (x) + c2 y1 (x)
e−
R
p(x)dx
y12
!
dx
ODEs
Summer08
Example
Euler-Cauchy Equation
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Consider the following second order linear ODE
Exact Equation
Linear ODE
Conclusion
x2
Second Order
ODEs
d 2y
dy
+ 4y = 0
− 3x
2
dx
dx
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
First note that y1 (x) = x 2 is a solution to this equation.
Next apply the method of Reduction of order to get
Conclusion
u(x) = log |x|
Power Series
which yields
y (x) = x 2 (c1 + c2 log |x|) .
ODEs
Summer08
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
General Result
The equations we consider are of the form
d 2y
dy
+ cy = 0.
+b
2
dx
dx
Consider the following polynomial
a
ar 2 + br + c = 0
and its solutions r1 = λ1 + iµ and r2 = λ2 − iµ. Then we
have that
• if r1 6= r2 ∈ <, then the general solution is
yh (x) = c1 er1 x + c2 er2 x
• if r1 = r2 , then the general solution is
yh (x) = (c1 + c2 x)er1 x
• if r1 ∈
/ <, then λ1 = λ2 = λ. The general solution is
y (x) = eλx [c1 cos(µx) + c2 sin(µx)] .
ODEs
Summer08
Variation of Parameters
Setting
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Here we consider the general inhomogeneous equation
d 2y
dy
+ q(x)y = r (x)
+ p(x)
dx
dx 2
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
We assume that we have two linearly independent solutions
y1 and y2 to the homogeneous equation
Then we have that
Theorem (Variation of Parameters)
A particular solution to the inhomogeneous equation is
given by
Z
Z
ry1
ry2
yp (t) = −y1 (t)
dt + y2 (t)
dt, where
W
W
W (t) = y1 (t)y20 (t) − y10 (t)y2 (t).
ODEs
Summer08
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
Summary of Results
• If constant coefficients, general solution to
homogeneous equation known.
• If one solution to homogeneous equation known,
general solution available using Reduction of Order.
• If general solution to homogeneous equation known,
then general solution to inhomogeneous equation
known using Variation of Parameters
In short, in all situations for second order linear ODEs, it is
sufficient to
• know how to solve first order ODEs
• “get lucky” and find one non-trivial solution to the
homogeneous equation
ODEs
Summer08
Esteban
Arcaute
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Power Series Theorems 1
Theorem (Uniqueness of Power Series)
Assume that we have two power series such that
+∞
X
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
n
an x =
n=0
+∞
X
bn x n ,
n=0
then we have that, for all n ≥ 0, an = bn .
Usual Functions:
+∞
X
1 n
x
e =
x
n!
cos(x) =
n=0
+∞
X
n=0
(−1)n 2n
x
(2n)!
+∞
X
(−1)n 2n+1
sin(x) =
x
.
(2n + 1)!
n=0
ODEs
Summer08
Esteban
Arcaute
Power Series Theorems 2
Introduction
First Order
ODEs
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Theorem (Power Series and Derivatives)
Let f be a function such that its power series around 0 is
given by
+∞
X
f (x) =
an x n ,
n=0
Reduction of Order
Constant
Coefficients
Variation of
Parameters
then the power series of its derivative f 0 (x) is given by
Conclusion
Power Series
f 0 (x) =
+∞
X
n=0
(n + 1)an+1 x n .
ODEs
Summer08
Airy’s Equation
Esteban
Arcaute
Introduction
First Order
ODEs
Consider the following equation (known as the Airy
Equation)
Separation of
Variables
Exact Equation
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
00
y − xy = 0
ODEs
Summer08
Airy’s Equation
Esteban
Arcaute
Introduction
First Order
ODEs
Consider the following equation (known as the Airy
Equation)
Separation of
Variables
Exact Equation
00
y − xy = 0
Linear ODE
Conclusion
Second Order
ODEs
Roadmap
The solution is given by
Reduction of Order
Constant
Coefficients
Variation of
Parameters
Conclusion
Power Series
1
1 6
y (x) =a0 1 + x 3 +
x + ...
6
180
1 4
1 7
+ a1 x +
x +
x + ... .
12
420
Download