(also known as secondary infall problem)

In order to solve this problem you need to generalize the integration
package you wrote for PS5 so that it can solve the -body problem in
an expanding Universe assuming spherical geometry and fixed time steps.
The following ODEs should be integrated in order to solve the
problem (see also my handwritten notes):

(1) | |||

(2) |

This equations describe the motion of spherical shells of dark matter around the black hole in comoving coordinates: is the peculiar velocity of a shell at comiving distance from the black hole and is the difference between the mass within at time and the original mass at time when the Universe was homogeneous (constant density). To convert the distances in physical units use the formula: , where the redshift depends on time as and where Gyr is the age of the Universe. The Hubble parameter in a flat matter dominated Universe is: , where km/s.

Alternatively you can integrate the equation as a function of redshift
rather than time (it may be easier). Using the
relationship you get the following equation:

(3) | |||

(4) |

Assume initial conditions as follows: start the simulation at redshift and assume that the dark matter has constant density g/cm. Remember to place a black hole of mass M at . If I forgot to provide enough explanations to solve the problem feel free to ask me. Have fun!

*Hints: The dark matter should create a spherical halo around the
black hole with mass
and have a total mass
within the halo radius that increases with decreasing redshift as
.*