Part 2: How I Implemented the Stellar Halos for all .Sci GalaxiesWell, the actual implementation of stellar halos for all 10000+ celestia.Sci galaxies requires the use of

**all** methods I have previously exposed in a tutorial fashion:

Following the literature, I have assumed for simplicity that the stellar halo properties measured explicitly for the Andromeda galaxy (M 31) are approximately universal throughout. Moreover (in a 3rd part), I use a supposedly universal stellar Luminosity function as extracted from nearby Milkyway stars (including HIPPARCOS stars) and as parametrized in E) above.

**Stellar Halo Properties (see A) above)**The galactic halo properties were taken from the FREE

**Ref 1** =

S. Courteau et al., APJ, 739 20 (2011),

*The Luminosity Profile and Structural Parameters of the Andromeda Galaxy*and a second even more recent APJ paper, specializing on the surface brightness profile of the stellar M 31 halo,

**Ref 2** =

Karoline M. Gilbert *et al.* 2012 ApJ 760 76 (2012),

*Global Properties of M31's Stellar Halo from the Splash Survey: I. Surface Brightness Profile*, unfortunately requires a costly subscription. However, here is the

FREE arXive version.

The shape of the skyplane projected halo is essentially

**circular**, corresponding to a

**spherical** shape in 3D. The authors find that the following inverse power law function fits the measured surface brightness of the halo as function of the projected radial distance R from the center:

Here

, with

R* = 30 kpc and a "core radius" parameter

**a_h = 5.2 kpc**. From the analysis, a surprisingly large halo radius

**R_halo >= 175 kpc** (2/3 of M 31's virial radius!) is deduced. The power index α was determined as

**α = 1.1 ± 0.1 ** which is very close to a drop off expected from pure gravity ~ 1/R^2, i.e. α = 1.0.

Here is a summary display of halo measurements and a display of the above fit from Ref 2 (arXiv, Fig. 10).

Attachment:

halo_data_M31.jpg [ 30.29 KiB | Viewed 2428 times ]
**Note:** the data points are color-coded by the field's position angle, counted from M 31's minor axis. It is evident that the data is consistent with a

**circular shape** of the skyplane projected halo!

**3D Deprojection of the Measured Surface Brightness Profile (see B) above)**The next important step is to

**deproject** the observed circular skyplane projected surface brightness distribution into a proper distribution referring to

**3D space**, by following the exposed mathematics in B) above.

The constant R* = 30 kpc above does not enter the present discussion, since we can equivalently rewrite the fit function somewhat simplified as

in terms of a new reference flux constant i0.

As a quick orientation about the geometries involved, let me recall my drawing from the general discussion B):

[click on image for a bigger size]

Attachment:

sphere3d.jpg [ 59.93 KiB | Viewed 2428 times ]
Keep in mind that R and r denote the projected and true halo radius, respectively, as apparent from the figure!

According to B), the radial behaviour of the halo's 3D surface brightness is obtained as solution of an Abel integral equation that takes a simple integral form in terms of the fitted 2D projected expression i(R):

with

The result reduces again to a simple inverse power law that decreases a bit faster, however, like 1/r^(2*alpha+1) for large r! Note the Γ function being a generalization of the familiar factorial n! = 1*2*3*....*n to non-integer argument.

Next, it is convenient to introduce 2 new parameters and a

**dimensionless, fractional**

radius η via the transformation

Obviously,

**η takes values in (0,1)**. The second dimensionless parameter

*ratio*expresses the

*relative* central core size in terms of a ratio of the core radius and the total halo radius r_halo.

The result now takes the simpler form

As it should be, the 3D surface brightness is seen to vanish for η = 1 or equivalently for r = r_halo.

** Random Halo Star Generation (see C, D) above)**While in 3D, the random generation of the

**isotropic** angular dependence involves of course just a

**uniform** (i.e. constant!) Probability Density Function (

**PDF**) (see C) above), the task to properly generate the star density as function of the distance r from center is a much less trivial affair (see D) above).

For the random halo star generation we conveniently use

**spherical polar coordinates** and express the differential

**volume** element dV in this familiar form

dV= r^2 dr dΏ = r_halo^3 * η^2 dη dΏ

For the random generation of the isotropic angular distribution, we again take a look at the differential

**solid angle element dΏ ** as in C) above

dΏ = sinΦ dΦ dθ = - d(

cosΦ) dθ

treating correspondingly θ and cosΦ (NOT Φ) as uniformly distributed random variables.

Next let us focus our attention on the radial dependence.

Note first of all, that our deprojected radial surface brightness distribution i_3D above has the meaning of a volume density (i.e. [#stars / volume]!). Thus, in order to normalize its integral to 1, as needed for a proper PDF, we now need to integrate over the spherical halo

**volume**, like so

Note the resulting factor of η^2 which will suppress the halo star density towards small η and the factor 4π from the trivial integration over the solid angle.

Hence the properly normalized halo star density that will serve as our PDF, takes the following form

Since the normalization integral over i_3D is rather long, I displayed it in unevaluated form. Of course (by construction),

Here is a plot of our PDF that may well be more instructive:

You clearly see that our PDF with its strong depletion towards η -> 0, its sharp peak and its vanishing for η ->1 is very far from a constant, uniform PDF. This is why need to use a combination of the appropriate two methods described in D).

The first step consists in finding a suitable

**majorant function**, simple enough in order to allow using the

**Inverse Transform Method** described in D).

**Remember:** The majorant function needs also to be normalized to a unit area (just like the exact PDF), but after multiplication with a suitable constant C has to enclose our exact PDF entirely! The closer the shape of the majorant is to the exact PDF, the higher the efficiency!

In our case, finding the best majorant with these properties is relatively easy.

Apart from a constant normalization factor, it looks like so:

where the majorant property is based on the obvious inequality:

and thus (for α > 0, w>0)

By comparing the exact PDF with this majorant, you now can prove the majorant property in 2 lines

. Indeed, here is a comparison plot which clearly illustrates the claim:

Look at the legend below the plot. The constant C = 1.214911633 > 1

and correspondingly we get a very high efficiency (100/C)

Next:

i.e. for our case

resulting in a sufficiently simple elementary function on the right!

Therefore, we may easily solve the inversion equation (see D) above!)

**U(η) = u** for η with the result

This equation based on the majorant PDF allows ingenously to use uniform random values u in (0,1) as input from your built-in random generator routine and get output values η in (0,1) that are distributed according to our majorant function. Since our majorant was already pretty close in shape to the exact PDF, we only need to apply relatively small subsequent corrections to the generated sample of η values by means of the

**Acceptance - Rejection Method by John Von Neumann** discussed in D).

All it takes is to throw another uniform random value uu in (0,1) and compare it with the

ratio

if

**uu <= f_by_ch** accept this particular η, else reject η and try with a new η!

+++++++++++++++++++++++

Here is now the final plot of success. I prepared a histogram of binned

**η values of 73728 halo stars** sampled from the

**.Sci** code by means of the described algorithm. Then I overlaid the previous plot with the properly normalized C * majorant (red) and our exact PDF (green). The histogram shape and normalization agrees perfectly with the exact (green) PDF for all η in (0,1)!

+++++++++++++++++++++++

This quite long discussion has so far just covered the random generation of halo star

**positions** in

**3D space**. There is another long section to come (after some rest

) that deals with the random generation of the

**halo star magnitudes and colors**, in agreement with observation!

Please let me know whether the presented level was hopelessly too high, or whether people with some math/astrophysics background were getting out something from this report. The material is certainly not meant as a Newbie tutorial

. It rather should provide a concise report about some

**scientific-level aspects of celestia.Sci**.

Fridger