# Calculation of Neutron star pressure/mass using 4th order Runge-Kutta

1. Jul 2, 2013

### mary1986

Hi all, this is my first post here and i apologize if some rules aren't followed.

I have to complete the Project 13.1 (studies of neutron stars: p 346-350)
http://www.cec.uchile.cl/cinetica/pcordero/MC_libros/Hjorth-Jensen2008.pdf

When browsing using pdf pages 346 to 350, assignments 1 through 9.

I am using c for solving this problem but am having problems with implementing the mass-energy density is given by a simple parametrization from Bethe and Johnson:
ρ(n) = 236 × n2.54 + nmn

here is the code: http://snipt.org/AAK4 [Broken]
My code is suprisingly similar, but i can't seem to figure out how the Bethe and Johnson parametrization comes in this code.

Any help is greatley appreciated
Mary

Last edited by a moderator: May 6, 2017
2. Jul 2, 2013

### phyzguy

What you need to do is as follows:

At each step, you know P. Given P, you can invert equation 13.104 to find n. Then you insert this value of n into equation 13.102 to find rho. This value of rho is then used in the Runge-Kutta to take the next step.

You could set up a function to calculate n given P, and another function to calculate rho given n, or you could just set up one function to calculate rho given P.

Does this help?

3. Jul 15, 2013

### mary1986

You have helped a lot, but more questions came up.
That would mean i must start from the surface of the star where P=0,

If I was to start from center, how could I calculate pressure for the first step (at the center of neutron star)?

4. Jul 15, 2013

### phyzguy

You do want to start from the center. You assume a value for rho-s, the density at the center. Then you can calculate P at the center from 13-102 and 13-104, as well as the constants R0 and M0. Then you integrate out until P=0. This will give you values for the mass and radius of the star. You will get a family of curves with different mass and radius parameterized by the parameter rho-s.

At least, this is how I would attack it.