Wednesday, October 21, 2015

Double Pendulum in Processing

I'm taking a class called Introduction to Interactive Media this semester. The second half of the semester concentrates mostly on making cool stuff in Processing. As much as I like Python, it has a few shortcomings. Making animations is one. I thought it would be cool to take some of code I used for solving differential equations (in Python) and plug it into Processing to see what happens. My first experiment involves animating the double pendulum. From this animation, I think it's pretty clear that I messed up the math somewhere, as it has some rather weird behavior. Check it out:




I'll have to re solve the equations of motion of this system to be sure that I have it right. Otherwise, I think part of the issue might be the method I'm using to solve the system of differential equations. I haven't (yet) incorporated a linear algebra package into my Processing code, so I'm stuck using forward Euler method. Alternatively, I think I could use another explicit method that allows for better stability, like Runge-Kutta. Another thing I'd like to do is to make the speed at which the animation plays independent of the step sized used in my solver.

I see Processing as a really cool tool for Physics visualizations. Stay tuned; I plan on doing a few more of these simple animations over my Fall break. 

No comments:

Post a Comment