If you like, just dive in here. It’s a 2 dimensional special relativity simulator. Check the comments on this entry for JSON strings.

Relativity is the idea that the laws of physics are the same in all frames. I don’t have a good way to say what the laws of physics are, so maybe let’s call it a bucket of things we can measure that never change. That’s not circular because measurement is different than theory. Really, relativity is a bit weak of a word in this context; Einstein preferred the word invariance. A bucket of things are invariant, so we need theory to agree with this. Frames are ways to measure position and time. You can define your frame like so: you are at the origin of your frame, to your right is the +x direction, in front of you is the +y direction, and above you is the +z direction, and you measure time with a single clock. I could be in a spaceship and have my own frame. Say I am standing and facing the same way you are; at t=0, I am in the same spot as you; and I travel in your +x direction at some constant speed. If this is the case, our frames are said to be in standard orientation.

Galilean relativity is the type of relativity you use every day, consciously or not. It is summarized by these equations, together called the Galilean transformation:

I’d bet Galileo never thought to mention the last equation. It represents the idea that time is the same everywhere no matter what, which is what you’re assuming by using a single clock to keep track of time. The top three equations represent the idea that velocities add. Let’s say I am moving at 4 meters per second. 3 meters in front of you, 2 seconds after when we are in the same spot, an apple falls from a tree. You measure this event as happening at (x, y, z; t)=(0, 3, 0; 2). You can predict where I’d measure the event to have happened with the Galilean transformation and come up with

This makes sense. I’m traveling at 4 meters per second. 2 seconds after we are at the same spot, I will be 8 meters to your right. So I must think the event happens at the same place as you, except 8 meters to the left. It’s important to note that we already “disagree” on x positions, and no one has ever been baffled by this. We don’t really disagree because we can compensate for each other with the Galilean transformation.

There’s this stuff called light which always goes the same speed no matter what. That speed is called the speed of light. We’ll put the speed of light in the bucket of things that we’re calling the laws of physics. Incidentally, Galileo also tried to measure the speed of light. It’s a good story but not actually relevant and better documented elsewhere. Anyway, let’s say you shoot a laser at the moon. And I’m in a spaceship heading toward the moon at half the speed of light and I’m in the same spot as you when you turn on the laser. Let’s do a Galilean transformation of the situation. You figure the head of the laser beam’s position is given by (x, y, z)=(ct, 0, 0). c is the speed of light; it’s c for constant. Then you figure I’d say the laser beam’s position was given by

Look what you’ve done. You’ve predicted that I will see light going half the speed of light. So maybe the Galilean transformation doesn’t always work. If we start from the speed of light being constant in constant velocity frames and go from there, we get what’s called the Lorentz transformation, which is what’s used in special relativity.

It’s important to note that when v is small compared to c, v/c is about 0 and is about 1. As such, the whole transformation is about the same as the Galilean transformation. This is good, because the Galilean transformation really did seem to work, so anything else that claims to be the correct transformation should mimic it when the circumstances are right.

You might be unhappy about t’ not being equal to t. But it is no different than x’ being different than x. We “disagree”, but we can compensate.

There’s a very nice system of units that makes this a lot easier. I thought they were called SR units, like how SI is for systeme internationale, SR is for systeme relativistique, but I can’t seem to find many references to such a thing. Wikipedia currently calls it just one example of a geometrized unit system. It might also be called relativistic units or natural units. Anyway, you should be good as long as you know what it is, which is this: set c=1, unitless. So speeds are unitless. Time is still in seconds, but this means distances are also in seconds, and one second is the distance light travels in a second. This gets at the symmetry between space and time, like how they’re sometimes together called spacetime. I used this system in the simulator. Another cool thing is that energy is measured in Joules, so

Meters and seconds measure the same thing now, and there are 299792458 meters in a second, so we end up with Joules being kilograms, which measures mass. In other words, energy and mass are equivalent, and proportional. Back in SI units, we’d have

This is only the tip of the iceberg in terms of what special relativity means to mass, energy, and also momentum. But I wont go into detail because it doesn’t really have to do with the simulator.

Two things you might’ve heard of are time dilation and length contraction. Time dilation is when something moving really fast relative to you experiences less passage of time than you do. Length contraction is when something moving really fast relative to you appears shorter to you than it would if it were standing still — shorter in the direction it is moving. I don’t think they are worth discussing except to say that they happen and you will see them in the simulator if you play with it. They aren’t worth discussing because you really have to sanitize a situation to get at either individually. The thing that is happening is the Lorentz transformation, and it causes time dilation and length contraction all over the place. I challenge you to sanitize the situation yourself.

I’d like to explain how I applied the Lorentz transformation in the simulator. First off, all that’s being simulated is a bunch of points that move at constant velocity, and it’s all in 2 spatial dimensions. If we can solve for one point, we can make an entire simulator. The points are created in what I’ll call here the “home frame”, with an initial position and velocity. So let’s represent a point in the home frame like this:

After the user has created a bunch of points in the home frame, they can see how the system evolves over time and that’s great. But the point is also to see what the situation would look like if you were moving. So we want a new frame, which we’ll call “other frame”. The user can specify how fast this frame goes relative to the home frame. The relation between the two frames is a bit less strict than standard orientation. The only difference is that relative velocity is also allowed in the y direction. Let’s represent the velocity with which the other frame travels relative to the home frame with .

Right, well, say we are at time t’ and want to know where some point is. We use a generalized Lorentz transformation. You can think of it as rotating so that the frames are in standard orientation, applying the standard orientation transformation, and rotating back. You can also think of it as splitting a position into one component parallel to the relative velocity of the frames and another component perpendicular to that. The parallel component is transformed like the standard orientation transformation and the perpendicular component is left alone. Also know that I write this transform with c=1, and the standard orientation one above is written with c=299792458 m/s.

We use the second equation to solve for t in terms of t’, plugging in our definition of r.

With this we can get r, which we can Lorentz transform to get r’.

Let’s see what happens with velocities. We seek a form of that has only things we know in it.

And there we have it.

This isn’t the end of the story of relativity, though. We next have to deal with acceleration. General relativity does this. We wont go into general relativity here though.

If you haven’t already, please check out the simulator. This post alone is not meant to explain special relativity. This post exists to help everyone appreciate the simulator. The simulator exists because it is much easier to get a sense of something if you can just play with it. I bet there are lots of great special relativity textbooks, and these are where you should get your explanations of special relativity from. I used one to help me make the simulator. But I didn’t have a sense of special relativity until I played with it. You don’t have to install the simulator, you don’t even have to have Java or Flash — only a modern browser. The special relativity simulators I can find on the net also seem to concern themselves with visual distortions caused by traveling almost as fast as light. Things like this would happen even if the simulation were Galilean, so I feel it only obscures what’s supposed to be presented. This simulator presents the heart of special relativity — the Lorentz transformation. So please, check out the simulator, get a sense of special relativity, and don’t feel like it’s something only someone else understands.

I’d like to add one more thing, just for fun. This happens in multiple movies and shows and it bothers me. Some superpowered person moves faster than the speed of light and goes back in time. Let’s use the standard orientation transformation with c=1 and set x’=0. Then

So we can see as v approaches 1 from 0, t’ becomes less and less compared to t. So if we extrapolate this behavior, t’ must becomes negative when v is greater than 1 right? Wrong! Let’s say the superpowered person goes twice the speed of light.

The time that passes is purely imaginary. Do you know what that means? I don’t know what that means. I think there is talk about imaginary time. I don’t think it means you go back in time.

This is the JSON for a guy carrying a pole running through a barn. It’s interesting because intuitively, you’d say that from the barn’s frame, the pole fits in the barn, but in the pole’s frame, it doesn’t. All this means is “fits in” is a more complicated concept than we think, and it has Galilean assumptions creeping into it.

[[{"points":[{"x":-1.6666666666666667,"y":0.5},{"x":-1.6666666666666667,"y":1.8333333333333333},{"x":2.3333333333333335,"y":1.8333333333333333},{"x":2.3333333333333335,"y":0.5}],"clocks":[false,false,false,false],"velocity":{"x":0,"y":0},"centroid":{"x":0.33333333333333337,"y":1.1666666666666665}},{"points":[{"x":-1.6666666666666667,"y":-0.16666666666666666}],"clocks":[true],"velocity":{"x":0,"y":0},"centroid":{"x":-1.6666666666666667,"y":-0.16666666666666666}},{"points":[{"x":2.3333333333333335,"y":-0.16666666666666666}],"clocks":[true],"velocity":{"x":0,"y":0},"centroid":{"x":2.3333333333333335,"y":-0.16666666666666666}},{"points":[{"x":-1.6666666666666667,"y":-0.8333333333333334},{"x":-1.6666666666666667,"y":-2.1666666666666665},{"x":2.3333333333333335,"y":-2.1666666666666665},{"x":2.3333333333333335,"y":-0.8333333333333334}],"clocks":[false,false,false,false],"velocity":{"x":0,"y":0},"centroid":{"x":0.33333333333333337,"y":-1.5}},{"points":[{"x":-1.6666666666666667,"y":-0.16666666666666666},{"x":0,"y":-0.16666666666666666},{"x":0.16666666666666666,"y":-0.3333333333333333},{"x":0.3333333333333333,"y":-0.16666666666666666},{"x":0.5,"y":0},{"x":0.6666666666666666,"y":-0.16666666666666666},{"x":2.3333333333333335,"y":-0.16666666666666666}],"clocks":[false,false,false,true,false,false,false],"velocity":{"x":0.6666666666666667,"y":0},"centroid":{"x":0.33333333333333337,"y":-0.16666666666666663}}],-3,3]