Skip to content
DeepForgeby svx
All problems
HardCalculusca-094

Damped Oscillator Value

Problem

The underdamped oscillator x'' + 2*zeta*omega*x' + omega^2*x = 0 with x(0) = x0, x'(0) = v0 has the solution

x(t) = e^(-zeta*omega*t) * (x0*cos(wd*t) + ((v0 + zeta*omega*x0) / wd)*sin(wd*t))

where the damped frequency is wd = omega*sqrt(1 - zeta^2). Assume 0 <= zeta < 1 and omega > 0.

Hint

When zeta = 0 the formula reduces to simple harmonic motion with wd = omega.

Test cases

case 1
in: [0,1,0,0.5,2]
expected: 1
case 2
in: [1.5707963267948966,1,0,0,1]
expected: 0
case 3
in: [0.7853981633974483,0,1,0,2]
expected: 0.5
case 4
in: [1,1,0,0.5,2]
expected: 0.15057436514588768
case 5
in: [0.5,2,1,0.25,4]
expected: 0.004960951560242762
Starter codePython
def damped_value(t, x0, v0, zeta, omega):
    # Your code here
    pass

5 test cases · run your code against them in the editor