I am writing a program in a version of Basic for showing the orbits of 3 bodies. To check that it works I do the following. Each body is of the same mass say 50. I cannot get them to rotate in three separate orbits of equal size, which is the test that the program works.(adsbygoogle = window.adsbygoogle || []).push({});

I place the bodies at the respective corners of an equilateral triangle so that the three bodies are an equal distance apart. The coordinates of the three bodies are:

x1,y1 = (-500,-288.675...),

x2,y2 = (500,-288.675...),

x3,y3 = (0,577.35...),

and their velocity components are:

Vx1,Vy1 = (20,-34.6...),

Vx2,Vy2 = (20,34.6...),

Vx3,Vy3 = (-40,0). This way the change of momentum of the entire system equals zero. The result that I get is that body-2's orbit coalesces with body-3's and three's coalesces with body-1's e.t.c., to give three bodies having the same large anticlockwise orbit, instead of three separate orbits. I know that the starting positions and directions of the initial velocity components are critical.While I have the initial positions correct I do not know if the directions ' are correct. If I put any two bodies in a clockwise orbit and the remaining body in a anticlockwise orbit, I seem not able to fulfill the requirement that the change in momentum of the entire system equals zero, yet I feel that this is required to get the system of masses orbiting correctly.

Help would be appreciated.

Note : In order for these magnitude of figures to give orbits at all I have set G=1.

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Programming for 3-body problem

Loading...

Similar Threads for Programming body problem |
---|

Insights Intro to Algorithms for Programming - Comments |

C/++/# Ideas for a physics or math programming project? |

Program that calculates the list of x and f(x) for a given function |

C/++/# How to use C++ in studying calculus |

I need help decrypting this |

**Physics Forums | Science Articles, Homework Help, Discussion**