Lorentz transformations map the coordinates of the same event between inertial frames moving relative to one another. They do not move the event or change the physics; they change the coordinate record used to describe it. Unlike a Galilean update, changing frames mixes position and time.
{ position, time } record in metres and seconds. A boost is a pure function that returns a new record. Test it two ways: the spacetime interval must match before and after a boost, and applying the opposite boost must reconstruct the original event within floating-point tolerance.For a frame moving at +v along the x axis,
The invariant interval for two events is
\[s^2=c^2(\Delta t)^2-(\Delta x)^2\]function lorentzBoost({ position, time }: Event, speed: number): Event {
const gamma = lorentzFactor(speed);
return {
position: gamma * (position - speed * time),
time: gamma * (time - (speed * position) / SPEED_OF_LIGHT ** 2),
};
}
For example, take an event at x = 3c m and t = 5 s, then boost at 0.6c. The coordinates change, but the interval from the origin remains the same. A test that only checks one transformed coordinate can miss a sign error; an interval test plus a forward-and-reverse round trip checks the whole contract.
Prediction: A boost can change the order of spatially separated events, but it cannot change a timelike interval into a spacelike one.
Write two event records and calculate their interval. Apply a0.6c boost, then an opposite boost. Predict which values must return exactly in the mathematical model and which will return only within floating-point tolerance in code.Treat a Lorentz transform as a reversible coordinate mapping with interval and round-trip tests. Keep its units and sign convention visible; then the code makes relativity's change of simultaneity concrete without pretending the coordinates are physical objects.
Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.
\[\text{observable output} = f(\text{inputs},\,\text{state})\]For Lorentz Transformations, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Relativity, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.
Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.
This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.
Treat Lorentz Transformations as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.
Implement Lorentz coordinate mappings with inverse and spacetime-interval regression tests.