# Calculating the Mass of The Sun

One of the most important relationships in astronomy is Kepler's laws of planetary motion, because they allow us to use orbits to calculate the masses of astronomical objects. Of particular use is Kepler's third law, which relates the period, separation, and masses of two objects:

\begin{equation}
P^2 = \frac{4 \pi^2}{G (m_1 + m_2)} a^3
\end{equation}

Here $G$ is the gravitational constant, $m_1$ and $m_2$ are the masses of the two bodies orbiting eachother, $P$ is the period of their orbit, and $a$ is the distance between them. In the case of our Solar System, because the mass of the Sun is significantly greater than the mass of any of the planets (i.e. $m_1 + m_2 \approx m_1$), this can be reduced to:

\begin{equation}
P^2 = \frac{4 \pi^2}{G \, M} a^3
\end{equation}

Because we know the periods and distances for all of the planets, we can use those values to calculate the mass of the body that they are orbiting, i.e the Sun.

First, pick your favorite planet. Look up their orbital period and the distance from the Sun (i.e. their "semi-major axis"). You will also need to look up the value of the gravitational constant, $G$. Make sure to check your units! Define those as variables here:


```python

```

Now, using the above equation, calculate the mass of the Sun:


```python

```

Use what you know about string formatting to print out the mass you calculated with nice formatting, including units:


```python

```

Just to make sure we did that correctly, pick your second favorite planet, and repeat. Do you get the same answer?


```python

```

Kepler's laws are universal, so they don't just work for the Sun, but can be used to measure the mass of anything, if there's something orbiting it. Let's try measuring the mass of Jupiter. Look up the separation and period of Jupiter's moon, Callisto, and use Kepler's third law to calculate the mass of Jupiter in the same way:


```python

```

Finally, astronomers think there is a *supermassive black hole* at the center of our Milky Way galaxy. Why is that? Well, we've been able to watch stars orbit something at the center of our Galaxy:



How massive is the object that they are orbiting? Look-up the period and distance (i.e. semi-major axis) of the star "S2", and calculate the mass of that object (*Hint1: Wikipedia knows about this star. Hint 2: The units '"', or arcseconds, that are listed there for the semi-major axis can be converted into a more useful number by multiplying by the distance to the source. What is a "pc"?*):


```python

```

How does the mass you measured compare with the mass of our Sun:


```python

```

Often in astronomy we will list measured masses in terms of the mass of the Sun, because units of grams or kilograms are not easy to interpret when the numbers are so large. Use string formatting to display the mass of the object at the center of our Solar System in terms of the number of "Solar masses" that it is, with the proper units:


```python

```

eac4e14c3c08dd21ec712496c81bd8a70ec99e2f
ipynb
Jupyter Notebook
BonusProblems/Module1/BonusChallenge2.ipynb
psheehan/CIERA-HS-Program
76f7f0ff994e74e646fa34bbb41c314bf7526e9b
Naumen Condor-1.1 MS-PL
2019-06-25T02:36:49.000Z
2020-06-09T21:44:41.000Z
BonusProblems/Module1/BonusChallenge2.ipynb
psheehan/CIERA-HS-Program
76f7f0ff994e74e646fa34bbb41c314bf7526e9b
Naumen Condor-1.1 MS-PL
BonusProblems/Module1/BonusChallenge2.ipynb
psheehan/CIERA-HS-Program
76f7f0ff994e74e646fa34bbb41c314bf7526e9b
Naumen Condor-1.1 MS-PL
2019-06-25T15:33:10.000Z
2021-05-12T18:04:36.000Z
Qwen/Qwen-72B
1. YES
2. YES