I'm creating a numerical integration model of a white dwarf. So I've started with calculating electron pressure vs number density across a wide range of values.
Using the equations of state in Lagrangian form, $$\frac{\mathrm{d}r}{\mathrm{d}m}=\frac{1}{4\pi r^2\rho},\quad\frac{\mathrm{d}P}{\mathrm{d}m}=-\frac{Gm}{4\pi r^4}$$
I'm starting with a set value for the centre density, then going shell by shell integrating with step size $\mathrm{d}m$ (such as in the photo below) and calculating radius, density and pressure.
My question is: How do I treat this mathematically? For example, for the first equation, moving $r^2 \mathrm{d}r$ to the left side and the rest to the right, and then integrating both sides. Do I integrate from 0 to $\mathrm{d}m$ for the first shell on both sides? I'm just not sure how to treat $\mathrm{d}m$ since in a way it's a constant.
I've been trying to find a single example of someone using numbers or even doing something similar online, to understand how to treat $\mathrm{d}m$ in this situation, but to no avail.
I'm planning on coding this in Python, so bonus points if you have any great functions/packages as well.