sol = 
    {ω'[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.

  • 5
    $\begingroup$ (1) The constraints that NDSolve is asking for are the initial conditions. (2) NDSolve will also want numerical values for $q$, $g$ and $\tau$. $\endgroup$
    – LouisB
    Commented Oct 16, 2020 at 22:51

1 Answer 1


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]

enter image description here

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)*)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.