My input is

DSolve[{s''[t] == g Sin[θ], s[0] == 0, 
  s'[t]^2 == 2 g l Cos[θ]}, s[t], t]

I will get a pop-up

DSolve::overdet: There are fewer dependent variables than equations, so the system is overdetermined.

*After searching the internet, I find the only way to solve this is setting g,l,θ numeric values and use DSolveValue, but I want a symbolic function without C[1], C[2].

A pic to illustrate this idea. enter image description here

I wan to get the output like this

 s[t] -> 1/2 (g t^2 Sin[θ] + 2 t (Sqrt[2] Sqrt[g] Sqrt[l] Sqrt[Cos[θ]] - g t Sin[θ]))
  • $\begingroup$ Second IC should maybe be something like this. s'[0] == Sqrt[2 g l Cos[\[Theta]]] $\endgroup$ Commented Mar 30, 2020 at 14:11
  • $\begingroup$ @DanielLichtblau, I believe s'[0]==0. $\endgroup$
    – kile
    Commented Mar 31, 2020 at 1:04
  • $\begingroup$ @DanielLichtblau the starting point is \[Theta]=Pi/2 $\endgroup$
    – kile
    Commented Mar 31, 2020 at 1:09
  • $\begingroup$ Point being, you cannot specify both s'[t]' and s''[t]` unless they are compatible. As written in the post, they are not, and moreover it is short by one initial condition. $\endgroup$ Commented Mar 31, 2020 at 14:53

3 Answers 3


The basic problem of this formulation is another differential equation added instead of appropriate initial conditions, namely we shoud have a condition for e.g. s'[0] instead of equation for s'[t]. Moreover, it is not quite clear whether we deal with a projectile motion or with a mathematical pendulum. Next, it appears in the both cases there are wrong signs of the force terms

At this point we should decide what is our dependent variable θ or s. If we prescribe well posed initial conditions it works well (here θ is constant in case of the projectile problem):

 s[t] /.  DSolve[{s''[t] == -g Sin[θ], s[0] == 0, 
                          s'[0]^2 == 2 g l Cos[θ]}, s[t], t] // Simplify
{ -Sqrt[2] Sqrt[g] Sqrt[l] t Sqrt[Cos[θ]] +  1/2 g t^2 Sin[θ],
     Sqrt[2] Sqrt[g] Sqrt[l] t Sqrt[Cos[θ]] +  1/2 g t^2 Sin[θ]}

also assuming an appropriate initlal condition in case of a pendulum

θ[t] /. First @ DSolve[{θ''[t] == - g/l Sin[θ[t]], θ[0] == 0, θ'[0] == Sqrt[2 En]}, 
                         θ[t], t]
2 JacobiAmplitude[(Sqrt[En] t)/Sqrt[2], ((2 g)/(En l))]

En is an integration constant chosen as an equivalent of the total energy of the pendulum, $E_n=\frac{E}{m\; l^2}$. I should have added this constant in such a form since otherwise DSolve refuses to solve this problem.
The result is in terms of a special elliptic function, this can be reformulated in terms of e.g. JacobiSN etc:

Through @ { Sin, Cos, Tan, Cot, Csc, Sec} @ JacobiAmplitude[u, m]
{ JacobiSN[u, m], JacobiCN[u, m], JacobiSC[u, m], 
  JacobiCS[u, m], JacobiNS[u, m], JacobiNC[u, m]}    

This is an exact solution of the pendulum problem, without assumption of the small amplitude. When small amplitudes are considered then trigonometric functions appear to be good approximations of solutions. For comparison we evaluate

θ[t] /. DSolve[{ θ''[t] == - g/l θ[t], θ[0] == 0, θ'[0] == Sqrt[2 En]}, 
                 θ[t], t]
 {(Sqrt[2] Sqrt[En] Sqrt[l] Sin[(Sqrt[g] t)/Sqrt[l]])/Sqrt[g]}

Taking arbitrary constants of motion we demonstrate the dfifference between exact solution and its approximation by linearizing the differential equation.

With[{En = 8, g = 10, l = 1}, 
  Plot[{ Sin[2 JacobiAmplitude[(Sqrt[En] t)/Sqrt[2], (2 g)/(En l)]],
         (Sqrt[2] Sqrt[En] Sqrt[l] Sin[(Sqrt[g] t)/Sqrt[l]])/Sqrt[g]},
    {t, 0, 6}, PlotStyle -> Thick, WorkingPrecision -> 10, PlotLegends -> "Expressions"]]

enter image description here

The difference is significant for large amplitudes, while taking e.g. En = 2 solutions are very close. Finding the amplitudes in the both cases is left for the reader.

  • $\begingroup$ What is En? Cause I can find any info in the Wolfram document. $\endgroup$
    – kile
    Commented Mar 30, 2020 at 12:44
  • $\begingroup$ I explained this in my answer. En == Eng/( m l^2) , where Eng is a total Energy and m is the mass of the pendulum. $\endgroup$
    – Artes
    Commented Mar 30, 2020 at 13:32
  • $\begingroup$ Why does DSolve refuse to solve this problem if you don't have added this constant? What's wrong with DSolve? $\endgroup$
    – kile
    Commented Apr 2, 2020 at 13:59
  • $\begingroup$ @kile Not exactly with DSolve but with its interaction with elliptic functions. There are various aspects to improve. This is a long story, see e.g. this answer and references therein. Stictly speaking there are things which should be updated in next versions of the system. $\endgroup$
    – Artes
    Commented Apr 2, 2020 at 14:07
  • $\begingroup$ Why is θ'[0] == Sqrt[2 En]? why not θ'[t] == Sqrt[2 En]? $\endgroup$
    – kile
    Commented Apr 2, 2020 at 14:12

Your concept is evidently not adequate. Mathematica contains curated data. That includes knowledge about the physical pendulum. You need to enter

control + = to enter an entity. Then type pendulum. It is the property equations of motion You are looking for. The complete solution is available to, just enter pendulum into Wolfram Alpa built-in or on the web.Curated data physical systems

DSolve[{g Sin[s[t]]/l + s''[t] == 0, s[0] == 0, s'[0] == vmax}, s, t]

Output is

{{s -> Function[{t}, 
    2 JacobiAmplitude[(t vmax)/2, (4 g)/(l vmax^2)]]}}

vmax = 2 g l Cos[\[Theta]]}.

Your additional condition is fulfilled too:

s'[t]=D[2 JacobiAmplitude[(t vmax)/2, (4 g)/(l vmax^2)],x]=vmax JacobiDN[(t vmax)/2, (4 g)/(l vmax^2)]

Corresponding the Mathematica definition of JacobiDN:

JacobiDN(u,m)=Sqrt[1-m sin^2(\[Phi])]

m=(4 g)/(l vmax^2) in this case. \[Phi])=JacobiAmplitude[u, m].

More details for the pendulum is given in the documentation of JacobiAmplitude in the section for Applications. There are more properties of the solution of the pendulum in the curated data for physical systems pendulum. This curated data is new in 12.

1/2 (g t^2 Sin[\[Theta]] + 
   2 t (Sqrt[2] Sqrt[g] Sqrt[l] Sqrt[Cos[\[Theta]]] - 
      g t Sin[\[Theta]]))

is a solution to the harmonic oscillator in form of a pendulum. This is the approximation of the full problem for small angles. Then is it the angle the approximation of the Sin sine.

DSolve[{s''[t] == -g/l s[t], s[0] == 0, s'[0] == Sqrt[2 En]}, s[t], t]

keep in mind that m=1 in this case especially in the equation for s'. The solution in general is

{{s[t] -> (Sqrt[2] Sqrt[En] Sqrt[l] Sin[(Sqrt[g] t)/Sqrt[l]])/Sqrt[

En = s'[t]^2/2 ==  g l Cos[\[Theta]]

for convinience.


s[t] -> 1/
  2 (g t^2 Sin[\[Theta]] + 
    2 t (Sqrt[2] Sqrt[g] Sqrt[l] Sqrt[Cos[\[Theta]]] - 
       g t Sin[\[Theta]]))

s'[0]=Sqrt[2] Sqrt[g] Sqrt[l] Sqrt[Cos[\[Theta]]]
s''[t]=-g Sin[\[Theta]]

in your solution.

In the free oscillation or small angle solution of mine:

s'[0]=Sqrt[2] Sqrt[g] Sqrt[l] Sqrt[Cos[\[Theta]]]
s'[t]=Sqrt[2] Sqrt[En] Cos[(Sqrt[g] t)/Sqrt[l]]
s''[t]=-((Sqrt[2] Sqrt[En] Sqrt[g] Sin[(Sqrt[g] t)/Sqrt[l]])/Sqrt[l]


as required.

  • 1
    $\begingroup$ What does vmax mean? the maximum velocity? $\endgroup$
    – kile
    Commented Apr 2, 2020 at 14:05

The initial condition for s' does not depend on t. Write s'[0]^2 ==... You get two solutions you expected..

{s1[g_, l_, \[Theta]_], s2[g_, l_, \[Theta]_]} = 
   s /. DSolve[{s''[t] == g Sin[\[Theta]], s[0] == 0, 
s'[0]^2 == 2 g l Cos[\[Theta]]}, s, t]

(*   {Function[{t}, 
        1/2 (-2 Sqrt[2] Sqrt[g] Sqrt[l] t Sqrt[Cos[\[Theta]]] + 
 g t^2 Sin[\[Theta]])], 
       1/2 (2 Sqrt[2] Sqrt[g] Sqrt[l] t Sqrt[Cos[\[Theta]]] + 
 g t^2 Sin[\[Theta]])]}   *)

Plot[{s1[1, 1, 1][t], s2[1, 1, 1][t]}, {t, 0, 7}, 
   PlotStyle -> {Blue, Green}]

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.