Chris Beaumont's IDL Library

Download source code

single page | use frames     summary     class     fields     routine details     file attributes




result = cnb_imf(mass [, noturnover=noturnover] [, random=random] [, muench=muench] [, malpha0=malpha0])

This function both evaluates the IMF at given mass, and returns masses drawn at random from the IMF. The functional form of the IMF is given by dN/dM ~ M^-alpha, where alpha = 0 for 0 < M / Msolar < .07 (Allen et al 2005) = 1.05 for .07 < M / Msolar < .5 (Kroupa et al 2002 ASPC..285...86K) = 2.35 for .5 < M / Msolar (Ibid)

Return value

If mass is set, it returns a vector of imf(mass). If random is set, it returns a vector of masses drawn from the IMF distribution.


mass in required

A set of masses at which to evaluate the IMF. Given in solar masses. If provided, the program returns imf(masses) as a scalar or vector. This function is not normalized


noturnover in optional

If set, treat the full IMF as having alpha = 2.35. This cannot be used in conjunction with the RANDOM keyword

random in optional

Set this to a number (nstars) to draw nstars from the IMF mass distribution. If this keyword is set, then the function returns the masses of the nstars drawn from the distribution.

muench in optional

Use the first three terms of the power law imf given in equation 1 of Muench et al. 2002 (ApJ 573)

malpha0 in optional

Manually specify the high mass value for alpha.

Author information


April 2009: Written by Chris Beaumont May 2009: Added RANDOM keyword. cnb. June 2009: Added MUENCH keyword. cnb.

File attributes

Modifcation date: Mon Oct 25 14:50:15 2010
Lines: 92