Ordinary Differential Equations
Ordinary Differential Equations
Ordinary Differential Equations
Examples
f ′ (x) = 4
f ′ (x) + f (x) = 2
f ′′ (x) + 2f ′ (x) − f (x) = sin x
air resistance
Position Speed
kv(t) Newton's laws
x(0) = 0 v(0) = 0
mv ′ (t) = mg − kv(t)
or
speed k
v ′ (t) + v(t) = g
v(t) m
v(0) = 0
t=0 R i(t)
Circuit laws
vR (t) + vC (t) = 5
5V C vR (t) = R i(t)
i(t) = CvC′ (t)
′ 1
i (t) + i(t) = 0
RC
i(0) =?
t=0 R i(t)
Circuit laws
vR (t) + vC (t) = 5 sin wt
5 sin wt V + C
− vR (t) = Ri(t)
i(t) = CvC′ (t)
1 5w
i′ (t) + i(t) = cos wt
RC R
i(0) = 0
Properties
Rate of increase of N is proportional to N
N ′ (t) ∝ rN (t)
However, population cannot grow forever
Capacity K : maximum sustainable population ′ N (t)
N (t) ∝ 1 −
K
N : small → N (t) grows fast
N : close to K → N (t) grows slower N (t)
N (t) = rN (t) (1 −
′
)
N = K : growth rate is zero K
N > K : growth rate is negative
Population is the solution
to a differential equation
First-order linear ODE
General f ′ (x) + P (x)f (x) = Q(x)
form
f (x): to be solved
P (x), Q(x): given
Example
f ′ (x) = Q(x)
f ′ (x) = sin ω0 t
Solution
f (x) = AQ (x) + c Solution
1
where AQ (x): antiderivative of Q(x) f (x) = (− cos ω0 t) + c
ω0
Constant case: P (x) = p, a constant
′ k k
v (t) + v(t) = g p = , Q(t) = g
m m
mg
v(t) = (1 − e−kt/m )
k
Falling object with air resistance: Plot of solution
mg mg
v(t) = (1 − e−t/(m/k) ) v∞ = Time constant: m/k
k k
mg v∞
k 0.98v∞
0.95v∞
v∞ (1−e−2 )=0.86v∞
v∞ (1−e−1 )=0.63v∞
t
m/k 2m/k 3m/k 4m/k 5m/k
Examples: RC circuit with DC source
1 1
i′ (t) + i(t) = 0 p= , Q(t) = 0
t=0 RC RC
R i(t)
ept Q(t) = 0
5V C
Aept Q (t) = 0
5 −t/RC
i(t) = e
R
RC circuit with DC source: Plot of solution
5 −t/RC
i(t) = e i∞ = 0 Time constant: RC
R
5
R
i0 e−1 =0.37i0
i0 e−2 =0.13i0
0.05i0 0.02i0 i∞
RC 2RC 3RC 4RC 5RC t
Examples: RC circuit with AC source
′ 1 5ω
i (t) + i(t) = cos ωt
t=0 R i(t) RC R
1 5ω
p= , Q(t) = cos ωt
RC R
5 sin ωt V + C
−
5ω t/RC
ept Q(t) = e cos ωt
R
( sin ωt)
ept p ω p
= cos ωt + sin ϕ =
p2 + ω 2 p2 + ω 2 p2 + ω 2 p2 + ω 2
ω
ept cos ϕ =
= (sin ϕ cos ωt + cos ϕ sin ωt) p2 + ω 2
p2 + ω 2
ept p
= sin(ωt + ϕ) tan ϕ =
ω
p2 + ω2
Examples: RC circuit with AC source (contd)
1 5ω 5ω et/RC
′
i (t) + i(t) = cos ωt Aept Q (t) = sin(ωt + ϕ)
R 2
(1/RC) + ω 2
RC R
1 5ω 1
p=
RC
, Q(t) =
R
cos ωt Impedance: Z = R + 1
iωC
tan ϕ =
ωRC
5ω t/RC 5et/RC
e Q(t) =
pt
e cos ωt Aept Q (t) = sin(ωt + ϕ)
R ∣Z∣
5
i(t) = (sin(ωt + ϕ) − sin ϕ e−t/RC )
∣Z∣
RC circuit with AC source: Plot of solution
5 5
i(t) = (sin(ωt + ϕ) − sin ϕ e−t/RC ) i∞ (t) = sin(ωt+ϕ)
∣Z∣ ∣Z∣
i∞ (t)
RC 2RC 3RC
5
sin ϕe−t/RC
∣Z∣
i(t)
Second-order linear ODEs
Constant coefficients
Example: RLC circuit
Second-order ODE
Linear with constant coefficients
Second-order linear ODEs with constant coefficients
Guess works if
a(esx )′′ + b(esx )′ + cesx = (as2 + bs + c)esx = 0
Since esx
= 0, we require
Solve quadratic
as2 + bs + c = 0 equation to find s
Homogeneous case: Distinct real roots
af ′′ (x) + bf ′ (x) + cf (x) = 0
Guess: f (x) = esx
Roots of as2 + bs + c = 0: s1 , s2 , real, s1
= s2
How to find c1 , c2 ?
Initial conditions: suppose f (x0 ) and f ′ (x0 ) are known
Find c1 , c2 to satisfy initial conditions
Example
Solve f ′′ (x) − 6f ′ (x) + 8f (x) = 0 with f (0) = f ′ (0) = 1.
Solve
General solution
s2 − 6s + 8 = 0
f (x) = c1 e2x + c2 e4x
to get s = 2, 4.
f (0) = c1 + c2 = 1
f ′ (0) = 2c1 + 4c2 = 1
Solution: es1 x
Property
For real repeated roots, xes1 x is another solution.
How to find c1 , c2 ?
Initial conditions: suppose f (x0 ) and f ′ (x0 ) are known
Find c1 , c2 to satisfy initial conditions
Example
Solve f ′′ (x) − 6f ′ (x) + 9f (x) = 0 with f (0) = f ′ (0) = 1.
Solve
General solution
s2 − 6s + 9 = 0
f (x) = c1 e3x + c2 xe3x
to get s = 3, 3.
f (0) = c1 = 1
f ′ (0) = 3c1 + c2 = 1
Solving, c1 = 1, c2 = −2
Solutions: erx eitx = erx cos tx + ierx sin tx and erx e−itx = erx cos tx − ierx sin tx
How to find c1 , c2 ?
Initial conditions: suppose f (x0 ) and f ′ (x0 ) are known
Find c1 , c2 to satisfy initial conditions
Example
Solve f ′′ (x) − 5f ′ (x) + 8f (x) = 0 with f (0) = f ′ (0) = 1.
Solve
General solution
s2 − 5s + 8 = 0
5 ± 7i f (x) = e5x/2 (c1 cos( 7x/2) + c2 sin( 7x/2))
to get s =
2
f (0) = c1 = 1
f ′ (0) = (5/2)c1 + ( 7/2)c2 = 1
Solving, c1 = 1, c2 = −3/ 7
Property
Suppose g(x) is a solution of af ′′ (x) + bf ′ (x) + cf (x) = Q(x)
and
h(x) is a solution of af ′′ (x) + bf ′ (x) + cf (x) = 0,
then
g(x) + h(x) is a solution of af ′′ (x) + bf ′ (x) + cf (x) = Q(x).
Example Example
f ′′ (x) + 2f ′ (x) + 5f (x) = sin x
f ′′ (x) + 2f ′ (x) + 5f (x) = 4
(−r sin x − s cos x) + 2(r cos x − s sin x) +
f (x) = e: 5e = 4 or e = 4/5
5(r sin x + s cos x) = sin x
f (x) = 4/5
4r − 2s = 1, 2r + 4s = 0
i′′ (t) + 2αi′ (t) + ω02 i(t) = 0 Overdamped: α > ω0 (two real roots)
R 2 1
α= , ω0 =
2L LC
Critical: α = ω0 (repeated real roots)
Initial conditions
Vdc
′
i(0) = 0, i (0) = Underdamped: α < ω0 (complex conjugate roots)
L
DC RLC series circuit: Solutions
ωd = ∣ω02 − α2 ∣ ζ=0.4 α
i(t) ζ=
ω0
ζ=0.6
Overdamped α > ω0
−αt ωd t −ωd t 0.8 Over: ζ > 1
i(t) = A e (e −e )
1 Critical: ζ = 1
Under: ζ < 1
1.5
Critically damped α = ω0
i(t) = B t e−αt 2
3
Underdamped α < ω0 i∞ =0
i(t) = Ce−αt sin ωd t t
Particular solution
+
a sin ωt − C i∞ (t) = p sin ωt + q cos ωt
(ω02 − ω 2 )p = 2αωq
′′ ′
i (t) + 2αi (t) + ω02 i(t)
= (aω/L) cos wt (ω02 − ω 2 )q + 2αωp = aω/L
R 2 1 1
α= , ω =
2L 0 LC Steady state Z = R + iωL +
a iωC
Initial conditions i∞ (t) = sin(ωt − ϕ) ω 2 − ω02
∣Z∣ tan ϕ =
2αω
i(0) = 0, i′ (0) = 0