1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Numerical Integration of Chandrasekhar's Equation

  1. Oct 15, 2016 #1


    User Avatar
    Gold Member

    1. The problem statement, all variables and given/known data
    We need to write an integrator for the Chandrasekhars Equation (CE) for White Dwarfs (WD) using python3/NumPy/Matplotlib. We then need to compute the structure of a WD made of our varying elements. We also need to compute and plot the mass-radius relation for WD.

    2. Relevant equations
    We are given equations for C1, C2, K, eta, alpha, Radius, Mass and density.
    rho = C2*x3=C2*zc3(phi2-1/(zc2))3/2

    3. The attempt at a solution
    I have never used python3 before so this is a bit of a challenge.
    My script sets up all the constants and variables, sets up the arrays.
    #then uses the initial conditions and sets an array for the ce
    #then sets the integrator as rk4
    #then integrates the CE
    #calculates rho, alpha, p, temp, r
    M = ((4*pi)/c2**2)*(((2*c1)/(pi*G))**(3/2))*((-x**2)*y[:,0])
    #Plot r vs rho, r vs temp etc..

    I need to figure out where to vary zc to find a certain WD mass
    Any suggestions would be much appreciated.
    Last edited: Oct 15, 2016
  2. jcsd
  3. Oct 15, 2016 #2

    Charles Link

    User Avatar
    Homework Helper
    Gold Member

    Your line where you have "this is where I get my error" needs a phi^2 in place of the ## (1/zc)^2 ##.
  4. Oct 15, 2016 #3


    User Avatar
    Gold Member

    I just noticed and updated this too! Thanks for confirming it for me.

    Looks like it produces a density plot, but I need to vary zc to suit the WD mass.
    Also my mass isnt plotting anything.

    Attached Files:

    • rho.pdf
      File size:
      14.1 KB
    Last edited: Oct 16, 2016
  5. Oct 17, 2016 #4


    User Avatar
    Gold Member

    This was mostly python issues, and not issues with the physics itself.
    I managed to work through it.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted

Similar Discussions: Numerical Integration of Chandrasekhar's Equation
  1. Numerical Integration (Replies: 3)