# 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] == \[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:= 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:= DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. During evaluation of In:= DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. Out= {} 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. Answer
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. Answer
Posted 5 months ago
 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:= eqn1[g_, R_, t_] = D[\[Phi][t], {t, 2}] + g/R*Sin[\[Phi][t]] == 0; In:= ic = List[\[Phi] == 1, \[Phi]'[t] == 0 /. {t -> 0}]; In:= sol1[g_, R_, \[Alpha]_, \[Gamma]_, t_] = DSolve[{eqn1[g, R, t], ic}, \[Phi][t], t] During evaluation of In:= 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:= DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. During evaluation of In:= DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. Out= {} As do these IC's: In:= eqn1[g_, R_, t_] = D[\[Phi][t], {t, 2}] + g/R*Sin[\[Phi][t]] == 0; In:= ic = List[\[Phi] == \[Pi]/16, \[Phi]'[t] == 0 /. {t -> 0}]; In:= sol1[g_, R_, \[Alpha]_, \[Gamma]_, t_] = DSolve[{eqn1[g, R, t], ic}, \[Phi][t], t] During evaluation of In:= 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:= DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. During evaluation of In:= DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. Out= {} However, some IC values do work: In:= eqn1[g_, R_, t_] = D[\[Phi][t], {t, 2}] + g/R*Sin[\[Phi][t]] == 0; In:= ic = List[\[Phi] == \[Pi]/10, \[Phi]'[t] == 0 /. {t -> 0}]; In:= sol1[g_, R_, \[Alpha]_, \[Gamma]_, t_] = DSolve[{eqn1[g, R, t], ic}, \[Phi][t], t] Out= {{\[Phi][t] -> 2 JacobiAmplitude[ 1/4 (-((Sqrt[2 (4 - Sqrt[2 (5 + Sqrt)])] Sqrt[g] t)/Sqrt[ R]) + 1/2 Sqrt[ 4 - Sqrt[ 2 (5 + Sqrt)]] (12 Sqrt[4 - Sqrt[2 (5 + Sqrt)]] EllipticF[\[Pi]/20, 8/(4 - Sqrt[2 (5 + Sqrt)])] + 4 Sqrt[5 (4 - Sqrt[2 (5 + Sqrt)])] EllipticF[\[Pi]/20, 8/(4 - Sqrt[2 (5 + Sqrt)])] + 3 Sqrt[2 (5 + Sqrt) (4 - Sqrt[2 (5 + Sqrt)])] EllipticF[\[Pi]/20, 8/(4 - Sqrt[2 (5 + Sqrt)])] + Sqrt[10 (5 + Sqrt) (4 - Sqrt[2 (5 + Sqrt)])] EllipticF[\[Pi]/20, 8/(4 - Sqrt[2 (5 + Sqrt)])])), 8/( 4 - Sqrt[2 (5 + Sqrt)])]}} As does pi/2: In:= eqn1[g_, R_, t_] = D[\[Phi][t], {t, 2}] + g/R*Sin[\[Phi][t]] == 0; In:= ic = List[\[Phi] == \[Pi]/2, \[Phi]'[t] == 0 /. {t -> 0}]; In:= sol1[g_, R_, \[Alpha]_, \[Gamma]_, t_] = DSolve[{eqn1[g, R, t], ic}, \[Phi][t], t] Out= {{\[Phi][t] -> 2 JacobiAmplitude[ 1/2 (-((Sqrt 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? Answer
Posted 5 months ago
 "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] == \[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] == \[Pi]/2, \[Phi]'[t] == 0 /. {t -> 0}]; DSolve[{eqn1[g, R, t], ic}, \[Phi][t], t] ` Answer