Talk:Animate a pendulum: Difference between revisions

:Code correction
(:Code correction)
 
Line 4:
 
:: I'm not very proud of it. I wanted to use [[wp:Simpson's Rule]] for the integration since I knew the differential equation for pendulums from way back, but couldn't get that to work without solving it first. Chicken-and-egg! So solve it once using the guess that the velocity is constant over the time period to get approximate locations for the other points of the integration, and solve it again to get a better estimate of the velocity and, consequently, position. I've tested it and it works well enough for a few minutes of simulation at the initial angle I selected, which is all I think anyone will actually bother with. (I suppose I could do better if I really drilled into the math, but whatever...) —[[User:Dkf|Donal Fellows]] 21:44, 7 August 2009 (UTC)
 
There has been a mistake in the MatLab code (now commented in the code), but occasionally in other languages as well.