In my research I have come across the following problem that I am trying to solve numerically.
I have
$$ \frac{d}{dr} \left[ \frac{1}{r^2 \rho(r)} \left( \frac{d \psi(r)}{dr} \right) \right] + \frac{4\pi G \rho(r)}{r^2 P(r)} \psi(r) = \frac{d}{dr} \left( \frac{F(r)}{r^2 \rho(r)} \right) $$
with $\psi(r=r_\min) = \psi(r=r_\max) = 0$.
I have numeric values for all of those variables except for $\psi$ which I would like to solve for numerically.
I am looking to use scipy's solve_bvp but it requires the problem to be stated as a system of first order ODEs. How can I solve this problem?
Set $$ \varphi(r)=\frac{1}{r^2 \rho(r)} \left( \frac{d \psi(r)}{dr} \right) - \frac{F(r)}{r^2 \rho(r)} \\~\\ \iff\\~\\ \frac{d \psi(r)}{dr} = r^2 \rho(r)\varphi(r) + F(r) $$ so that the original equation reduces to first order $$ \frac{dφ(r)}{dr}=-\frac{4\pi G \rho(r)}{r^2 P(r)} \psi(r) $$ Together both equations constitute an equivalent first order system.