# Estimating of the size of the Milky Way from the Sun's motion

You messed up a bit in your calculation. Your answer is in light-seconds, not light-years. If you divide by the number of seconds in a year, you'll get the correct answer.

T_sun = (200e6)*365.25*24*3600 # [s]
v_sun = 200e3 # [m/s]
c = 2.99792458e8 # [m/s]
pi = 3.14159
d_Milkyway_m = 2*T_sun*v_sun/pi # [m]
d_MilkyWay = d_Milkyway_m/(c*365.25*24*3600) # [ly]

print "d_MilkyWay = %.2e [light years]"%(d_MilkyWay)


It took me embarrassingly long to figure this out. Your calculations are mostly correct, except at the end. The "diameter" of the Milky Way would indeed be $$d = 2 \frac{T_\text{sun} v_\text{sun}}{c\pi},$$ but this is in light-seconds not years. You need to further divide this by the number of seconds in one year. And if you do this, you will find that $$d \approx 85,000 \text{ light years}.$$

(Alternatively, and perhaps much more efficiently, you could just measure $$T_\text{sun}$$ in years, that would give the same answer with fewer calculations.)

Dimensional analysis is hard, and I just wanted to verify the calculations of other answers here.

Since you are using Python, you should know that there are tools that can assist in dimensional analysis; These tools can be very helpful and would in this case show you where you went wrong.

Taking your sample code and turning it into a dimensional one, using pint (other tools for dimensional analysis are available), will look as follows:

import pint
U = pint.UnitRegistry()

T_sun = 200e6 * U.years
v_sun = 200 * U.km / U.s
r_sun = (T_sun / (2 * U.pi)) * v_sun
d_milkyway = 2 * 2 * r_sun

print('d_milkyway ~ {:.1f}'.format(d_milkyway.to('light_years')))


Which yields

d_milkyway ~ 84941.4 light_year


Note that if we omit the conversion to('light_years'), we would see

d_milkyway ~ 8.0e+10 kilometer * year / pi / second