Physics Simulation

I've written a couple of small physics simulations in the past (hey, everyone has to have a hobby) and now I'm trying to write something a little more complex so decided to attempt to write an program that simulates the motion of the planets and moons in our solar-system entirely procedurally - initially I'm starting off with just the Earth and the Sun.

With the initial values as follows:
Mass Sun: 1.989x10^30kg
Mass Earth: 5.976x10^24kg
Mean distance between the Earth and the Sun: 1.496x10^8km

I'm using Newton's law of Universal Gravitation to calculate the gravitational force between the sun and the earth as 3.54476x10^28N

I then use F=ma to calculate the earth's acceleration towards the sun and visa versa:
Earth towards Sun: 5.93166x10^3ms-1
Sun towards Earth: 1.78218x10^-2ms-1

My problem is, I'm not sure if these results are correct and after a good hour of scouring google and a small pile of physics textbooks I can't seem to find the correct values for my calculations to check these with. If anyone can check the math for me or point me to a site with these values i'd appreciate it greatly.

cheers
 PhysOrg.com physics news on PhysOrg.com >> A quantum simulator for magnetic materials>> Atomic-scale investigations solve key puzzle of LED efficiency>> Error sought & found: State-of-the-art measurement technique optimised
 Blog Entries: 47 Recognitions: Gold Member Homework Help Science Advisor
 Did u check for the centrifual force? And one more thing u will obviously get a very small accelaration of sun towards earth.

Physics Simulation

They seem okay. Btw, for orbiting systems, Verlet integration is a very good way to go, as it preserves energy in this case.
 No you went wrong somewhere you should have got 3.54476E22N Did you remember to convert the kilometers to meters? 1.496E8km = 1.496E11m The easiest way to do it is in scientific notation simple do the maths on the number and add and subtract the exponentials Mass Sun: 1.989E30 kg Mass Earth: 5.976E24 kg Mean distance between the Earth and the Sun: 1.496E11 m Gravitational constant 6.673E-11 m3 kg-1 s-2 F = G x M1 x M2 / (R x R) = 6.673E-11 x 1.989E30 x 5.976E24 / (1.496E11 x 1.496E11) = 79.317E43 / 2.238E22 = 35.441E21 Newtons (now correct to 1 decimal place for proper scientific notation) = 3.5441E22 Newtons If you want to cheat and not do the maths :-) http://www.ajdesigner.com/phpgravity...tion_force.php
 Strictly speaking, the force due to gravity is not constant because the distance between a planet and the sun is not constant. The planets do not travel in perfect circles, but in ellipses. So it is best to recalculate the gravitational forces at every time step. This is especially true when you start adding other planets to the simulation, because they exert gravitational forces on each other and do not have constant separations. If you approach the problem generally and apply total forces and find total accelerations for each body (don't treat the sun as special), then you can use the same code to simulate beautiful binary star system trajectories. By the way, you don't have to program in centrifugal force because it is a fictional force. If you program the gravitational accelerations properly, the apparent effect that we can centrifugal force will appear automatically.

Mentor
 Quote by cephron I'm interested in any input.(and to the original poster, let me know if you consider this to be hijacking your thread beyond your purposes; I'll apologize and start a new one...)
Note well: The hijack isn't your fault, cephron.

The last time the OP was here was September 3 in 2007, so close to 4 years ago.

This thread is now locked. The continued discussion on velocity verlet et al is here.