Using the pint in code below I somehow end up with both units: meter and kilometer:
107661.59454231549 meter ** 1.5 / kilometer ** 0.5 / second
import math
import pint
u = pint.UnitRegistry()
Q_ = u.Quantity
R_mars = 3396 * u.km
m_mars = 6.419 * 10 ** 23 * u.kg
G = 6.674 * 10 ** (-11) * u.m ** 3 / u.kg / u.s ** 2
R = 300 * u.km + R_mars
def calc_orbital_v(M, R):
return (G * M / R) ** (1/2)
print(calc_orbital_v(m_mars, R))
Why does pint not automatically convert to a unified unit, either meter or kilometer?