Complex and Repeated Roots
The characteristic equation does not always have two distinct real roots. Complex roots produce oscillations, and a double root needs a second solution of a new shape. Both cases are essential: they describe undamped and underdamped springs and critically damped systems.
Complex roots
If , the roots are with and . The complex solutions are fine, but we want real ones. Euler's formula gives
The real and imaginary parts are themselves solutions (the equation has real coefficients), so
- is the angular frequency of the oscillation.
- decides the envelope: decay if , growth if , pure oscillation if .
Example. : , so .
import numpy as np
import sympy as sp
print("roots:", np.roots([1, 2, 5]))
x = sp.symbols("x")
y = sp.Function("y")
print(sp.dsolve(y(x).diff(x, 2) + 2 * y(x).diff(x) + 5 * y(x), ics={y(0): 1, y(x).diff(x).subs(x, 0): 0}))roots: [-1.+2.j -1.-2.j]
Eq(y(x), (sin(2*x)/2 + cos(2*x))*exp(-x))
Amplitude and phase
A combination is a single shifted cosine:
Use atan2(c2, c1) to get in the right quadrant.
import math
c1, c2 = 3.0, -4.0
R, delta = math.hypot(c1, c2), math.atan2(c2, c1)
print(f"R = {R}, delta = {delta:.4f} rad")
for x in (0.0, 0.7, 2.0):
print(f"x = {x}: {c1*math.cos(2*x) + c2*math.sin(2*x):.6f} = {R*math.cos(2*x - delta):.6f}")R = 5.0, delta = -0.9273 rad
x = 0.0: 3.000000 = 3.000000
x = 0.7: -3.431897 = -3.431897
x = 2.0: 1.066279 = 1.066279
Repeated roots
If , there is one root and only one exponential solution . A second, independent solution is
which you can find by reduction of order or by letting two distinct roots merge: . So the general solution is .
Example. : , .
import sympy as sp
x = sp.symbols("x")
y = sp.Function("y")
ode = y(x).diff(x, 2) + 6 * y(x).diff(x) + 9 * y(x)
print(sp.dsolve(ode))
print("x e^{-3x} is a solution:", sp.simplify(ode.subs(y(x), x * sp.exp(-3 * x)).doit()) == 0)Eq(y(x), (C1 + C2*x)*exp(-3*x))
x e^{-3x} is a solution: True
In software
- Damped oscillations appear in every spring-based UI animation: the "bounciness" setting chooses , the "damping" chooses . A critically damped spring (repeated root) reaches its target fastest without overshoot, which is why smoothing helpers in game engines aim for it.
- Digital oscillators in synthesizers and in signal processing generate with a two-term recurrence whose characteristic roots lie on the unit circle.
Exercises
Exercise 1: Pure oscillation
Solve , , . What is the period?
Answer
, period .
Solution
, . and . The period is .
Exercise 2: Repeated root
Solve , , .
Answer
.
Solution
, . ; , so and .
Exercise 3: Decay envelope (code)
For , find and . After how long has the envelope shrunk to 1 %?
Answer
, ; after .
Solution
. at .
import numpy as np
print(np.roots([1, 0.4, 4.04]), round(np.log(100) / 0.2, 2))[-0.2+2.j -0.2-2.j] 23.03
Test yourself
The roots give the general solution…
For a double root , the second solution is…
has amplitude…
- 3
- 4
- 5
- 7