Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Simulating relativity in a velocity verlet algorithm

  1. Jul 18, 2009 #1
    (Skip to the * mark if you would like to see my question without the background)


    I'm trying to write a turn-based computer game which simulates space combat at relativistic speeds, but I'm a beginner at programming and I don't know much physics beyond the high school level. The game consists of spacecraft flying through a 30 lightyear-by-30 lightyear 2-dimensional space roughly reminiscent of the Local Cloud, trying to destroy their opponents while dealing with the lightspeed delay and a realistic simulation of the ship's inertia and the gravity of nearby stars.

    My current inertia-and-gravity simulation is based on the velocity verlet algorithm ( http://en.wikipedia.org/wiki/Velocity_Verlet#Velocity_Verlet ), which is purely Newtonian. Obviously, this won't do, because this puts no limit on the speeds ships can attain.
    I think converting the whole simulation to general relativity would be completely above my head. I'm wanting to know if there's any simple or medium-difficulty way of simulating a lightspeed limit of the velocity of the ships - without losing kinetic/potential energy - that can be integrated into the velocity verlet algorithm.

    Any help would be most welcome!

    (If this is outright impossible for some obvious reason, I apologize for the blatant ignorance!)

  2. jcsd
  3. Jul 20, 2009 #2
    Ok, here's what I'm thinking of doing, so far. It seems like an obvious solution, but I'm unsure of its accuracy.

    Whenever I'm calculating the acceleration of the particle for the next timestep, I'll use the base mass multiplied by the relativistic factor of change ( 1 / sqrt(1 - v^2/c^2) ).

    This would end up leaving acceleration due to stars' gravity unchanged, since the mass term cancels from the equation, but it would greatly diminish the acceleration of the drive when the ship is at high velocities. One of my main concerns with this is that, if a ship was accelerating towards a star, it's drive might bring it to 0.99c and the star's gravity - with the relativistically increased mass cancelling out - might push it over the edge.

    Would this accomplish the goal? Or would it be screwed up because I'm not also including the time dilation and lorentz transformation? Or perhaps I need to include the relativistic factor in the acceleration due to star gravity, somehow?

    Thanks in advance for any input.
    Last edited: Jul 20, 2009
  4. Jul 20, 2009 #3
    Since my broad questions don't seem to interest people (which is fine, lol), I'll try to break it down into simpler questions:

    Using the above figure as a reference (the units are only meant to be guides, change them if it becomes more convenient), what kind of acceleration due to gravity according to the star's reference frame would one expect on the 1kg-object in the case where:
    a) The object is at rest or traveling at low velocity?
    b) The object is traveling at .99c perpendicular to the source of the gravity?
    c) The object is traveling at .99c towards the source of gravity?
    Main point being, would they be different?

    What sort of time would it take for an object in the edge of the solar system (say, in the near edge of the kuiper belt) to fall into the sun, if it starts out at rest relative to the sun? Years, decades? A century? How about if it started a light year from the sun?
  5. Jul 21, 2009 #4


    User Avatar
    Science Advisor

    Ther'es an equation on p. 34 of http://www.worldscibooks.com/etextbook/6833/6833_02.pdf" [Broken] that might help you.
    Last edited by a moderator: May 4, 2017
  6. Jul 21, 2009 #5

    Vanadium 50

    User Avatar
    Staff Emeritus
    Science Advisor
    Education Advisor
    2017 Award

    You won't get the right answer by plugging in relativistic mass. In fact, I doubt very much that this algorithm will work at all - the expansion assumes a is independent of v, right? Sorry.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook