Balancing a Double Inverted Pendulum in 2D or 3D
This Demonstration gives an example of control theory. The naturally unstable double inverted pendulum is attached to a movable cart. You can disable the balancing control force and watch the chaotic behavior of the double pendulum, or you can vary the control force to keep the pendulum in balance.
 A. Moylan, "Stabilized Inverted Pendulum," Wolfram Blog—A Wolfram Web Resource. (Jul 31, 2013) blog.wolfram.com/2011/01/19/stabilized-inverted-pendulum.