Troubleshooting Mathematica Pendulum Equation: Finding Solutions with NDSolve

In summary, there seems to be an issue with the solver running into limits and not being able to find a solution for the equation of motion for a pendulum. By reducing the accuracy and precision demands, it is possible to get a solution, but it may not be accurate. Using the ListPlot function, it may be possible to get a better understanding of the solutions and use options in NDSolve to control the solver and get the desired solution. Further experimentation and consultation with the help system may be necessary to find a successful solution.
  • #1
DannyS
3
0
I am trying to input the equation of motion for a pendulum:
θ1'' = −g (2 m1 + m2) sin θ1 − m2 g sin(θ1 − 2 θ2) − 2 sin(θ1 − θ2) m2 (θ2'2 L2 + θ1'2 L1 cos(θ1 − θ2))
L1 (2 m1 + m2 − m2 cos(2 θ1 − 2 θ2))

with θ2 and θ2'2 being the only unknowns but I am not getting the results that are needed. Can someone please check if there are any mistakes in my equation.

NDSolve[{20.64*-Cos[
6.3 t] == ((-9.8*(1.61)*
Sin[.52*Sin [6.3 t]]) - (1.61*9.8*
Sin[Sin [6.3 t] - 2 Theta[t]] - (2*
Sin[Sin [6.3 t] -
Theta[t]])*1.61*((Theta'[t])^2 *0.48 + (3.21*
Cos[6.3 t])^2*.3*Cos[.52*Sin [6.3 t]] -
Theta[t])/(.30 (1.61 -
1.61*Cos[2*.52*Sin [6.3 t] - 2*Theta[t]])))),
Theta[0] == 10000}, Theta[t], {t, 0, 10}]

Thanks!
 
Physics news on Phys.org
  • #2
It appears, at least with the version I am running, that the solver is running into limits on the number of steps to take trying to find a solution before it finishes.

By reducing the accuracy and precision demands greatly it is possible to get it to solve.

In[1]:= s=NDSolve[{20.64*-Cos[6.3 t]==((-9.8*(1.61)*Sin[.52*Sin[6.3 t]])-(1.61*9.8*Sin[Sin[6.3 t]-2 Theta[t]]-(2*Sin[Sin[6.3 t]-Theta[t]])*1.61*((Theta'[t])^2*0.48+(3.21*Cos[6.3 t])^2*.3*Cos[.52*Sin[6.3 t]]-Theta[t])/(.30 (1.61-1.61*Cos[2*.52*Sin[6.3 t]-2*Theta[t]])))),Theta[0]==10000},Theta[t],{t,0,10},
AccuracyGoal->1,PrecisionGoal->1]

Out[1]= {{Theta[t]->InterpolatingFunction[{{0.,10.}},<>][t]},{Theta[t]->InterpolatingFunction[{{0.,10.}},<>][t]}}

This should then show you one of the solutions:

In[2]:= ListPlot[Table[{j,First[First]/.t->j},{j,0,10,.1}]/.->[_,v_]->v]

And this should then show you the other solution.

In[3]:= ListPlot[Table[{j,First[Last]/.t->j},{j,0,10,.1}]/.Rule[_,v_]->v]

If you GENTLY increase the AccuracyGoal and PrecisionGoal you should start to see it produce something more like what the real solutions are, but by the time I get up to 4 I start getting complaints about a complex component being introduced, although the plot does start to look a little bit like a sine wave oscillating around 9993.

I used the ListPlot to look at these because my first few attempts at getting anything sensible to Plot directly from the InterpolatingFunction failed. You can bump down the step size in that ListPlot and see a little more detail.

Take a look at the results from the ListPlot s and see if this is anything like what your real system should be doing. If it is then this may be moving in the direction of getting you something useful. If so then you might look at Options[NDSolve] and use the help system to take a look at what each of those options do. Those will be used, in a way similar to how I used AccuracyGoal, to control the solver and get it to find a way to deliver the solution you desire.
 

Related to Troubleshooting Mathematica Pendulum Equation: Finding Solutions with NDSolve

1. What is the Mathematica Pendulum Equation?

The Mathematica Pendulum Equation, also known as the Pendulum equation of motion, is a mathematical formula used to describe the motion of a pendulum. It takes into account the length of the pendulum, the gravitational acceleration, and the initial conditions of the pendulum to calculate its position over time.

2. How is the Mathematica Pendulum Equation derived?

The Mathematica Pendulum Equation is derived from the Second Law of Motion, which states that the acceleration of an object is directly proportional to the net force acting on it and inversely proportional to its mass. By applying this law to a pendulum, the equation for its motion can be derived.

3. What are the variables in the Mathematica Pendulum Equation?

The variables in the Mathematica Pendulum Equation include the length of the pendulum (l), the gravitational acceleration (g), the initial angle of the pendulum (θ), and the initial angular velocity of the pendulum (ω). These variables determine the motion of the pendulum and can be adjusted to see how they affect its behavior.

4. How is the Mathematica Pendulum Equation used in science?

The Mathematica Pendulum Equation is used in science to study the behavior of pendulums and to make predictions about their motion. It is also used in fields such as engineering and physics to understand the principles of oscillating systems and to design pendulum-based devices.

5. Are there any limitations to the Mathematica Pendulum Equation?

Yes, there are some limitations to the Mathematica Pendulum Equation. It assumes that the pendulum is a simple, idealized system with no friction or air resistance. In reality, pendulums are affected by these factors, which can cause deviations from the predicted motion. Additionally, the equation is only accurate for small-amplitude oscillations.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
419
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
Replies
1
Views
257
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • Introductory Physics Homework Help
Replies
1
Views
3K
Replies
1
Views
325
  • Introductory Physics Homework Help
Replies
20
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
Replies
1
Views
514
  • Introductory Physics Homework Help
Replies
5
Views
2K
Back
Top