# How Many Earths

In Astronomy, the numbers are incredibly large and generally incomprehensible. In order to wrap our heads around these numbers, we employ a lot of comparisons and make relative references.

For example, the radius of the Earth is $$R_\oplus = 6.371 \times 10^{6}$$ meters, the radius of Jupiter is $$R_\text{jup} = 69.911 \times 10^{6}$$ meters, and the radius of the Sun is $$R_\odot = 696.34 \times 10^{6}$$ meters.

We may ask the question, "how many Earths will fit inside of Jupiter?" as well as "how many Earths will fit inside of the Sun?"

What are we really talking about here? We can approximate the volume of each of these objects using the formula for the volume of a sphere,

$V_\text{sphere} = \frac{4}{3} \pi r^3\,.$

Plugging our radius values into $$(1)$$, we can compute the volumes as follows.

Initially, we set our known radius constants.

const r_earth = 6.371e6
const r_jupiter = 69.911e6
const r_sol = 696.

I'll create a helper function volsphere to compute the volume of a sphere given a known radius.

volsphere(r::T) where {T<:Real} = 4/3 * pi * r^3

Finally, we'll compute the known volumes of each sphere and then calculate the ratio of $$V_\text{object}$$ and $$V_\oplus$$ to yield the number of Earths which could fit inside each object.

(v_earth, v_jupiter, v_sol) = map(volsphere, [r_earth, r_jupiter, r_sol])

for vol in [v_jupiter, v_sol]
@show vol / v_earth
end

>  vol / v_earth = 1321.3373996052212
>  vol / v_earth = 1.3056934161616967e6

Therefore, we can see that we can fit approximately $$1,300$$ Earths inside of Jupiter and we can fit approximately $$1,305,000$$ Earths inside of the Sun. This is a good example of how incredibly massive these astronomical bodies are. Indeed, if an alien culture was examining our solar system, they would likely say, "we've found an unremarkable, mid-sized star, a couple of gas giants, and a bunch of rubble."