Hydrostatic Equilibrium
Hydrostatic Equilibrium
A star is not collapsing — it is in a delicate balance between gravity pulling inward and pressure pushing outward. This balance is called hydrostatic equilibrium.
The Equation
At every point inside a star, the pressure gradient must exactly counteract gravity:
where is the mass enclosed within radius .
Central Pressure Estimate
Using the virial theorem approximation, the central pressure of a star scales as:
For the Sun, this gives Pa — about a billion atmospheres.
Free-Fall (Dynamical) Timescale
If pressure support were suddenly removed, a star would collapse under its own gravity on the free-fall timescale:
where is the mean density. For the Sun, s — about 30 minutes.
Mean Density
The Sun's mean density is about 1410 kg/m³ — slightly denser than water.
Your Task
Implement three functions. Use m³ kg⁻¹ s⁻², defined inside each function.
central_pressure_Pa(M_kg, R_m)— virial estimate of central pressure in Pafreefall_timescale_s(rho_kg_m3)— free-fall collapse timescale in secondsmean_density_kg_m3(M_kg, R_m)— mean density of a spherical body in kg/m³