### Differential equations

```Physics for informatics
Lecture 2
Differential equations
Ing. Jaroslav Jíra, CSc.
Differential equations
The most simple
differential equation:
y'  f ( x)
dx
y(x)
Solution of such equation is
y
y' 2x

y'
where
We are looking for the function
Example:
dy

f ( x ) dx  C
y  x C
2
Where x2+C is general solution of the differential equation
y (2)  3
Sometimes an additional condition is given like
that means the function y(x) must pass through a point
3 2 C
2

C  1

We have obtained a particular solution
y( x)  x  1
2
y(x)=x2 -1
x 0  [ 2 , 3]
First order homogenous linear differential equation
with constant coefficients
The general formula for such equation is
ay ' by  0
To solve this equation we assume the
solution in the form of exponential
function.
ye
If
ye
x
y'   e
then
and the equation will change into
after dividing by the
we obtain
b
the solution is
y  Ce
x
x
a e
e
eλx
y( x)  ?
x
x
 be
x
0
(a   b)  0
a  b 0

 
b
a
aλ+b is the characteristic equation
x
a
Where C is a constant resulting from the initial condition
Example of the first order LDE – RC circuit
Find the time dependence of the electric current i(t) in the given circuit.
u  u R  uC
u  Ri 
1
C
 i dt .
Now we take the first derivative of the right
equation with respect to time
0 R
di
1

dt

i
C
di

dt

0

RC
 
i0
RC
characteristic equation is
1
1
1
RC
Constant K can be calculated from
initial conditions. We know that
i(0) 
u
R

u
 Ke

0
RC
 K 
R
R
general solution is
i  Ke

1
RC
t
particular solution is
u
i
u
R

e
1
RC
t
Solution of the RC circuit in the Mathematica
Given values are R=1 kΩ; C=100 μF; u=10 V
Second order homogenous linear differential equation
with constant coefficients
ay ' ' by ' cy  0
The general formula for such equation is
ye
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
a e
2
e
after dividing by the eλx we obtain
characteristic equation.
The roots are
x
x
x
y''  e
2
and
 b e
x
x
 ce
x
(a   b  c )  0
2
a   b  c  0
2
12 
y( x)  ?
b
b  4 ac
2
2a
0
There exist three solutions
according to the discriminant D
D  b  4 ac
1) If D>0, the roots λ1, λ2 are
real and different
y  C 1e
1 x
 C 2e
2) If D=0, the roots are real
and identical λ12 =λ
y  C 1e
x
 C 2 xe
3) If D<0, the roots are complex
conjugate λ1, λ2 where α and ω
are real and imaginary parts of
the root
1    i 
y  K 1e
y e
x
1 x
 K 2e
( K 1e
i x
2 x
 K 2e
 K 1e
 i x
)
2
x
 2    i
 x  i x
e
 K 2e
 i x
 x  i x
 cos  x  i sin  x
Eulers formula
x
2 x
y  e [( K 1  K 2 ) cos  x  i ( K 1  K 2 ) sin  x ]
If we substitute
we obtain
C 1  ( K 1  K 2 );
C 2  i( K1  K 2 )
x
y ( x )  e [ C 1 cos  x  C 2 sin  x ]
This is the solution in some cases, but …
Further substitution
is sometimes used
C 1  A sin  ;
and then
y ( x )  e [ A sin  cos  x  A cos  sin  x ]
considering formula
sin(    )  sin  cos   cos  sin 
we finally obtain
y ( x) e
C 2  A cos 
x
x
A sin(  x   )
where amplitude A and phase φ are constants which can be
obtained from the 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:
F  k x
2
From the second Newtons
law of motion we know
m x   kx

x 
k
F  ma  m
x0
m
We have two complex conjugate
roots with no real part
d x
dt
2
 m x
Characteristic
equation is
 12   i
k
m
 
2
k
m
0
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
 
k
m
The final general solution of this example is
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
These conditions can be for example
From the first
condition
From the second
condition
The particular
solution is
 A cos( 0   )  0
A sin( 0 


cos   0
x (0)  2

 

2
)2

A2
2
x ( t )  2 sin(  t 

2
)
x ( t )  2 cos(  t )
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  ma  m x
x 
c
m
x 
k
x0
m
x  2 x   2 x  0
F f  cv  c
  c x
dt
F   kx  F f   kx  c x
m x   kx  c x

m x  c x  kx  0
k
The following substitutions
 
are commonly used
Characteristic
equation is
dx
; 2 
m
  2    0
2
2
c
m
Solution of the characteristic  
12
equation
 2 
4
2
 4
2
  
 
2
2
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 different
x ( t )  C 1e
1 t
 C 2e
2t
1    
 
2
 2   
 
2
1     i   
2
   i '
 2    i   
2
   i '
2
2
2) δ=ω. Critical damping. The roots are real      
12
and identical.
x ( t )  C 1e
t
 C 2 te
t
3) δ<ω. Underdamped oscillator. The roots
are complex conjugate.
x ( t )  Ae
 t
sin(  ' t   )
2
2
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
```