0
$\begingroup$

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?

$\endgroup$
6
  • $\begingroup$ One can always recast a second order problem $y''=f(t,y,y')$ as $x'=y,y'=f(t,x,y)$. $\endgroup$
    – Ian
    Nov 11 '16 at 19:17
  • $\begingroup$ @Ian can you show me? $\endgroup$ Nov 11 '16 at 19:19
  • $\begingroup$ So you have 3 unknowns and 1 ODE, Right? $\endgroup$
    – Narasimham
    Nov 11 '16 at 19:21
  • $\begingroup$ There is not much to show. Rewrite your equation as $\psi''=f(r,\psi,\psi')$, then you can rewrite your equation as $\psi'=y,y'=f(t,\psi,y)$. $\endgroup$
    – Ian
    Nov 11 '16 at 19:21
  • 1
    $\begingroup$ @Narasimham My understanding is that $\rho,P,G$ and $F$ are all given. $\endgroup$
    – Ian
    Nov 11 '16 at 19:21
1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.