Lecture 2 - Differential equations

advertisement
Physics for informatics
Lecture 2
Differential equations
Ing. Jaroslav Jíra, CSc.
Basic division of differential equations
According to type of derivation
Ordinary Differential Equations – ODE
They contain a function of one independent variable and its
derivatives.
Example:
d 2 y dy
  2 y  x or
2
dx
dx
y  y  2 y  x
Partial Differential Equations - PDE
They contain unknown multivariable functions and their partial
derivatives.
Example:
 2u  2u  2u 1  2u
 2 2  2 2
2
dx dy dz
c dt
where u ( x, y, z, t )
Types of Ordinary Differential Equations
General definition of an ODE
F ( x, y, y, y,....y ( n1) )  y ( n)
or F ( x, y, y, y,....y ( n) )  0
First order differential equations
The highest derivative of the function y of independent variable they
contain is one.
Example:
y  y  2 x
Higher order differential equations
They contain at least second derivative of the function y
Example:
3 y  2 y  y  x
Types of Ordinary Differential Equations
Linear differential equations
The function y appears just linearly here. There are no powers of the
function y and its derivatives, there are no products of the funciton y
and its derivatives. There are also no functions of the function y like
sin(y), exp(y) etc.
Example:
y  3 y  y  y  2 x
Nonlinear differential equations
If any of conditions previously defined for the linear DE is not met,
then we talk about nonlinear DE.
Example:
y  sin( y)  0 or y  yy  0 or y  y 2  0
Types of Ordinary Differential Equations
Homogeneous differential equations
There is no constant or function of x on the right side of the equation.
Example:
2 y  y  y  0
Inhomogenous differential equations
Exact opposite to the homogenous DE.
Example:
2 y  y  4 or
y  2 y  3 x
Types of Ordinary Differential Equations
Differential equations with constant coefficients
The function y and all its derivatives are mutiplied just by constants.
Example:
5 y  4 y  y  3 y  x
Differential equations with variable coefficients
The function y and its derivatives are mutiplied either by constants or
by functions of x.
Example:
3xy  (e x 1) y  y  2x
How to solve differential equations
The following methods will be mentioned subsequently
Separation of variables – applicable to homogeneous first order
ODEs and to specific types of inhomogeneous first order ODEs.
Characteristic equation – applicable to homogeneous first order and
higher order linear ODEs with constant coefficients
Integrating factor – applicable to inhomogeneous first order and
higher order linear ODEs. This method usually completes the solution
of previous two methods for inhomogeneous equations.
First order inhomogenous linear differential equation
with constant coefficients – separation of variables
dy
y '  f ( x) where y ' 
dx
dy
dy  f ( x)dx
 f (x) 
y ( x)  ?
The most simple
differential equation:
dx
Integrating the last equation
Example:
y'  2 x 
y   f ( x)dx  C
y   2 x dx  C  x 2  C
Where x2+C is general solution of the differential equation
Sometimes an additional condition is given like
y(2)  3
that means the function y(x) must pass through a point
3  2  C  C  1 
2
We have obtained a particular solution
y ( x)  x 2  1
y(x)=x2 -1
x0  [2, 3]
First order homogenous linear differential equation
with constant coefficients – separation of variables
The general formula for such equation is
dy
a  by  0
dx

dy
b
 y
dx
a
ay'by  0
y ( x)  ?
dy
b
  dx
y
a

Now we integrate both sides of the equation and then we apply an
exponential function to it
b
ln y   x  C 
a
substituting
C e
e
C
ln y
e
b
(  x C )
a
C
ye e
we obtain general solution
Where C is a constant resulting from the initial condition
b
 x
a
y  Ce
b
x
a
First order homogenous linear differential equation
with constant coefficients – characteristic equation
The general formula for such equation is
ay'by  0
y ( x)  ?
To solve this equation we assume the
solution in the form of exponential
function.
y  e x
y  Ce x
If
ye
x
y'   e
then
and the equation changes into
or
x
a e x  be x  0
e x (a  b)  0
after dividing by the
the solution is
eλx
we obtain
y  Ce
b
x
a
a  b 0
b
  
a
This is the characteristic equation
Where C is a constant resulting from the initial condition
Example of the first order linear ODE – RC circuit
Find the time dependence of the electric current i(t) in the given circuit.
1
idt.

C
Now we take the first derivative of the last
equation with respect to time
di 1
di
1
0R  i


i0
dt C
dt RC
u  uR  uC
u  Ri 
characteristic equation is

1
0
RC
 
1
RC
Constant K can be calculated from
initial conditions. We know that
0

u
u
u
RC
i(0) 

 Ke
 K
R
R
R
general solution is
i  Ke
1

t
RC
1
particular solution is
u  RC t
i e
R
Solution of the RC circuit in the Mathematica
Given values are R=1 kΩ; C=100 μF; u=10 V
First order inhomogenous linear differential equation
with constant coefficients – integrating factor
The general formula for such equation is
y ' Py  Q
Where P(x) and Q(x) are continuous functions of variable x.
In the first step we omit the right side taking Q(x)=0 and than we can
solve the homogeneous equation by separation of variables.
Separation of variables gives us:
ln y    Pdx  ln C 
dy
 Py  0 
dx
dy
  Pdx
y
y  Ce   Pdx
Having solution of homogeneous part of the equation we can
continue by looking for the integrating factor. Instead of constant C
we are looking for a function C(x), which satisfies both
homogeneous solution and the original differential equation.
y  C ( x)e  Pdx
If C(x) should be a function, then
y  C( x)e  Pdx  C( x) Pe  Pdx
Substituting for y and y’ into the original equation
we obtain
y  Py Q
C( x)e  Pdx  C( x) Pe  Pdx  PC( x)e  Pdx  Q
and after small adjustment:
C( x)e  Pdx  Q
Our integrating factor is:
C ( x)   Q e  Pdx dx  K
The general solution of this
inhomogeneous equation is:
ye
  Pdx
( K   Qe
 Pdx
dx )
Example of the integrating factor solution – LR circuit
Find the time dependence of the electric current i(t) in the given circuit.
U  uR  uL
U  Ri  L
di
dt
Firstly we have to solve homogeneous
equation
L
di
 Ri  0
dt

LR 0
Solution of charact. equation
R

L
In the second step we are
looking for the integrating factor K1 (t )
 i(t )  K1e
so i  K1 (t )e
R
First derivative of the current
R
 t
L
R
 t
L
R
 t
 t
di
R

L
 K1 (t )e  K1 (t ) (t )e L
dt
L
Substituting for i and di/dt into the original equation gives us

L( K1 (t )e

LK1 (t ) e
R
 t
L
R
 t
L
R
R
 t
 t
R
L
 K1 (t ) (t )e )  RK1 (t )e L  U
L
U
R
R
General solution
R
U Lt

 K1 (t )  e
L
U Lt
 K1 (t )  e  K 2
R
R
 t
U Lt
i  ( e  K 2 )e L
R
R
 t
U
i   K 2e L
R
Knowing that initial current is zero i(0)=0, we can determine K2.
U
0   K 2e0
R
U
 K2  
R
R
Particular solution of the equation
 t
U
i  (1  e L )
R
Solution of the RC circuit in the Mathematica
Given values are R=1 kΩ; L=100 mH; U=10 V
Second order homogenous linear differential equation
with constant coefficients
The general formula for such equation is
To solve this equation we assume the
solution in the form of exponential function:
If
y  e x
then
y'   e
and the equation will change into
x
ay' 'by'cy  0
ye
x
y' '  2 e x
and
a2 e x  b e x  ce x  0
x
e (a  b  c)  0
after dividing by the eλx we obtain
We obtained a quadratic
characteristic equation.
The roots are
y ( x)  ?
2
a 2  b  c 0
 b  b 2  4ac
12 
2a
There exist three types of solutions
according to the discriminant D
D b 2  4ac
1) If D>0, the roots λ1, λ2 are
real and distinct
y  C1e1x  C2e2 x
2) If D=0, the roots are real
and identical λ12 =λ
y  C1ex  C2 xex
3) If D<0, the roots are complex
conjugate λ1, λ2 where α and ω
are real and imaginary parts of
the root
1    i
 2    i
y  K1e1x  K2e2 x  K1e xi x  K2e xi x
 ix
x
i x
i x
e
 cosx  i sin x
y  e ( K1e  K2e )
Eulers form ula
x
y e [(K1  K2 ) cosx  i( K1  K2 ) sin x]
If we substitute
we obtain
C1  ( K1  K2 ); C2  i(K1  K2 )
y( x)  ex [C1 cosx  C2 sin x]
This is general solution in some cases, but …
Further substitution
is sometimes used
C1  Asin ; C2  A cos
and then
y( x)  e x [ A sin  cosx  A cos sin x]
considering formula
sin(   )  sin  cos   cos sin 
we finally obtain
y( x) e x A sin(x   )
where amplitude A and phase φ are constants which can be
obtained from initial conditions and ω is angular frequency.
This example leads to an oscillatory motion.
Example of the second order LDE – a simple harmonic oscillator
Evaluate the displacement x(t) of a
body of mass m on a horizontal
spring with spring constant k.
There are no passive resistances.
If the body is displaced from its equilibrium position (x=0), it
experiences a restoring force F, proportional to the
displacement x:
From the second Newtons
law of motion we know
m x  kx

x 
F  k x
d 2x
F  m a  m 2  m x
dt
k
x0
m
We have two complex conjugate
roots with no real part
Characteristic
equation is
12  i
k
m
k
  0
m
2
The general solution for our symbols is
x(t )  e t A sin(t   )
No real part of λ means α=0, and omega in our case
The final general solution of this example is
k

m
x(t )  A sin(t   )
Answer: the body performs simple harmonic motion with amplitude A
and phase φ. We need two initial conditions for determination of
these constants.
x (0)  0 x(0)  2

From the first
A cos( 0   )  0  cos   0   
condition
2

From the second A sin( 0  )  2  A  2
2
condition

The particular
x(t )  2 cos( t )
x (t )  2 sin( t  )
2
solution is
These conditions can be for example
Example 2 of the second order LDE – a damped harmonic oscillator
The basic theory is the same like in
case of the simple harmonic
oscillator, but this time we take into
account also damping.
The damping is represented by the frictional
force Ff, which is proportional to the velocity v.
The total force acting on the body is
F  m a  m x
x 
c
k
x  x  0
m
m
x  2 x   2 x  0
F f  c v   c
dx
 cx
dt
F  kx  Ff  kx  c x
mx  kx  cx  mx  cx  kx  0
The following substitutions
are commonly used
Characteristic
equation is
k
c

; 2 
m
m
2  2   2  0
2
2

2


4


4

2
2
Solution of the characteristic  







12
equation
2
where δ is damping constant and ω is angular frequency
There are three basic solutions according to the δ and ω.
1) δ>ω. Overdamped oscillator. The roots
are real and distinct
x(t )  C1e1t  C2e2t
2) δ=ω. Critical damping. The roots are real
and identical.
1     2   2
2     2   2
12    
x(t )  C1e t  C2te t
3) δ<ω. Underdamped oscillator. The roots
are complex conjugate.
x(t )  Ae t sin(' t   )
1    i  2   2    i '
2    i  2   2    i '
Damped harmonic oscillator in the Mathematica
Damping constant δ=1 [s-1], angular frequency ω=10 [s-1]
Damped harmonic oscillator in the Mathematica
All three basic solutions together for ω=10 s-1
Overdamped oscillator, δ=20 s-1
Critically damped oscillator, δ=10 s-1
Underdamped oscillator, δ=1 s-1
Download