Early attempts at understanding stellar structure focused around models of self-gravitating gaseous spheres in which the material obeys a polytropic equation-of-state P = K ρ1+1/n; here, K and the 'polytropic index' n are constants. These 'polytropes' satisfy the Lane-Emden equation, a non-linear second-order differential equation for the density parameter θ = (ρ/ρc)1/n.

The Lane-Emden equation has analytical solutions in the n=0, 1 and 5 cases, but for other values numerical solution is required. This web interface, Poly-Web, provides a front end to a Fortran program I've written for just this purpose. In the form below, enter values for the polytropic index and the number of radial grid points to use, and then hit the submit button. The resulting polytropic model will be returned to you in your web browser, with the format described below.

Calculate a Polytrope

Output Format

Polytropic models are returned as text (ASCII) files, containing one line for each grid point. Each line is divided into 3 columns, containing the following data:

Column Number Datum Description
1 ζ Scaled radius
2 θ Density parameter
3 dθ/dζ

(The notation used here is the same as on the Wikipedia page describing the Lane-Emden equation; some other authors use z or ξ instead of ζ, and w or Dn instead of θ).


Poly-Web uses a second-order finite difference algorithm to solve the Lane-Emden equation. Thus, the accuracy of solutions depends on the number of radial grid points chosen. These points are distributed uniformly between the center and surface of the polytrope (i.e., uniformly in the independent variable ζ); as the polytropic index approaches the limiting value of 5, and the polytrope becomes progressively more centrally concentrated, it will be necessary to use an ever-greater number of grid points to achieve a specified level of accuracy. However, to avoid tying up the web server with long calculations, I've limited the maximum number of grid points to 100,000.

Poly-Web only accepts polytropic indices satisfying 0 <= n < 5, since negative values are unphysical, and values >= 5 lead to models with infinite radii.

Updated 2021-10-21 11:27:56