Numerical Integration of Chandrasekhar's Equation

Click For Summary

Homework Help Overview

The discussion revolves around writing an integrator for Chandrasekhar's Equation (CE) related to the structure of White Dwarfs (WD) using Python with libraries such as NumPy and Matplotlib. Participants aim to compute and plot the mass-radius relation for WDs while addressing challenges in their coding attempts.

Discussion Character

  • Mixed

Approaches and Questions Raised

  • Participants describe their attempts to set up constants, variables, and arrays for the integration process. They discuss using the RK4 method for integration and express challenges with Python coding, particularly with error handling and plotting results.

Discussion Status

Some participants have identified specific coding errors and have made updates based on feedback. There is an ongoing exploration of how to vary parameters, such as zc, to achieve desired WD mass outcomes. While some progress has been made, issues with plotting and integration remain topics of discussion.

Contextual Notes

Participants mention a lack of familiarity with Python, which adds complexity to their attempts. There are references to specific equations and variables that are critical to the problem but may not be fully resolved in the current discussion.

vmr101
Gold Member
Messages
25
Reaction score
1

Homework Statement


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.

Homework 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

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:
Physics news on Phys.org
vmr101 said:

Homework Statement


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.

Homework 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

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.
ce1 = functools.partial(le.ce,zc=zc) #this uses the initial conditions and sets an array for the ce
a = functools.partial(le.rk4,h=h) #this sets the integrator as rk4
x, y = le.integrate(ce1,x,y,a,t,zc) #this integrates the CE

rho = c2*zc**3*(y[:,0]**2 -1/zc**2)**(3/2)
alpha = ((2*c1)/(pi*G))**(1/2) * 1/(c2*zc)
pr = K*rho**gamma
temp = (pr*mewe)(rho/Rgas) ##error here
r = alpha*x
M = ((4*pi)/c2**2)*(((2*c1)/(pi*G))**(3/2))*((-x**2)*y[:,0])
Mmax = 4*pi*(2.01824)*(K/pi*G)**(3/2)
#Plot r vs rho, r vs temp etc..

Any suggestions would be much appreciated.
Your line where you have "this is where I get my error" needs a phi^2 in place of the ## (1/zc)^2 ##.
 
Charles Link said:
Your line where you have "this is where I get my error" needs a phi^2 in place of the ## (1/zc)^2 ##.
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 isn't plotting anything.
 

Attachments

Last edited:
This was mostly python issues, and not issues with the physics itself.
I managed to work through it.
 

Similar threads

Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
7
Views
2K
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
Replies
4
Views
5K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K