Last edited 26apr02 by
Find this document at
Download the executable for illiWire in zip format here.

illiWire: A simulation dealing with the origins of magnetic fields as a consequence of special relativity.


illiWire is a simulation of a physical system that is designed to present the origins of the magnetic field as a consequence of special relativity. In illiWire, a single loop of wire with electrons flowing through it is viewed by two observers with different rest frames. One observer is moving with the wire, and thus views it as stationary (this is the view on the right side of the screen). The other observer views the loop as moving to the left (this is the view on the left). IlliWire investigates how the two systems differ and how they are reconciled with the addition of the magnetic field.

About illiWire

In the "stationary" loop, the electrons are instantaneously accelerated to a constant speed, thus creating a steady current in the loop. The "moving" loop, however, is not such a trivial system. Because it has a velocity with respect to the observer, the observer sees a time dilation along the axis of the loop's motion, with magnitude ((delta x) * V)/(C*C), where (delta x) is the rest displacement along the direction of the loop's motion, v is the velocity with which the loop moves with respect to the observer, and C is the speed of light, 3x10^8 m/s (this can be changed by the user of the program). Thus the electrons at the back of the loop (if the convention is that the front of the loop leads in the direction of motion) start moving around the loop first, while the electrons at the front start moving much later. This creates a bunching of electrons along the top of the loop initially.

Thus the situation now is that two observers see two different things in the loops. The stationary loop has no net electric field inside the loop and equal spacing between electrons. The moving loop, however, has a net electric field inside, and moving bunches of electrons. In this demonstration, a positive test particle is introduced into the system. Thus in the moving loop, the positive particle is attracted to the clusters of negative charge due to relativistic time dilation. In the stationary loop however, no such cluster of charge exists, so no attraction takes place. This creates a dilemma, however. Do two different events occur, based on an observer's velocity? What if, for instance, the electron leaves a tiny dent where it strikes the loop? Will the dent be in two different places depending on whether the observer was moving or not? This is very unlikely, as it would certainly strain, if not break, the existing laws of physics. Instead, a different force acts in the stationary frame, namely, magnetism. Because the particle has no initial velocity in the moving frame, it has initial velocity equal and opposite to the moving loop's velocity. The magnetic field, creates a force, B x V, in the exact same direction and magnitude as the electric field in the moving frame. Thus the observers see the same thing happening, but for different reasons.

Some of the complications in the system are due to relativistic velocity additions. Imagine if someone traveling at .9C threw a snowball at .2C. Would the snowball travel faster than the speed of light if seen by an outside observer? It would not, as velocities add strangely at high speeds. In this system, the velocity of the particles is described by (U+V)/(1+(U*V)/(C*C)) where U is the velocity of the particles in the system (but only in the x and -x directions), V is the velocity of the loop, and again, C is the constant speed of light traveling through a vacuum.

Even though the loop on the left is moving, the particles in it, when traveling along the negative y axis as viewed from the loop's starting position, have the same speed as all particles moving in the stationary frame. If one was moving with the electrons around each loop, one would view time as going faster than either observer in this situation see it, but since each observer views the same thing, this time dilation is ignored, as it will not affect anything visually or mathematically. Only if another observer whose rest frame was an electron moving around the loop was introduced would this play a part.

Image of illiWire simulation

Physics 212 class for more information on the physics behind illiWire.

Some of the menu keys for this RTICA are as follows:
For all of these, the upper case of the same letter reverses the changes
Also, except for L, these changes reset the electrons to their original positions

L: starts movement of the electrons in both wire loops
C: changes the speed of light in the simulation
A: changes the angular velocity of the electrons
N: changes the number of electrons flowing through the loop

Implementation: I used an array of angles to represent the positions of the electrons in this simulation in order to eliminate some divide by zero errors and simplify the process of updating points. First, I initialize the points (electrons) around the loop by dividing the total radians in the loop by the number of electrons, and increasing the angle of each electron by this increment. UpDatePoints is then called, which simply multiplies the stationary loops' electrons by a constant speed, and calculates the angular velocity of the particles in the moving loop using the formulas given in the "About illiWire" section of this document. However, some conversions to x and y coordinates are necessary in order to determine the components of the particles' velocity that are in the same direction as the loop. After this angular velocity is updated, the electrons in the moving loop are updated, and then the test particle's experienced force is calculated. This is done by adding up all the x and y components of force from each electron, which gives a total force in the x and y directions. Once this force is obtained, the test particle's acceleration in x and y directions is calculated, then it's velocity, then it's position, according to the basic differential equation a = v' = position''. The particle's position is then updated, completing the updatePoints function. What was formerly 'binoc' in the original skel had to be replaced, as a dual view would always be needed. So two drawall functions were created: one for the moving loop and one for the stationary loop. Thus each skel could be calculated, and displayed separately. Other feature that were added were the moving stars in the background behind the moving loop, thus giving the impression that it's moving. Sadly, the velocity of the starts is only calculated insomuch that they slow to a stop when the velocity of the loop is changed to 0, and reverses when the velocity changes signs. I also made whichever side of the loop is closest to the viewer transparent, so that the electrons can be seen easily.

Most of the difficulty in creating illiWire revolved around the complexity of the system. The velocity addition formula tends to "take over," becoming the dominant effect if starting values for the system are not chosen carefully. For a very long time, I could get no noticeable time dilation. I was forced to pick ridiculous values for some variables, like the size of the loop (currently over 1kilometer) and the loop's speed (starts at .8C). This does not mean the time dilation is of no consequence, just that it is very hard to see. Either way, it still results in a magnetic field, but for visual purposes, I have chosen my somewhat unrealistic values.

There are some improvements that could be made to illiWire as it stands. One glaring error is that when the skel is turned, the electrons should change their behavior, as many would no longer be moving along the loops direction of motion. Thus right now, the turning of the skel is only useful for getting a better view of the system. Also, the velocity of the stars could be changed to be an actual value, and move as such, rather than just an arbitrary speed that happens to correspond to loopVelocity = 0.

The system has limitations as well. It does not behave very well at high speeds, as the time interval needs to be smaller for the system to hold accuracy. Also, the velocity addition formulas are not very accurate when the velocity of the particles in the loop becomes close to the speed of light. The formula right now is only expanded to the second power (see Physics 212 website in bibliography for more detail). This is fine for the situation I'm modeling, but not for stranger, faster systems.

Download Site for .exe files and requisite OpenGL files