Bead on a Wire
This animation shows how to compute the position Vs time of a bead under the force of gravity on a rigid wire.
The wire can have two shapes, y(x): either a straight line basis or a parabolic curve basis. Super-imposed
on these bases are sinusoidal curves of amplitude that is variable by the learner.
The speed of the bead at the start is zero but its potential energy is maximum.
The calculation is done using the equation
d2s/dt2=-dV/ds where s is the length along the wire and V is the gravity potential.
It is interesting to note that the vaule of
s(t) never has to be computed. The value of dx can be computed by the equation
dx=ds/(ds/dx). Also the value of dV/ds is easily computed as dV/ds=dV/dx/(ds/dx).
As is well known, the value of ds/dx=sqrt(1+(dy/dx)^2).
To obtain the value of ds for a given iteration, it is necessary to doubly integrate
the acceleration as = d2s/dt2, first to obtain the speed, vs=ds/dt, and then to obtain ds. To perform
the double integration, 4th order Runge Kutta integration
Numerical Integration of Equations of Motion
is used (see Animate.js code).
To show that the calculation is accurate, the gain in kinetic energy, KE, is compared to the
loss of potential energy, PE, i.e.(gained KE+lost PE)=0.
This animation illustrates the Euler-LaGrange equation
Bead on a Wire to solve
a mechanics problem with rigid constraints like the wire. In the Lagrange method, more general coordinates like s in this example rather than Cartesian
coordinates like x and y are used. The Lagrange method avoids the need to find the
complicated x and y forces that the wire has to exert on the bead. It simply relies on
conservation of kinetic+potential energy and the path to the solution is much simpler.
Using the Lagrange method, without too much additional calculation,
we could have computed the path of the bead on a wire that is deforming as a function of time so that y=h(x,t).
That would add a non-conservative potential. Since y(x) for this particular problem is fairly simple it
could probably have been solved by direct integration but the numerical methods used here are applicable to any y(x)so this
is a much more general way to solve practical problems.
As always, the learner is welcome to press F12 in Windows to examine the source code.