Lane-Emden equation from astrophysics

Alex Townsend, 6th May 2011

(Chebfun example ode/LaneEmden.m)

Contents

This example is motivated by discussions with the astronomer Alfred Gautschy. The equation is also a demo in chebgui (in the IVP section).

Introduction

The well-known Lane-Emden equation models the mechanical structure of self-gravitating spheres. In astrophysics it plays an important role as it serves to model the structure of stars, ranging from white dwarfs to red giants. The equation is given by

x*u'' + 2*u' + x*u^n = 0,   u'(0) = 0,    u(0) = 1

where u is the solution (known as a polytrope) which models the density of the gas cloud. The variable x corresponds to the radial distance from the centre. The gas is assumed to be polytropic with index n, that is pressure = C*density^(1+1/n) where C is a constant.

Integer polytropic index

Below we compute the polytropes for index n=0:5

%Colour matrix to make the plot pretty.
myColor = [0 0 0; 1 0 0; 1 1 0; 0 1 0; 0 0 1; 1 0 1];

%n = Characteristic exponent
for n = 0:5
% Assign the L-E operator on that domain.
N = chebop(@(x,u) x.*diff(u,2)+2.*diff(u)+x.*u.^n,[0,10]);

% Left boundary conditions
N.lbc = @(u) [u-1,diff(u)];

%Solve the bvp
u = solvebvp(N,0);

% Create plot of the solutions
plot(u,'Linewidth',2,'Color',myColor(n+1,:)), hold on,
axis([0 10 -1 1]),
title('Solution of the Lane-Emden equation for n=0,1,2,3,4,5'),
xlabel('x'), ylabel('u')
end
legend('n=0','n=1','n=2','n=3','n=4','n=5'); Analytic solutions exist when n=0, 1 and 5. So we can check the numerical error in these cases. We just do n=5:

Analytic solution from :

f = chebfun(@(x) (1+x.^2/3).^-.5,[0,10]);

Compute the L2 error

fprintf('The L2 error is: %1.3e\n', norm(f-u));
The L2 error is: 1.163e-14

Finding the polytropic radius

Physically, the first root of the solution is of interest as it defines the outer boundary of the sphere where the gas cloud is polytropic. Since the magnitude of the radius is not known a priori, it can be introduced as an unknown function v; the independent variable can then be transformed as x -> x/v. We then use a perturbation trick by a small factor eps to stop Chebfun from using maps and exponents.

As an example we choose the polytropic index to be n=1.5, appropriate to model the structure of a white dwarf.

d = [0,1];
x = chebfun('x',d);
N = chebop(d);
n = 1.5; eps = 1e-8;
N.op = @(x,u,v) x.*diff(u,2) + 2*diff(u) + x.*v.^2.*(u+eps).^n;
N.lbc = @(u,v) [u-1,diff(u)];
N.rbc = @(u,v) u;
% N.init = [1-x.^2,1];
N.init = [cos(pi/2*x),pi];
uv = N\0;
plot(uv,'Linewidth',2), hold on,
axis([0 1 0 1.05*uv(1,2)]),
title('Solution u and radius v'), legend('u','v')
xlabel('x'), ylabel('u') Thus the radius of the polytrope describing the structure of a white dwarf is

v = uv(:,2);
fprintf('Polytropic range for white dwarfs: [0,%1.4f)\n',v(1));
Polytropic range for white dwarfs: [0,3.6538)

References

 Chandrasekhar, S. An Introduction to the Study of Stellar Structure.

 Horedt, George Paul (1986) 'Seven-digit tables of Lane-Emden functions'

 Wikipedia article: 'http://en.wikipedia.org/wiki/Lane-Emden_equation'
{"ft_lang_label":"__label__en","ft_lang_prob":0.74407935,"math_prob":0.99843264,"size":3102,"snap":"2019-43-2019-47","text_gpt3_token_len":1021,"char_repetition_ratio":0.10361524,"word_repetition_ratio":0.008264462,"special_character_ratio":0.3372018,"punctuation_ratio":0.19418758,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9994048,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,2,null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-10-19T04:22:25Z\",\"WARC-Record-ID\":\"<urn:uuid:be56bf6e-31ae-4ead-9887-55ce0904b3c6>\",\"Content-Length\":\"12803\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:a7d3a213-6fe0-49b3-82f1-8d601a16a98c>\",\"WARC-Concurrent-To\":\"<urn:uuid:feab79f5-7505-429d-8615-833c3e77c5b1>\",\"WARC-IP-Address\":\"104.108.96.151\",\"WARC-Target-URI\":\"https://www.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/23972/versions/22/previews/chebfun/examples/ode/html/LaneEmden.html\",\"WARC-Payload-Digest\":\"sha1:NC4SPDALLYUIIY64KDULWHV222ZXF3F3\",\"WARC-Block-Digest\":\"sha1:IXDKCEPNQKMFWNT726RATZNZJXPJRP4W\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-43/CC-MAIN-2019-43_segments_1570986688826.38_warc_CC-MAIN-20191019040458-20191019063958-00293.warc.gz\"}"}