Second-order differential equations and damping
About this lesson
A charged capacitor, a resistor and an inductor in one loop give an equation with a second derivative in it. Follow one circuit from Kirchhoff's voltage law to v″ + 2α·v′ + ω₀²·v = 0, solve it with the guess v = e^(st), and watch the two roots of the characteristic equation decide whether the voltage rings, falls fast or creeps.
A charged capacitor lets go
A 1 µF capacitor is charged to 10 V. At time t = 0 the switch closes, and charge flows round the loop through a 56 Ω resistor and a 10 mH inductor. We want v(t), the capacitor voltage, from then on.
>>> L, R, C, V0 = 0.01, 56, 1e-6, 10 >>> round(C * V0, 9) # charge on the capacitor, coulombs 1e-05 >>> round(0.5 * C * V0**2, 9) # energy it stores, joules 5e-05
Read the lesson step by step
A charged capacitor lets go
A 1 µF capacitor is charged to 10 V. At time t = 0 the switch closes, and charge flows round the loop through a 56 Ω resistor and a 10 mH inductor. We want v(t), the capacitor voltage, from then on.
>>> L, R, C, V0 = 0.01, 56, 1e-6, 10 >>> round(C * V0, 9) # charge on the capacitor, coulombs 1e-05 >>> round(0.5 * C * V0**2, 9) # energy it stores, joules 5e-05Add up the loop voltages
Kirchhoff's voltage law: voltages round a loop add to zero. The inductor's voltage is L·i′, where i′ means how fast the current i changes. The resistor's is R·i and the capacitor's is v. So L·i′ + R·i + v = 0.
>>> L, R, v, i = 0.01, 56, 10, 0 # the state at t = 0 >>> -(R * i + v) / L # i′ from the law, amps per second -1000.0One equation, second order
Since i = C·v′, we get i′ = C·v″, where v″ (the second derivative) is how fast v′ changes. Divide by LC: v″ + 2α·v′ + ω₀²·v = 0, with α = R/2L = 2800 and ω₀ = 1/√(LC) = 10 000 per second.
>>> L, R, C = 0.01, 56, 1e-6 >>> R / (2 * L) # alpha, per second 2800.0 >>> 1 / (L * C) ** 0.5 # omega0, radians per second 10000.0Guess v = e^(st)
Try v = e^(st). Each derivative just multiplies it by s: v′ = s·v and v″ = s²·v. Every term now shares e^(st), which is never zero, so divide it out. What is left is the characteristic equation: s² + 2α·s + ω₀² = 0.
>>> import math >>> s, t, h = -5000, 2e-4, 1e-9 >>> v = math.exp(s * t) # e^(st) is never 0 >>> v 0.36787944117144233 >>> round((math.exp(s * (t + h)) - v) / h / v) # slope ÷ value = s -5000Two roots, here complex
The quadratic formula gives s = −α ± √(α² − ω₀²). Here α² is less than ω₀², so the square root is of a negative number: s = −2800 ± j9600 per second, where j = √−1. Each root is a point on the s-plane.
>>> import cmath >>> a, w0 = 2800, 10000 >>> cmath.sqrt(a*a - w0*w0) 9600j >>> s = -a + 9600j >>> s*s + 2*a*s + w0*w0 # put the root back in 0jComplex roots ring
Complex roots give v = e^(−αt)·(10·cos 9600t + 2.92·sin 9600t). The real part, −α, shrinks each swing. The imaginary part, 9600, sets how fast it rings. Energy sloshes between capacitor and inductor, and the resistor turns a little into heat each swing.
>>> import math >>> a, wd = 2800, 9600 >>> v = lambda t: math.exp(-a*t) * (10*math.cos(wd*t) + 10*a/wd*math.sin(wd*t)) >>> v(0) 10.0 >>> round(v(math.pi / wd), 2) # first dip, t = 0.33 ms -4.0The damping ratio ζ
Compare α with ω₀. The damping ratio ζ = α/ω₀ is 0.28 here. Below 1 the roots are complex and the circuit rings: underdamped. At exactly 1 the two roots meet. Above 1 they are two real numbers: overdamped.
>>> L, C = 0.01, 1e-6 >>> for R in (56, 200, 250): ... print(R, R / 2 * (C / L) ** 0.5) # zeta = alpha / omega0 ... 56 0.28 200 1.0 250 1.25Critical damping: ζ = 1
Raise R to 200 Ω: now α = ω₀, so ζ = 1. The roots slide round a circle and meet at −10 000, a double root. Then v = 10·(1 + 10 000t)·e^(−10 000t): the fastest return to zero without dipping below it.
>>> import math >>> v = lambda t: 10 * (1 + 10000*t) * math.exp(-10000*t) >>> round(v(2e-4), 3), round(v(5e-4), 3) # at 0.2 ms and 0.5 ms (4.06, 0.404)Overdamped: ζ above 1
At 250 Ω, ζ = 1.25. The roots split along the real line to −5000 and −20 000. Then v = 13.3·e^(−5000t) − 3.3·e^(−20 000t). It never rings, but the slow −5000 part makes it creep: at 0.5 ms it is still 1.1 V.
>>> import math >>> v = lambda t: 40/3*math.exp(-5000*t) - 10/3*math.exp(-20000*t) >>> v(0) 10.0 >>> round(v(5e-4), 3) # at 0.5 ms 1.094The roots in Python
Python's cmath module takes square roots of negative numbers and writes j for √−1. With R back at 56 Ω, the card prints (-2800+9600j) (-2800-9600j): the same two roots, in radians per second.
>>> import cmath >>> L, R, C = 0.01, 56, 1e-6 >>> a = R / (2 * L) >>> w0 = 1 / (L * C) ** 0.5 >>> d = cmath.sqrt(a*a - w0*w0) >>> print(-a + d, -a - d) (-2800+9600j) (-2800-9600j)
5 quick questions
Choose one answer per question. You can change your choices before checking them.
01Why is v″ + 2α·v′ + ω₀²·v = 0 called a second-order equation?
The order of a differential equation is its highest derivative. Here that is v″, so it is second order, and its general solution has two free constants, set by v(0) and v′(0).
02A circuit has α = 6000 and ω₀ = 10 000 per second. What are the roots of s² + 2α·s + ω₀² = 0?
s = −α ± √(α² − ω₀²) = −6000 ± √(36 000 000 − 100 000 000) = −6000 ± √(−64 000 000) = −6000 ± j8000. In Python, -6000 + cmath.sqrt(6000**2 - 10000**2) gives (-6000+8000j).
03With L = 10 mH and C = 1 µF, ζ = (R/2)·√(C/L) = R/200. What happens with R = 100 Ω?
100 / 200 = 0.5. Any ζ below 1 gives complex roots, so the response rings while it decays.
04Which damping brings the capacitor voltage back to zero fastest without ever going below zero?
Critical damping has a double root at −ω₀. More damping leaves one slow real root, so the voltage creeps; less damping makes it overshoot and ring. With no resistor it would ring for ever.
05What does Python print for cmath.sqrt(-4)?
cmath works with complex numbers, so the square root of −4 is 2j (j = √−1). math.sqrt(-4) is the one that raises ValueError.
Glossary
- Second-order differential equation
- An equation whose highest derivative is the second, such as v″ + 2α·v′ + ω₀²·v = 0. Its solution needs two starting values, here v(0) and v′(0).
- Characteristic equation
- The ordinary quadratic s² + 2α·s + ω₀² = 0 you get by trying v = e^(st). Its roots decide the shape of the solution.
- Natural frequency ω₀
- 1/√(LC) for an RLC loop, in radians per second: the rate it would ring at with no resistance. Here 10 000 rad/s.
- Damping ratio ζ
- α/ω₀, how strongly the resistance damps the ringing. Below 1 underdamped, exactly 1 critically damped, above 1 overdamped.
- Underdamped
- ζ < 1: complex roots −α ± jω_d, so the response is a decaying sine wave that overshoots zero.
- Critically damped
- ζ = 1: one double root −ω₀; the fastest return to zero without overshoot.
- Overdamped
- ζ > 1: two different real roots; the response never rings but creeps back slowly.
- j
- The engineers' name for √−1 (i is taken by current). Python writes complex numbers the same way, as in 9600j.
Notes and sources
- Engineers write j for √−1 because i already means current; Python uses j too (9600j). A complex root −2800 + j9600 has a real part, −2800, and an imaginary part, 9600.
- The numbers 10 and 2.92 come from the start: v(0) = 10 V, and i(0) = 0 (an inductor's current cannot jump), so v′(0) = 0. That gives A = 10 and B = α·A/9600 = 28 000/9600 ≈ 2.92.
- Why sines appear: by Euler's formula, e^((−α + jω)t) = e^(−αt)·(cos ωt + j·sin ωt). Adding the two complex-root solutions cancels the imaginary parts and leaves real cosines and sines.
- The ringing rate 9600 rad/s is 9600 ÷ 2π ≈ 1528 Hz, so one full swing takes about 0.65 ms.
- The same equation describes a mass on a spring with friction, m·x″ + b·x′ + k·x = 0: the inductance acts like mass, the resistance like friction, and 1/C like the spring's stiffness.
- MIT OCW 18.03SC Differential Equations, Unit II: Second Order Constant Coefficient Linear Equations
- MIT OCW 18.03SC: Damped Harmonic Oscillators
- MIT OCW 6.002 Circuits and Electronics (second-order RLC circuits)
- Paul's Online Notes: Complex Roots
- Paul's Online Notes: Repeated Roots
- Python library: cmath, mathematical functions for complex numbers
- Python reference: Imaginary literals
Quiz Unlocks after the last step.