Stellar model 3: The Lane-Emden solutions
REFERENCE: Bowers and Deeming
In the last lesson we arrived at the second order differential Lane-Emden equation of index n:
x2 = -qn,
with the boundary conditions
q = 1, x = 0
= 0, x = 0.
How did we get the following relationships?
R = rc(1-n)/2nx1,
M = 4p rc(3-n)/2n -x2 ,
Pc = 4p(n+1) ,
r> = rc - ,
Eq. 4 can be gotten via r = ax, g - 1 = 1/n, l = rc, and the condition
that x = x1 when r = R, where a = .
Eq. 5 can be gotten via m(r) = - , dr = adx, P = Krg and g - 1 = 1/n, l = rc and the condition that x = x1 when m = M. Eq. 6 and Eq. 7 come from taking ratios of M2/R4 and M/R3 respectively, using Eq. 4 and Eq. 5 (R and M respectively), and cleaning up. For Eq. 7 use the usual definition <r> = 3M/4pR3.
Of course, Eq. 4 through Eq. 7 are useless without values for x1 and dq/dx. Thus we need solutions to the Lane-Emden equation. Eq. 1 can be solved analytically for only n = 0, n = 1, and n = 5. The solutions are as follows, and can be verified:
n = 0, q0 = 1 - x2/6,
n = 1, q1 = ,
n = 5, q5 = (1 + x2/3)-1/2.
The solutions to the Lane-Emden equation for any other indices requires numerical solutions with the assistance of a simple program. Before writing it we will substitute friendlier letters into the Lane-Emden equation, and then we will take the first derivative and rearrange:
x2 = -qn ® X2 = -Tn ® = - + Tn .
The general outline of such a Visual Basic program is as follows:
Option Explicit
Sub LaneEmden()
'------.
'Numeric solution to the Lane-Emden differential eq'n |
' d^2T / 2 dT \ |
' ---- = - | - -- + T^n | T = theta, a unitless density |
' dX^2 \ X dX / X = xi, a unitless length |
'Condition 1: T = 1 at X = 0 Density is max at star center |
'Condition 2: dT/dX = 0 at X = 0 See eq. of hydr. equilibrium |
'Condition 3: Exit at T(X) = 0 Have reached surface of star |
'Condition 4: n < 5 Infinite X for n >= 5 |
'------'
'Define the variables, set aside memory
Dim T As Single
Dim X As Single
Dim dTdX As Single
Dim dX As Single
Dim dT As Single
Dim n As Integer
Dim i As Integer
'Main program
Text1.Text = "Solutions to the Lane-Emden equation" & vbCrLf
For n = 0 To 9 Step 1 'Initalize the boundary conditions each loop
T = 1 'Condition 1
X = 0.00001 'Condition 1
dTdX = 0 'Condition 2
dX = 0.001 'Adjust for accuracy
For i = 1 To 32000 Step 1 'Set upper limit on iterations
'to guarantee exit from For loop
dTdX = dTdX - (2 * dTdX / X + T ^ (n / 2)) * dX
T = T + dTdX * dX
X = X + dX
If T <= 0 Then
Text1.Text = Text1.Text & vbCrLf & "GOOD RESULTS: "
Exit For 'Normal exit at first zero
End If
Next i
If T > 0 Then 'Ran out of iterations - abnormal exit
Text1.Text = Text1.Text & vbCrLf & "BAD RESULTS: "
End If
Text1.Text = Text1.Text & "n = " & FormatNumber(n / 2, 2, vbTrue)
Text1.Text = Text1.Text & " X = " & FormatNumber(X, 5, vbTrue)
Text1.Text = Text1.Text & " dT/dX = " & FormatNumber(dTdX, 5, vbTrue)
Next n
End Sub
Private Sub Form_Load()
Call LaneEmden
End Sub
Sample output for parameters as in program above...
Solutions to the Lane-Emden equation
GOOD RESULTS: n = 0.00 X = 2.44901 dT/dX = -0.81634
GOOD RESULTS: n = 0.50 X = 2.75301 dT/dX = -0.49985
GOOD RESULTS: n = 1.00 X = 3.14201 dT/dX = -0.31818
GOOD RESULTS: n = 1.50 X = 3.65401 dT/dX = -0.20323
GOOD RESULTS: n = 2.00 X = 4.35401 dT/dX = -0.12715
GOOD RESULTS: n = 2.50 X = 5.35701 dT/dX = -0.07619
GOOD RESULTS: n = 3.00 X = 6.90101 dT/dX = -0.04236
GOOD RESULTS: n = 3.50 X = 9.54501 dT/dX = -0.02074
GOOD RESULTS: n = 4.00 X = 14.99401 dT/dX = -0.00799
GOOD RESULTS: n = 4.50 X = 31.93801 dT/dX = -0.00170