Extended IDL Help

This page was created by the IDL library routine make_html_help. For more information on this routine, refer to the IDL Online Help Navigator or type:

     ? make_html_help

at the IDL command line prompt.

Last modified: Wed May 20 22:19:22 1998.


List of Routines


Routine Descriptions

CURVEFIT

[Next Routine] [List of Routines]
 NAME:
       CURVEFIT

 PURPOSE:
       Non-linear least squares fit to a function of an arbitrary 
       number of parameters.  The function may be any non-linear 
       function.  If available, partial derivatives can be calculated by 
       the user function, else this routine will estimate partial derivatives
       with a forward difference approximation.

 CATEGORY:
       E2 - Curve and Surface Fitting.

 CALLING SEQUENCE:
       Result = CURVEFIT(X, Y, W, A, SIGMAA, FUNCTION_NAME = name, $
                         ITMAX=ITMAX, ITER=ITER, TOL=TOL, /NODERIVATIVE)

 INPUTS:
       X:  A row vector of independent variables.  This routine does
		not manipulate or use values in X, it simply passes X
		to the user-written function.

       Y:  A row vector containing the dependent variable.

       W:  A row vector of weights, the same length as Y.
               For no weighting,
               w(i) = 1.0.
               For instrumental weighting,
               w(i) = 1.0/y(i), etc.

       A:  A vector, with as many elements as the number of terms, that 
           contains the initial estimate for each parameter.  If A is double-
           precision, calculations are performed in double precision, 
           otherwise they are performed in single precision.

 KEYWORDS:
       FUNCTION_NAME:  The name of the function (actually, a procedure) to 
       fit.  If omitted, "FUNCT" is used. The procedure must be written as
       described under RESTRICTIONS, below.

       ITMAX:  Maximum number of iterations. Default = 20.
       ITER:   The actual number of iterations which were performed
       TOL:    The convergence tolerance. The routine returns when the
               relative decrease in chi-squared is less than TOL in an 
               interation. Default = 1.e-3.
       CHI2:   The value of chi-squared on exit
       NODERIVATIVE:   If this keyword is set then the user procedure will not
               be requested to provide partial derivatives. The partial
               derivatives will be estimated in CURVEFIT using forward
               differences. If analytical derivatives are available they
               should always be used.

 OUTPUTS:
       Returns a vector of calculated values.
       A:  A vector of parameters containing fit.

 OPTIONAL OUTPUT PARAMETERS:
       Sigmaa:  A vector of standard deviations for the parameters in A.

 COMMON BLOCKS:
       NONE.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       The function to be fit must be defined and called FUNCT,
       unless the FUNCTION_NAME keyword is supplied.  This function,
       (actually written as a procedure) must accept values of
       X (the independent variable), and A (the fitted function's
       parameter values), and return F (the function's value at
       X), and PDER (a 2D array of partial derivatives).
       For an example, see FUNCT in the IDL User's Libaray.
       A call to FUNCT is entered as:
       FUNCT, X, A, F, PDER
 where:
       X = Variable passed into CURVEFIT.  It is the job of the user-written
		function to interpret this variable.
       A = Vector of NTERMS function parameters, input.
       F = Vector of NPOINT values of function, y(i) = funct(x), output.
       PDER = Array, (NPOINT, NTERMS), of partial derivatives of funct.
               PDER(I,J) = DErivative of function at ith point with
               respect to jth parameter.  Optional output parameter.
               PDER should not be calculated if the parameter is not
               supplied in call. If the /NODERIVATIVE keyword is set in the
               call to CURVEFIT then the user routine will never need to
               calculate PDER.

 PROCEDURE:
       Copied from "CURFIT", least squares fit to a non-linear
       function, pages 237-239, Bevington, Data Reduction and Error
       Analysis for the Physical Sciences.

       "This method is the Gradient-expansion algorithm which
       combines the best features of the gradient search with
       the method of linearizing the fitting function."

       Iterations are performed until the chi square changes by
       only TOL or until ITMAX iterations have been performed.

       The initial guess of the parameter values should be
       as close to the actual values as possible or the solution
       may not converge.

 EXAMPLE:  Fit a function of the form f(x) = a * exp(b*x) + c to
	sample pairs contained in x and y.
	In this example, a=a(0), b=a(1) and c=a(2).
	The partials are easily computed symbolicaly:
		df/da = exp(b*x), df/db = a * x * exp(b*x), and df/dc = 1.0

		Here is the user-written procedure to return F(x) and
		the partials, given x:
       pro gfunct, x, a, f, pder	; Function + partials
	  bx = exp(a(1) * x)
         f= a(0) * bx + a(2)		;Evaluate the function
         if N_PARAMS() ge 4 then $	;Return partials?
		pder= [[bx], [a(0) * x * bx], [replicate(1.0, N_ELEMENTS(y))]]
       end

         x=findgen(10)			;Define indep & dep variables.
         y=[12.0, 11.0,10.2,9.4,8.7,8.1,7.5,6.9,6.5,6.1]
         w=1.0/y			;Weights
         a=[10.0,-0.1,2.0]		;Initial guess
         yfit=curvefit(x,y,w,a,sigmaa,function_name='gfunct')
	  print, 'Function parameters: ', a
         print, yfit
       end

 MODIFICATION HISTORY:
       Written, DMS, RSI, September, 1982.
       Does not iterate if the first guess is good.  DMS, Oct, 1990.
       Added CALL_PROCEDURE to make the function's name a parameter.
              (Nov 1990)
       12/14/92 - modified to reflect the changes in the 1991
            edition of Bevington (eq. II-27) (jiy-suggested by CreaSo)
       Mark Rivers, U of Chicago, Feb. 12, 1995
           - Added following keywords: ITMAX, ITER, TOL, CHI2, NODERIVATIVE
             These make the routine much more generally useful.
           - Removed Oct. 1990 modification so the routine does one iteration
             even if first guess is good. Required to get meaningful output
             for errors. 
           - Added forward difference derivative calculations required for 
             NODERIVATIVE keyword.
           - Fixed a bug: PDER was passed to user's procedure on first call, 
             but was not defined. Thus, user's procedure might not calculate
             it, but the result was then used.
           

(See /deep0/marc/idlshare/Nbody/profiles/my_curvefit.pro)


FIT_GEN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       FIT_GEN
 PURPOSE:
       Fit an NFW profile to the density profile of a dark matter
       halo. 
 CATEGORY:
       Nbody/profile
 CALLING SEQUENCE:
       fitted = fit_gen( r, den, fit_param, fit_errors, weight )
 INPUTS:
       r      -- Radii at which the density is tabulated.
       den    -- Tabulated density to which the NFW profile should be
                 fit. 
       fit_param -- On input, a guess as to the scale radius and
                    characteristic density of the profile.  ALSO USED
                    FOR OUTPUT.
       weight -- Vector of weights to be used in fitting.  Default is
                 same weight (1.0) for each point.
 KEYWORD PARAMETERS:
       /FIXED_MASS -- Set this keyword to require that the total mass
                      of the halo be the number of particles.  This
                      reduces the number of parameters being fit to
                      one, the scale radius.
 OUTPUTS:
       fitted  -- The best fit density profile, evaluated at the
                  points r.
       fit_param -- On output, the parameters of the fit.   ALSO USED
                    FOR INPUT. 
        fit_errors -- The standard deviations in the fits parameters,
                      as determined by the CURVEFIT procedure.
 COMMON BLOCKS:
       COMMON nfw_fit_params, UseFixedParmsCmn, BetaFixed, AlphaFixed
       UseFixedParms -- Set to one if this routine is to use the
                        fixed values of alpha and beta specified in
                        the common block.
       BetaFixed     -- Value of Beta to use if Beta is to be held
                        fixed. 
       AlphaFixed    -- Value of Beta to use if Beta is to be held
                        fixed. 
 SIDE EFFECTS:
       
 NOTES:
       The density profiles fit here are the following:

          \rho = \rho_a/r^\beta/(r+a)^\alpha

       We actually fit to the log of this,
          log(\rho) = \log(\rho_a) - \beta \log(r) 
                          - \alpha \log(r+a).

       The input parmaters are used as follows:
            
          Params(0) = \rho_a
          Params(1) = a
          Params(2) = \alpha
          Params(3) = \beta.
       HOWEVER, if Params(3) is not passed, we set \beta=1, and if
       Params(2) is not passed, we set \alpha=2.
       
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       log_nfw_fit
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/profiles/fit_gen.pro)


FIT_HERN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       FIT_HERN
 PURPOSE:
       Fit a Hernquist profile to the density profile of a dark matter
       halo. 
 CATEGORY:
       Nbody/profile
 CALLING SEQUENCE:
       fitted = fit_hern( r, den, fit_param, fit_errors, weight )
 INPUTS:
       r      -- Radii at which the density is tabulated.
       den    -- Tabulated density to which the Hernquist profile should be
                 fit. 
       fit_param -- On input, a guess as to the scale radius and
                    characteristic density of the profile.  ALSO USED
                    FOR OUTPUT.
       weight -- Vector of weights to be used in fitting.  Default is
                 same weight (1.0) for each point.
 KEYWORD PARAMETERS:
       /FIXED_MASS -- Set this keyword to require that the total mass
                      of the halo be the number of particles.  This
                      reduces the number of parameters being fit to
                      one, the scale radius.
 OUTPUTS:
       fitted  -- The best fit density profile, evaluated at the
                  points r.
       fit_param -- On output, the parameters of the fit.   ALSO USED
                    FOR INPUT. 
        fit_errors -- The standard deviations in the fits parameters,
                      as determined by the CURVEFIT procedure.
 COMMON BLOCKS:
       COMMON nfw_fit_params, UseFixedParmsCmn, BetaFixed, AlphaFixed
       UseFixedParms -- Set to one if this routine is to use the
                        fixed values of alpha and beta specified in
                        the common block.
       BetaFixed     -- Value of Beta to use if Beta is to be held
                        fixed. 
       AlphaFixed    -- Value of Beta to use if Beta is to be held
                        fixed. 
 SIDE EFFECTS:
       
 NOTES:
       The density profiles fit here are the following:

          \rho = \rho_a/r/(r+a)^3

       We actually fit to the log of this,
          log(\rho) = \log(\rho_a) - \log(r) 
                          - \log(r+a).

       The input parmaters are used as follows:
            
          Params(0) = \rho_a
          Params(1) = a
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       log_nfw_fit
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/profiles/fit_hern.pro)


FIT_NFW[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       FIT_NFW
 PURPOSE:
       Fit an NFW profile to the density profile of a dark matter
       halo. 
 CATEGORY:
       Nbody/profile
 CALLING SEQUENCE:
       fitted = fit_nfw( r, den, fit_param, fit_errors, weight )
 INPUTS:
       r      -- Radii at which the density is tabulated.
       den    -- Tabulated density to which the NFW profile should be
                 fit. 
       fit_param -- On input, a guess as to the scale radius and
                    characteristic density of the profile.  ALSO USED
                    FOR OUTPUT.
       weight -- Vector of weights to be used in fitting.  Default is
                 same weight (1.0) for each point.
 KEYWORD PARAMETERS:
       /FIXED_MASS -- Set this keyword to require that the total mass
                      of the halo be the number of particles.  This
                      reduces the number of parameters being fit to
                      one, the scale radius.
 OUTPUTS:
       fitted  -- The best fit density profile, evaluated at the
                  points r.
       fit_param -- On output, the parameters of the fit.   ALSO USED
                    FOR INPUT. 
        fit_errors -- The standard deviations in the fits parameters,
                      as determined by the CURVEFIT procedure.
 COMMON BLOCKS:
       COMMON nfw_fit_params, UseFixedParmsCmn, BetaFixed, AlphaFixed
       UseFixedParms -- Set to one if this routine is to use the
                        fixed values of alpha and beta specified in
                        the common block.
       BetaFixed     -- Value of Beta to use if Beta is to be held
                        fixed. 
       AlphaFixed    -- Value of Beta to use if Beta is to be held
                        fixed. 
 SIDE EFFECTS:
       
 NOTES:
       The density profiles fit here are the following:

          \rho = \rho_a/r^\beta/(r+a)^\alpha

       We actually fit to the log of this,
          log(\rho) = \log(\rho_a) - \beta \log(r) 
                          - \alpha \log(r+a).

       The input parmaters are used as follows:
            
          Params(0) = \rho_a
          Params(1) = a
          Params(2) = \alpha
          Params(3) = \beta.
       HOWEVER, if Params(3) is not passed, we set \beta=1, and if
       Params(2) is not passed, we set \alpha=2.
       
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       log_nfw_fit
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/profiles/fit_nfw.pro)


FIT_NFW[2]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       FIT_NFW
 PURPOSE:
       Fit an NFW profile to the density profile of a dark matter
       halo. 
 CATEGORY:
       Nbody/profile
 CALLING SEQUENCE:
       fitted = fit_nfw( r, den, fit_param, fit_errors, weight )
 INPUTS:
       r      -- Radii at which the density is tabulated.
       den    -- Tabulated density to which the NFW profile should be
                 fit. 
       fit_param -- On input, a guess as to the scale radius and
                    characteristic density of the profile.  ALSO USED
                    FOR OUTPUT.
       weight -- Vector of weights to be used in fitting.  Default is
                 same weight (1.0) for each point.
 KEYWORD PARAMETERS:
       /FIXED_MASS -- Set this keyword to require that the total mass
                      of the halo be the number of particles.  This
                      reduces the number of parameters being fit to
                      one, the scale radius.
 OUTPUTS:
       fitted  -- The best fit density profile, evaluated at the
                  points r.
       fit_param -- On output, the parameters of the fit.   ALSO USED
                    FOR INPUT. 
        fit_errors -- The standard deviations in the fits parameters,
                      as determined by the CURVEFIT procedure.
 COMMON BLOCKS:
       COMMON nfw_fit_params, UseFixedParmsCmn, BetaFixed, AlphaFixed
       UseFixedParms -- Set to one if this routine is to use the
                        fixed values of alpha and beta specified in
                        the common block.
       BetaFixed     -- Value of Beta to use if Beta is to be held
                        fixed. 
       AlphaFixed    -- Value of Beta to use if Beta is to be held
                        fixed. 
 SIDE EFFECTS:
       
 NOTES:
       The density profiles fit here are the following:

          \rho = \rho_a/r^\beta/(r+a)^\alpha

       We actually fit to the log of this,
          log(\rho) = \log(\rho_a) - \beta \log(r) 
                          - \alpha \log(r+a).

       The input parmaters are used as follows:
            
          Params(0) = \rho_a
          Params(1) = a
          Params(2) = \alpha
          Params(3) = \beta.
       HOWEVER, if Params(3) is not passed, we set \beta=1, and if
       Params(2) is not passed, we set \alpha=2.
       
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       log_nfw_fit
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/profiles/my_nfw_fit.pro)


FIT_NFW_VCIRC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       FIT_NFW_VCIRC
 PURPOSE:
       Fit an NFW profile to the rotation curve of a dark matter
       halo. 
 CATEGORY:
       Nbody/profile
 CALLING SEQUENCE:
       fitted = fit_nfw_vcirc( r, vcirc, fit_param, fit_errors, weight )
 INPUTS:
       r      -- Radii at which the density is tabulated.
       vcirc  -- Tabulated circular velocity to which the NFW profile
                 should be fit.
       fit_param -- On input, a guess as to the scale radius and
                    characteristic density of the profile.  ALSO USED
                    FOR OUTPUT.
       weight -- Vector of weights to be used in fitting.  Default is
                 same weight (1.0) for each point.
 KEYWORD PARAMETERS:
 OUTPUTS:
       fitted  -- The best fit velocity profile, evaluated at the
                  points r.
       fit_param -- On output, the parameters of the fit.   ALSO USED
                    FOR INPUT. 
       fit_errors -- The standard deviations in the fits parameters,
                      as determined by the CURVEFIT procedure.
 COMMON BLOCKS:
       COMMON nfw_fit_params, UseFixedParmsCmn, BetaFixed, AlphaFixed
       UseFixedParms -- Set to one if this routine is to use the
                        fixed values of alpha and beta specified in
                        the common block.
       BetaFixed     -- Value of Beta to use if Beta is to be held
                        fixed. 
       AlphaFixed    -- Value of Beta to use if Beta is to be held
                        fixed. 
 SIDE EFFECTS:
       
 NOTES:
       The circular velocity fit here is:

         V_c = B \sqrt{(\ln{1+r/a} - r/(r+a))/r},

       which corresponds to the density profile:

         \rho = B^2/(4\pi)/r/(r+a)^2.


       The input parmaters are used as follows:
            
          Params(0) = \rho_a
          Params(1) = a
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       nfw_vcirc_fit
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/profiles/fit_nfw_vcirc.pro)


LOG_NFW_FIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       LOG_NFW_FIT
 PURPOSE:
       Fit log density profile to nbody data.
 CATEGORY:
       NBody/profile
 CALLING SEQUENCE:
       log_nfw_fit, x, params, logden, logdenderiv
 INPUTS:
       X           -- Positions at which density profile is to be
                      evaluated. 
       Params      -- Values of fitting parameters for density
                      profile. See Notes below for details.
 KEYWORD PARAMETERS:
 OUTPUTS:
       LogDen      -- Log of the density evaluated at X.
       LogDenDeriv -- Derivative of the log of the density evaluated
                      at X.
 COMMON BLOCKS:
       COMMON nfw_fit_params, UseFixedParmsCmn, BetaFixed, AlphaFixed
       UseFixedParms -- Set to one if this routine is to use the
                        fixed values of alpha and beta specified in
                        the common block.
       BetaFixed     -- Value of Beta to use if Beta is to be held
                        fixed. 
       AlphaFixed    -- Value of Beta to use if Beta is to be held
                        fixed. 
 SIDE EFFECTS:
       
 NOTES:
       The density profiles fit here are the following:

          \rho = \rho_a/r^\beta/(r+a)^\alpha

       We actually fit to the log of this,
          log(\rho) = \log(\rho_a) - \beta \log(r) 
                          - \alpha \log(r+a).

       The input parmaters are used as follows:
            
          Params(0) = \rho_a
          Params(1) = a
          Params(2) = \alpha
          Params(3) = \beta.
       HOWEVER, if Params(3) is not passed, we set \beta=1, and if
       Params(2) is not passed, we set \alpha=2.
       
       UNLESS, that is, UseFixedParmsCmn is nonzero, then use the
       values of \alpha and \beta in the common block, but do not
       allow them to vary.
 EXAMPLE:
       x=2.*findgen(100)/99.+.01 & Parmas=[10.,.2,2.5,1.1]
       log_nfw_fit,x, Params, Den
       returns Den evaluated at X with \rho_a=10., a=.2, \alpha=2.5,
       \beta=1.1

       x=2.*findgen(100)/99.+.01 & Parmas=[10.,.2]
       log_nfw_fit,x, Params, Den
       returns Den evaluated at X with \rho_a=10., a=.2, \alpha=2.,
       \beta=1. 
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/profiles/log_nfw_fit.pro)


NFW_DELTA_C

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       NFW_DELTA_C
 PURPOSE:
       Return the characteristic density for NFW profile, given
       concentration, c.
 CATEGORY:
       nbody/profiles
 CALLING SEQUENCE:
       delta_c = nfw_delta_c( c )
 INPUTS:
       c    --  Concentration parameter.
 KEYWORD PARAMETERS:
       
 OUTPUTS:
       delta_c -- Characteristic density for given value of c.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       The formula for \delta_c is (NFW, ApJ v.462, p.563):

       \delta_c = \frac{200}{3} \frac{c^3}{\ln{1+c} - c/(c+1)}

 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/profiles/nfw_delta_c.pro)


NFW_DENSITY

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       NFW_DENSITY
 PURPOSE:
       Return density as a function of radius in NFW halo model.
 CATEGORY:
       profiles
 CALLING SEQUENCE:
       Density = nfw_density( Radius, ScaleRadius )
 INPUTS:
       Radius      -- Radii at which the density is desired.
       ScaleRadius -- Scale radius that enters into model, in same
                      units as Radius.
 KEYWORD PARAMETERS:
       
 OUTPUTS:
       Density        -- Density evaluated at input radii.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       The density is normalized by the mean density within radius
       one. 
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/profiles/nfw_density.pro)


NFW_GEN_FROM_FIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       NFW_GEN_FROM_FIT
 PURPOSE:
       Generate the desired profile (mass, rotation, or density) from
       a fit to one of them.
 CATEGORY:
       Nbody/profile
 CALLING SEQUENCE:
       func = nfw_gen_from_fit( R, Params )
 INPUTS:
       R      -- Radii at which to evaluate the profile.
       Params -- Fitting parameters which describe the fit.  It is a
                 two element vector--see Notes for a description of
                 the elements.
 KEYWORD PARAMETERS:
       /DENSITY -- Set to return the NFW density profile (DEFAULT).
       /MASS    -- Set to return the NFW mass profile.
       /VCIRC   -- Set to return the NFW cirvular velocity profile.
       /FROM_DENSITY -- Set if fit params are to NFW density profile
                        (DEFAULT). 
       /FROM_MASS    -- Set if fit params are to NFW mass profile (DEFAULT).
       /FROM_VCIRC   -- Set if fit params are to NFW circular
                        velocity profile.
 OUTPUTS:
       func -- either the NFW density, mass or circular velocity,
               depending on which keyword has been set, evaluted at R.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       The input parameters in Params are:

            Params(0) - Normaliztaion factor (i.e. characteristic
                        density or mass or velocity), from a fit to
                        an NFW profile.
            Params(1) - NFW scale radius, in the same units as R.
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/profiles/nfw_gen_from_fit.pro)


NFW_MASS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       NFW_MASS
 PURPOSE:
       Return mass as a function of radius in NFW halo model.
 CATEGORY:
       profiles
 CALLING SEQUENCE:
       Mass = nfw_mass( Radius, ScaleRadius )
 INPUTS:
       Radius      -- Radii at which the mass is desired.
       ScaleRadius -- Scale radius that enters into model, in same
                      units as Radius.
 KEYWORD PARAMETERS:
       
 OUTPUTS:
       Mass        -- Mass evaluated at input radii.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       The mass is normalized so that the mass within radius one is
       one. 
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/profiles/nfw_mass.pro)


NFW_VCIRC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       NFW_VCIRC
 PURPOSE:
       Return circular velocity as a function of radius in NFW halo
       model. 
 CATEGORY:
       profiles
 CALLING SEQUENCE:
       Vcirc = nfw_vcirc( Radius, ScaleRadius )
 INPUTS:
       Radius      -- Radii at which the vcirc is desired.
       ScaleRadius -- Scale radius that enters into model, in same
                      units as Radius.
 KEYWORD PARAMETERS:
       
 OUTPUTS:
       Vcirc        -- Vcirc evaluated at input radii.
 COMMON BLOCKS:
 SIDE EFFECTS:
 NOTES:
       The circular velocity returned is normalized to the circular
       velocity at radius one.
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/profiles/nfw_vcirc.pro)


NFW_VCIRC_FIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       NFW_VCIRC_FIT
 PURPOSE:
       Fit NFW circular velocity profile to rotation curve.
 CATEGORY:
       NBody/profile
 CALLING SEQUENCE:
       nfw_vcirc_fit, X, Params, Vcirc, VcircDeriv
 INPUTS:
       X           -- Positions at which density profile is to be
                      evaluated. 
       Params      -- Values of fitting parameters for density
                      profile. See Notes below for details.
 KEYWORD PARAMETERS:
 OUTPUTS:
       Vcirc       -- Circular velocity evaluated at X.
       VcircDeriv  -- Derivative of the circular velocity with
                      respect to the fit parameters, evaluated at X. 
 COMMON BLOCKS:
       COMMON nfw_fit_vcirc_params, UseFixedParmsCmn, BetaFixed, AlphaFixed
       UseFixedParms -- Set to one if this routine is to use the
                        fixed values of alpha and beta specified in
                        the common block.
       BetaFixed     -- Value of Beta to use if Beta is to be held
                        fixed. 
       AlphaFixed    -- Value of Beta to use if Beta is to be held
                        fixed. 
 SIDE EFFECTS:
       
 NOTES:
       The circular velocity fit here is:

         V_c = B \sqrt{(\ln{1+r/a} - r/(r+a))/r},

       which corresponds to the density profile:

         \rho = B^2/(4\pi)/r/(r+a)^2.


       The input parmaters are used as follows:
            
          Params(0) = \rho_a
          Params(1) = a
 EXAMPLE:
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/profiles/nfw_vcirc_fit.pro)


[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       
 PURPOSE:
       
 CATEGORY:
       
 CALLING SEQUENCE:
       
 INPUTS:
       
 KEYWORD PARAMETERS:
       
 OUTPUTS:
       
 COMMON BLOCKS:
       
 SIDE EFFECTS:
       
 NOTES:
       We are fitting:
   
        \rho = \rho_f/(a+x)^\alpha
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/profiles/log_andi_bad.pro)


[2]

[Previous Routine] [List of Routines]
 NAME:
       
 PURPOSE:
       
 CATEGORY:
       
 CALLING SEQUENCE:
       
 INPUTS:
       
 KEYWORD PARAMETERS:
       
 OUTPUTS:
       
 COMMON BLOCKS:
       
 SIDE EFFECTS:
       
 NOTES:
       We are fitting:
   
        \rho = \rho_f/(a+x)/(x^2+a^2)

       for \rho_f and a.
 EXAMPLE:
       
 LIBRARY FUNCTIONS CALLED:
       
 MODIFICATION HISTORY:
       $Id$
       $Log$
 RELEASE:
       $Name$

(See /deep0/marc/idlshare/Nbody/profiles/log_andi_fit.pro)