[home]
Lagrange Applet



The Lagrange Applet simulates finite dimensional mechanical systems. Given expressions for the potential and kinetic energy of such a system, it solves the Lagrangian equation of motion to simulate how the system will behave.

Here, you see a double pendulum with respective masses 2 kg and 3 kg. The lengths of the two legs of the pendulum are 6 m, respectively 4 m. You can click on the inner mass and move it around to influence the motion of the pendulum.

Your browser does not run this applet, for some reason.
Here is what it would look like:

Each type of dynamical system is represented by a Java class. On the following pages, you can try various different types of dynamical systems, and you can also experiment with changing their physical parameters.

  1. Double Pendulum,
  2. Double Spring,
  3. Spring Pendulum.

Go here for a brief explanation of Lagrangian Mechanics, the physical principle on which the simulations are based. You can also find out how to define your own mechanical systems. You can also view the source code of the applet and a description of the applet parameters.

News:

January 26, 2008: Added a new "deterministic" parameter to make the simulation deterministic. This is done by fixing the virtual timestep, rather than basing it on the actual time elapsed.

May 9, 2002: Here is a very fun applet which allows you to interactively contruct life-like mass-and-spring mechanical systems and animate them. Beware, this is addictive! Sodaplay.

May 8, 2002: Mark Napier has written a cool applet which simulates a wave by connecting a large number of masses with springs. You can click on masses and drag them around to stimulate the system. Click here to try it out. See also here for some additional cool animations.

August 23, 2001: Mehrtash Babadi has been working on a "Mechanical Workshop". The Workshop is originally based on my Lagrange applet, but has many new features, for instance, you can interactively put together mechanical systems from springs, and even record the motion and play it back later. There is a 2-dimensional and a 3-dimensional version of Mehrtash's Workshop. Both are available as "jar" files: you can start them by typing something like "java -jar filename.jar".

June 3, 2001: Following a suggestion by Peter Lynch, I modified the applet to use a fourth-order Runge Kutta method for solving the differential equation. This improves the naive Euler method used before, giving a more faithful simulation, as well as better (though not perfect) preservation of energy. Also added applet parameters that allow forced energy preservation to be turned on/off, and/or the total energy of the system to be displayed. For an example, check out the Spring Pendulum.

June 3, 2001: Fixed a bug in the MechSystem.solve() method pointed out by Mehrtash Babadi.

March 23, 2001: Peter Lynch has used the Lagrange Applet to display the motion of a three-dimensional Swinging Spring. He also modified the applet to use the Runge Kutta method, a better method for the numerical solution of differential equations.

Author

Copyright (C) 1999-2001 Peter Selinger.

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

Click here to see the full GNU public license.


Back to Peter Selinger's Homepage: [home]


Peter Selinger / Department of Mathematics and Statistics / Dalhousie University
selinger@mathstat.dal.ca / PGP key
Updated Jun 3, 2001