1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Newtonian Simulation Of Gravity

  1. Sep 2, 2015 #1
    I'm working on a computer graphics program that simulates the motion of two point masses as indicated in this diagram:
    After applying the laws of conservation of momentum and the conservation of energy I am left with the following equation to solve for e':
    Does anyone have any idea how to solve this for e' which is the new velocity vector after a certain delta t?
  2. jcsd
  3. Sep 2, 2015 #2


    User Avatar
    2017 Award

    Staff: Mentor

    It is a quadratic equation. You cannot divide by vectors so you have to be careful while solving it, but there is no magic needed.
  4. Sep 2, 2015 #3
    So should I break down e, e' and f into their components?
  5. Sep 2, 2015 #4


    User Avatar
    2017 Award

    Staff: Mentor

    I don't think you have to, apart from the last steps maybe.
  6. Sep 2, 2015 #5
    What about b' and c'? You consider these known?
  7. Sep 2, 2015 #6
    Yes, because they can be calculated according to b' = b + eδt.
  8. Sep 2, 2015 #7


    User Avatar
    Staff Emeritus
    Science Advisor

    I've built a small simulation of the Earth orbiting the Sun. My method was to break the force, acceleration, velocity, and position vectors into their components and then calculate each component, updating after each time step. I'm not sure if that helps you or not.
  9. Sep 2, 2015 #8
    Thanks Drakkith, yes I have done that already but now I would like the simulation to conserve energy.

    This simulation does not conserve energy:

    This simulation does conserve energy but there is no orthogonal velocity component.

    Still not sure how to solve the above equation. Should I look at the equation for angular momentum too?
  10. Sep 3, 2015 #9


    User Avatar
    2017 Award

    Staff: Mentor

    I just noted that your system is underconstrained - you have one equation for e' but two or three unknowns. I guess your acceleration should go in somehow.
  11. Sep 3, 2015 #10
    I am treating the two body system as a state system.

    b, c, b', c', e, f, mb, mc are all known.

    Though b' and c' are calculated by approximation according to the equation b' = b + eδt.

    Hope this clarifies what I am trying to achieve. I suspect that by quantizing δt I will not be able to conserve energy and momentum?

    EDIT: added e to formula.
    Last edited: Sep 4, 2015
  12. Sep 3, 2015 #11
    What is a "state system"?
  13. Sep 3, 2015 #12
    What I meant by invoking the term "state system" is a system that consists of a set of well defined states. This system consists of the following vector attributes b,c,e,f the components of which may take on the numbers representable by my computer. That is there is no quantum fuzzyness or real numbers with infinite precision in this simulation.

    Hope this clarifies what I meant by "state system".

    EDIT: of -> or
    Last edited: Sep 3, 2015
  14. Sep 3, 2015 #13
    Not really.
    Unless you are talking about a physical system whose state is described by the positions and velocities vectors.
    Which is how a mechanical system is usually described.

    Is you system made from physical objects or from the set of states of a physical system (made from real objects).
  15. Sep 3, 2015 #14
    Yes that is what I am talking about.

    My system is a computer simulation similar to those that I have posted previously; the objects are obviously not actually physical objects but like physical objects . The objects obey Newton's laws of motion and gravitation; if they happen to collide then they will rebound elastically. So your latter description is more appropriate.

    Do you have any suggestions as to how this equation my be solved for e' given all of the other variables may be considered as known?:

  16. Sep 3, 2015 #15
    I don't think you can. You have three unknowns in the equation: the magnitude of e' and the projections of e' on e and f.
    Which is quite normal, isn't it? e' is a vector in 3D so you need three values to describe it.

    But if you assume that you know b', c' and f' by some magic, why not take it one step further and assume e' known as well? :smile:
  17. Sep 4, 2015 #16
    What you say is true, I probably haven't sufficiently explained myself... f' can be eliminated by conservation of momentum as shown above.
    b' can be eliminated with this approximation b' = b + eδt. Now I could obtain e' by a similar approximation but that would result in energy not being conserved due to the inherent graininess of the approximation which is the reason why I would like to solve the above equation. I am now looking into the conservation of angular momentum to give additional constraints.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook