Simulation code for a standard popular science tourist attraction in chaotic dynamics. more…
If this was a physics exam, the question would be…
Consider a pendulum, consisting of a massless, infinitely rigid rod and a pointlike metal weight placed at the end. The pendulum is suspended over a plane (z = 0) with N (pointlike) magnets placed in regular intervals along the perimeter of a circle. A uniform gravitational field applies, pointing downwards.
Let the weight start from rest at a given point. Consider the set of admissible starting positions as the lower half of the sphere defined by the rod origin (0,0,L) and length of the rod, L. You can take L = 1.
Assume that the pendulum loses energy at a constant rate (due to frictional losses, air resistance…). Thus, the system eventually stops, as time t grows without bound.
Q1) Find the trajectory from a given starting point.
Q2) Find which magnet wins from a given starting point. The “winner” is defined as the magnet that minimizes the distance between the weight and itself in the final stopped state. Plot the winner as a function of a discrete approximation of the set of all admissible starting positions. Present the result as a colour sheet with each pixel representing a starting position.
Technically, the source code of these solvers demonstrates using Python, NumPy, Matplotlib, mpi4py, Cython and the C interface in Cython, while actually running the solvers will make pretty pictures of trajectories and attraction pools.
Cloning this repository:
If you need read and write access use this command:
git clone email@example.com:jjrandom2/magnets_and_pendulum.git magnets_and_pendulum
If you only want to clone (and not push) use this command:
git clone git://yousource.it.jyu.fi/jjrandom2/magnets_and_pendulum.git magnets_and_pendulum
Then you can go to your repository:
Tuesday August 14 2012
Monday June 20 2011
Wednesday June 15 2011