from astropy import units as u
from math import pi
with $M_{\rm disk} = f M_{\rm tot}$ and $f=1/45$.
Thus: $$ R = \sqrt{\frac{f M_{\rm tot}}{\pi \Sigma}} $$
# define the different quantities
f = 1/45.
# take advantage of astropy's units module
# to handle the units for us
# (we define the quantities with the units given to
# us in the question sheet, and let astropy handle
# the conversions for us)
Mtot = 2e12 * u.Msun
Sigma = 50 * u.Msun / u.pc**2
R = ( f * Mtot / ( pi * Sigma) )**0.5
print(f"The radius is R ~ {R.to('kpc'):.0f}")
The radius is R ~ 17 kpc
For the mean density, we just need to fold in the thickness of the disk:
thickness = 500 * u.pc
rho = f * Mtot / (pi * R**2 * thickness)
print(f"The density is rho ~ {rho.to('Msun/pc^3'):.01f}.")
The density is rho ~ 0.1 solMass / pc3.
Assuming spherical symmetry, we have $$ v_{\rm circ}(R) = \sqrt{ \frac{G M(R)}{R} } $$
The period is then the length of the orbit divided by this velocity: $$ T = \frac{2 \pi R}{v_{\rm circ}} $$ some algebra to find the enclosed mass: $$ M(R) = \frac{4 \pi^2 R^3}{G T^2} $$
G = 6.67e-11 * u.m**3 / u.kg / u.s**2
R_solar_system = 8 * u.kpc
T = 220 * u.megayear
M = 4 * pi**2 * R_solar_system**3 / (G * T**2)
print(f"The enclosed mass is M ~ {M.to('Msun'):.0e}")
The enclosed mass is M ~ 9e+10 solMass
# galaxy cluster
cluster_radius = 1 * u.Mpc
galaxy_radius = 10 * u.kpc
galaxy_number = 1000
# fraction of occupied volume:
fraction = galaxy_number * galaxy_radius**3 / cluster_radius**3
fraction.to('')
# galaxy
star_radius = 1e6 * u.km
star_number = 1e11
fraction2 = star_number * star_radius**3 / galaxy_radius**3
fraction2.to('')
time_interval = 1e10 * u.year
# galaxy cluster
v_typical_cluster = 1000. * u.km / u.s
volume_tube = v_typical_cluster * (pi * galaxy_radius**2) * time_interval
volume_cluster = 4*pi/3 * cluster_radius**3
( volume_tube / volume_cluster ).to('')
# galaxy
v_typical_galaxy = 200. * u.km / u.s
volume_tube2 = v_typical_galaxy * (pi * star_radius**2) * time_interval
volume_galaxy = 4*pi/3 * galaxy_radius**3
( volume_tube2 / volume_galaxy ).to('')
A given body in the system is influent when its gravitational potential is of the same order of magnitude as that of the kinetic energy of another test body: $$ \frac{1}{2} m v^2 \sim \frac{G m^2}{R} $$ thus $$ R \sim \frac{2 G m}{v^2} $$ (where we assumed all the bodies in the system have approximately the same mass $m$.)
# galaxy in cluster
galaxy_mass = 2e12 * u.Msun
RG_cluster = 2 * G * galaxy_mass / v_typical_cluster**2
RG_cluster.to('kpc')
# star in galaxy
RG_star = 2 * G * u.Msun / v_typical_galaxy**2
RG_star.to('AU')
The orientation is randomly distributed on a sphere. We see edge on galaxies when their orientation is within $i_0 = 10$° of the poles. That is: \begin{align*} P(i<i_0) &= 2 \times \frac{1}{4\pi} \times \int_0^{2\pi} d\phi \int_0^{i_0} d\theta \sin\theta &= 1 - \cos i_0 \end{align*} For face-on, the probability is simply $$ P(i>80) = 1 - P(i<80) $$
# numerical python:
import numpy as np
# edge on:
print(1 - np.cos(10 * u.degree.to('rad')))
# face on:
# P(i>80) = 1 - P(i<80)
P80 = (1 - np.cos(80 * u.degree.to('rad')))
print( 1 - P80)
0.01519224698779198 0.17364817766693041
The relaxation time basically tells us for how long the orbit of a star will be influenced by its initial energy. Its expression comes with different approximations and usually looks something like this: $$ t_{\rm relax} = \frac{N}{6\log N} t_{\rm crossing} = \frac{N}{6\log N} \frac{2R}{v} $$
# open cluster
N_open = 300.
v_open = 0.5 * u.km / u.s
R_open = 2 * u.pc
t_open = N_open / (6 * np.log(N_open)) * 2 * R_open / v_open
t_open.to('gigayear')
# globular cluster
N_globular = 2e5
v_globular = 6 * u.km / u.s
R_globular = 3 * u.pc
t_globular = N_globular / (6 * np.log(N_globular)) * 2 * R_globular / v_globular
t_globular.to('gigayear')
To be compared with the typical age of a globular cluster: 12 Gyr. Thus the globular clusters are fully relaxed.
# dwarf spheroidal
N_dwarf = 1e7
v_dwarf = 10 * u.km / u.s
R_dwarf = 500 * u.pc
t_dwarf = N_dwarf / (6 * np.log(N_dwarf)) * 2 * R_dwarf / v_dwarf
t_dwarf.to('gigayear')
Much more than the age of the Universe: the dwarf galaxies are not relaxed.