# Earth, sun, and moon system

• Caspian
In summary, the programmer is trying to model planetary motion and has set up systems that work correctly when compared to the actual Earth-Sun system, but when combined, the moon slingshots around the Earth. The programmer has found a solution by modifying the formulas they are using.

#### Caspian

I'm trying to make a program which makes use of Newton's law of universal gravitation to model planetary motion.

I've set up a system very similar to the earth-sun system (i.e., masses and distances are similar to the actual earth-sun system). When I run the simulation, the "earth" orbits the "sun" just as it should.

Likewise, I made a earth-moon system, and the moon orbits the Earth just as it should.

However, when I put the two systems together and make the Earth orbit the sun while the moon is orbiting the earth, the moon slingshots around the Earth and doesn't return.

To determine the initial velocity of the satellite (in both systems), I use the equation for acceleration from uniform circular motion:
$$a = \frac{v^2}{r}$$

Substituting this into Newton's law of universal gravitation (using "m a" for "F"), and solving for v yields:
$$v = \sqrt{\frac{G \cdot m}{r}}$$

I suspect that the moon needs a different initial velocity since its motion must be a spiral around the sun... but I can't figure it out.

I'd greatly appreciate any help anyone can give... or if someone can point me in the right direction.

Thanks!

Last edited:
There are several problems here.

First, $v=\sqrt{Gm/r}$ is the velocity of an object of inconsequential mass relative to center of the Earth. You need to make that a velocity relative to the Sun to get even close to the proper motion.

Second, the Moon does not have an inconsequential mass compared to that of the Earth. A better solution is to make the Earth-Moon system (i.e., the Earth-Moon center of mass) orbit the Sun, and then make the Earth and Moon orbit about each other their common center of mass. You will have to add the center of mass velocity to the velocities resulting from this computation to get the velocities of relative to the Sun.

For even better results, do the same thing with the Earth+Moon and Sun orbiting about their center of mass.

Thanks, D H! I've modified the formulas I'm using and my system works great now.

## What is the relationship between the Earth, Sun, and Moon?

The Earth, Sun, and Moon are all part of the same system known as the solar system. The Sun is at the center of the system and the Earth and Moon both orbit around it. The Moon also orbits around the Earth, creating a complex relationship between all three bodies.

## How does the Earth's rotation and revolution affect our daily lives?

The Earth's rotation on its axis causes day and night, while its revolution around the Sun causes the changing of the seasons. These movements also affect the length of our days and the tilt of the Earth's axis determines the amount of sunlight different parts of the Earth receive, influencing climate and weather patterns.

## What is an eclipse and how does it occur?

An eclipse occurs when the Earth, Sun, and Moon align in a specific way. During a solar eclipse, the Moon passes between the Earth and the Sun, blocking the Sun's light and casting a shadow on the Earth. During a lunar eclipse, the Earth blocks the Sun's light from reaching the Moon, causing it to appear darkened.

## What is the difference between a solar and lunar eclipse?

A solar eclipse occurs when the Moon passes between the Earth and the Sun, while a lunar eclipse occurs when the Earth blocks the Sun's light from reaching the Moon. Solar eclipses are only visible from specific locations on Earth, while lunar eclipses can be seen from anywhere on the night side of the Earth.

## How does the Moon's gravity impact Earth?

The Moon's gravity has several effects on Earth. It causes the tides, which are the rising and falling of the ocean's water levels. The Moon's gravity also slightly slows down the Earth's rotation, causing days to lengthen over time. Additionally, the Moon's gravity helps stabilize the Earth's axis, which is important for maintaining a stable climate.