- #1
TheJP78
- 3
- 0
Hey'all. First of all, I'm not fluent in English, so forgive me for the spelling mistakes. So, I'm trying to make a simulation of a solar system using python 3.9. It's not complicated, but my teacher wants me to do it using the Basic Verlet method, and that's what is bugging me. He told me do do divide the code in three steps: Sun-Earth, Earth-Moon, and then the rest of the planets. He also told me the basics to initialize the code:
1. creat a function called acceleration(r, v) that contains the position r(x0, y0, x1, y1, ...) and the velocity v(x0, y0, x1, y1, ...);
2. use the acc(r, v) funtion and the verlet method to calculate the position of the Earth relatively to the sun (the sun will be located in r=v=0);
3. the same case as the above, but now for the earth-moon and the other planets.
He wrote a short instruction for me (linked bellow). My problem is to define the acceleration function. I found a similar code on stack overflow (https://stackoverflow.com/questions...in-python-resulting-in-particles-running-away) and tried to modify it, but didn't work.
If anyone could help me I will be forever grateful.
1. creat a function called acceleration(r, v) that contains the position r(x0, y0, x1, y1, ...) and the velocity v(x0, y0, x1, y1, ...);
2. use the acc(r, v) funtion and the verlet method to calculate the position of the Earth relatively to the sun (the sun will be located in r=v=0);
3. the same case as the above, but now for the earth-moon and the other planets.
He wrote a short instruction for me (linked bellow). My problem is to define the acceleration function. I found a similar code on stack overflow (https://stackoverflow.com/questions...in-python-resulting-in-particles-running-away) and tried to modify it, but didn't work.
If anyone could help me I will be forever grateful.