# Trying to solve the differential equation for the damped, driven pendulum

sol =
NDSolve[
{ω'[t] == (-1/q) ω[t] - Sin[θ[t]] + g Cos[φ[t]],
θ'[t] == ω[t], φ'[t] == τ }, θ, {t, 0, 2*Pi}]


I am getting this error:

The number of constraints is not equal to the total differential order of the system plus the number of discrete variables.

If anyone can guide me on how to fix this that would be amazing.

• (1) The constraints that NDSolve is asking for are the initial conditions. (2) NDSolve will also want numerical values for $q$, $g$ and $\tau$. Oct 16 '20 at 22:51

Here is an example:

damp is the damping factor, w0 the undamp angular frequency that we set arbitrarily to 1 and x[0] the start position and x'[0] the start velocity:

eq = {x''[t] + 2 damp w0 x'[t] + w0^2 x[t] == 0, x[0] == 1,
x'[0] == 0};
sol[t_] = x[t] /. DSolve[eq, x, t][[1]] /. {w0 -> 1}
funs[t_] = Table[sol[t], {damp, 0, 1.5, 0.3}]
Plot[Evaluate[funs[t]], {t, 0, 15}, PlotRange -> All]


Solutions for damp<1 are called "underdamped", for damp==1 "critical damped" and for damp>1 "overdamped". Note that for the "critical damped case", you will need to take the limit of the solution because of the term: 1/(2 (-1 + damp^2)). You can do this e.g. by:

Limit[sol[t], damp -> 1]
(*E^-t (1 + t)*)