# Pendulum differential equation not computing using DSolve in Mathematica?

Posted 5 months ago
733 Views
|
3 Replies
|
0 Total Likes
|
 Just playing around with features of DSolve in Mathematica and came across a differential equation that DSolve is not able to handle for some reason. Hoping that someone knows why or a workaround for it. Defined the pendulum differential equation: eqn1[g_, R_, t_] = D[\[Phi][t], {t, 2}] + g/R*Sin[ \[Phi][t] ] == 0; Defined parametric initial conditions: ic[\[Alpha]_, \[Gamma]_] = List[ \[Phi][0] == \[Alpha], \[Phi]'[t] == \[Gamma] /. { t -> 0 } ]; Defined solution: sol1[g_, R_, \[Alpha]_, \[Gamma]_, t_] = DSolve[ { eqn1[g, R, t], ic[\[Alpha], \[Gamma]] }, \[Phi][t], t ] For some reason, DSolve cannot handle this differential equation (while it is a deceivingly difficult differential equation, it pops up quite commonly in many different physical systems). The error output when running the solution is: During evaluation of In[3]:= Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. During evaluation of In[3]:= DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. During evaluation of In[3]:= DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. Out[3]= {} Has anyone else encountered this with DSolve? Exact solutions to the pendulum differential equation do exist, and initial conditions have been specified to clarify constants in the solution for DSolve. It is unclear to me why this schema is not working to obtain a Mathematica function solution for the pendulum problem.
3 Replies
Sort By:
Posted 5 months ago
 I suspect the underlying issue is that DSolve cannot solve for the constants using the initial conditions. There is a parametrized solution when no ICs are given.
 I had that thought as well, so I tried using numerical values for the initial conditions as well and found the same error. However, it only occurs for certain numerical values used. For example, the following IC's return the same error message. In[1]:= eqn1[g_, R_, t_] = D[\[Phi][t], {t, 2}] + g/R*Sin[\[Phi][t]] == 0; In[2]:= ic = List[\[Phi][0] == 1, \[Phi]'[t] == 0 /. {t -> 0}]; In[3]:= sol1[g_, R_, \[Alpha]_, \[Gamma]_, t_] = DSolve[{eqn1[g, R, t], ic}, \[Phi][t], t] During evaluation of In[3]:= Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. During evaluation of In[3]:= DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. During evaluation of In[3]:= DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. Out[3]= {} As do these IC's: In[1]:= eqn1[g_, R_, t_] = D[\[Phi][t], {t, 2}] + g/R*Sin[\[Phi][t]] == 0; In[8]:= ic = List[\[Phi][0] == \[Pi]/16, \[Phi]'[t] == 0 /. {t -> 0}]; In[9]:= sol1[g_, R_, \[Alpha]_, \[Gamma]_, t_] = DSolve[{eqn1[g, R, t], ic}, \[Phi][t], t] During evaluation of In[9]:= Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. During evaluation of In[9]:= DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. During evaluation of In[9]:= DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. Out[9]= {} However, some IC values do work: In[1]:= eqn1[g_, R_, t_] = D[\[Phi][t], {t, 2}] + g/R*Sin[\[Phi][t]] == 0; In[14]:= ic = List[\[Phi][0] == \[Pi]/10, \[Phi]'[t] == 0 /. {t -> 0}]; In[15]:= sol1[g_, R_, \[Alpha]_, \[Gamma]_, t_] = DSolve[{eqn1[g, R, t], ic}, \[Phi][t], t] Out[15]= {{\[Phi][t] -> 2 JacobiAmplitude[ 1/4 (-((Sqrt[2 (4 - Sqrt[2 (5 + Sqrt[5])])] Sqrt[g] t)/Sqrt[ R]) + 1/2 Sqrt[ 4 - Sqrt[ 2 (5 + Sqrt[5])]] (12 Sqrt[4 - Sqrt[2 (5 + Sqrt[5])]] EllipticF[\[Pi]/20, 8/(4 - Sqrt[2 (5 + Sqrt[5])])] + 4 Sqrt[5 (4 - Sqrt[2 (5 + Sqrt[5])])] EllipticF[\[Pi]/20, 8/(4 - Sqrt[2 (5 + Sqrt[5])])] + 3 Sqrt[2 (5 + Sqrt[5]) (4 - Sqrt[2 (5 + Sqrt[5])])] EllipticF[\[Pi]/20, 8/(4 - Sqrt[2 (5 + Sqrt[5])])] + Sqrt[10 (5 + Sqrt[5]) (4 - Sqrt[2 (5 + Sqrt[5])])] EllipticF[\[Pi]/20, 8/(4 - Sqrt[2 (5 + Sqrt[5])])])), 8/( 4 - Sqrt[2 (5 + Sqrt[5])])]}} As does pi/2: In[1]:= eqn1[g_, R_, t_] = D[\[Phi][t], {t, 2}] + g/R*Sin[\[Phi][t]] == 0; In[25]:= ic = List[\[Phi][0] == \[Pi]/2, \[Phi]'[t] == 0 /. {t -> 0}]; In[26]:= sol1[g_, R_, \[Alpha]_, \[Gamma]_, t_] = DSolve[{eqn1[g, R, t], ic}, \[Phi][t], t] Out[26]= {{\[Phi][t] -> 2 JacobiAmplitude[ 1/2 (-((Sqrt[2] Sqrt[g] t)/Sqrt[R]) + 2 EllipticF[\[Pi]/4, 2]), 2]}} Having tried multiple IC values, more values seem to yield error messages than not. This does not surprise me for the derivative initial condition, as I don't think a full analytical solution exists for non-zero values of that, but the initial angle should be able to have any value of 0 to 2*pi and yield a solution, no?
 "DSolve is not able to handle for some reason", because you have a Transcendental equation.For general parameters DSolve can't do, because Math can't do.Try:  eqn1[g_, R_, t_] = D[\[Phi][t], {t, 2}] + g/R*Sin[\[Phi][t]] == 0; ic[\[Alpha]_, \[Gamma]_] = List[ \[Phi][0] == \[Alpha], \[Phi]'[t] == \[Gamma] /. { t -> 0 }]; InternalInheritedBlock[{Solve}, Unprotect[Solve]; Solve[x___] := Block[{$guard = True}, Print["Solve called : ", HoldForm[Solve[x]]]; Solve[x]] /; ! TrueQ[$guard]; DSolve[{eqn1[g, R, t], ic[\[Alpha], \[Gamma]]}, \[Phi][t], t]]; last line:  (*Solve[{-\[Alpha]-2 JacobiAmplitude[(Sqrt[2 g+R Subscript[\[ConstantC], 1]] Subscript[\[ConstantC], 2])/(2 Sqrt[R]),(4 g)/(2 g+R Subscript[\[ConstantC], 1])]==0,(-Sqrt[R] \[Gamma]-Sqrt[2 g+R Subscript[\[ConstantC], 1]] JacobiDN[(Sqrt[2 g+R Subscript[\[ConstantC], 1]] Subscript[\[ConstantC], 2])/(2 Sqrt[R]),(4 g)/(2 g+R Subscript[\[ConstantC], 1])])/Sqrt[R]==0},{Subscript[\[ConstantC], 1],Subscript[\[ConstantC], 2]},VerifySolutions->True]*) With initial angles:  eqn1[g_, R_, t_] = D[\[Phi][t], {t, 2}] + g/R*Sin[\[Phi][t]] == 0; ic = List[\[Phi][0] == \[Pi]/2, \[Phi]'[t] == 0 /. {t -> 0}]; DSolve[{eqn1[g, R, t], ic}, \[Phi][t], t] `