# How to simulate pendulum movement with high amplitude

I need to make a C# simulator for a simple pendulum. I have been searching the web for 3 days and I am stuck.

The problem is I have found many equations that would give the angle position as a function of time, which is perfect for my needs for making a visual simulation but the problem is those functions only works for angles smaller than 10, but I should be able to simulate from any angle. Example of a equation that only works for small angles: And the equations that should work for any angle (Amplitude) are too complicated as it involves differential equations, and derivatives. I don't know how to implement these in C#. Example of a equation that I think would work but I don't know how to use: the problem of this last equation is the "sn" that is Jacobi elliptic function sn(u;m) u, and I don't know how to use in C#

Can someone help? maybe with another equation that I could use programmatically, or helping me understand how I could use this last one if it would really works.

• The point of simulation isn't to simply apply a closed form solution (what you are trying to do), but to allow you to do without this elusive beast and work from the easily found equation of motion. Convert the EoM (a differential equation) to an appropriately chosen difference equation approximation and go to town. – dmckee Apr 24 '15 at 2:11
• khanacademy.org/computer-programming/forphys/6505289796943872 the "degrees" function turns radians into degrees, (multiplication by 180/Pi) which the trig functions need. no further explanation needed – user12029 Apr 24 '15 at 2:18
• @NeuroFuzzy I'd probably also suggest that the OP look up something like the Runge-Kutta, backward Euler, as that one simply uses Euler. Clearly from the simulation on the Khan academy page it seems to give reasonable results, but in general it can lead to problems. Carlos, I suggest you should read en.wikipedia.org/wiki/Euler_method , especially en.wikipedia.org/wiki/Euler_method#Modifications_and_extensions as well as NeuroFuzzy's link. – WetSavannaAnimal Apr 24 '15 at 3:36
• Without friction you additionally know that it is periodic, so half period simulation is sufficient, avoiding error accumulation for large times. – mikuszefski Apr 24 '15 at 12:04
• Just be careful with Runge-Kutta as it breaks ergodicity. For mechanical problems a symplectic scheme like Leap-Frog is favorable. – Martin Ueding Jul 10 '16 at 11:08