BCMath Namespace Reference


Detailed Description

Some useful mathematic functions.

Author:
Daniel Kollar

Kevin Kröninger

Version:
1.0
Date:
08.2008 A namespace which encapsulates some mathematical functions necessary for BAT.


Functions

double ApproxBinomial (int n, int k, double p)
double ApproxLogFact (double x)
double LogApproxBinomial (int n, int k, double p)
double LogBinomFactor (int n, int k)
double LogBreitWignerNonRel (double x, double mean, double Gamma, bool norm=false)
double LogFact (int n)
double LogGaus (double x, double mean=0, double sigma=1, bool norm=false)
double LogNoverK (int n, int k)
double LogPoisson (double x, double par)
double Max (double x, double y)
int Max (int x, int y)
double Min (double x, double y)
int Min (int x, int y)
int Nint (double x)
double rms (int n, const double *a)


Function Documentation

double BCMath::ApproxBinomial ( int  n,
int  k,
double  p 
)

Calculates Binomial probability using approximations for factorial calculations if calculation for number greater than 100 required using the BCMath::ApproxLogFact function.

Definition at line 62 of file BCMath.cxx.

double BCMath::ApproxLogFact ( double  x  ) 

Calculates natural logarithm of the n-factorial (n!) using approximation log(n!) = n*log(n) - n + .5*log(2*pi*n) -1/(12*x) if n > 100. If n<=100 it uses BCMath::LogFact to calculate it exactly.

Definition at line 120 of file BCMath.cxx.

double BCMath::LogApproxBinomial ( int  n,
int  k,
double  p 
)

Calculates natural logarithm of the Binomial probability using approximations for factorial calculations if calculation for number greater than 100 required using the BCMath::ApproxLogFact function.

Definition at line 71 of file BCMath.cxx.

double BCMath::LogBinomFactor ( int  n,
int  k 
)

Calculates natural logarithm of the Binomial factor "n over k" using approximations for factorial calculations if calculation for number greater than 100 required using the BCMath::ApproxLogFact function. Even for large numbers the calculation is performed precisely, if n-k < 5

Definition at line 89 of file BCMath.cxx.

double BCMath::LogBreitWignerNonRel ( double  x,
double  mean,
double  Gamma,
bool  norm = false 
)

Definition at line 230 of file BCMath.cxx.

double BCMath::LogFact ( int  n  ) 

Calculates natural logarithm of the n-factorial (n!)

Definition at line 134 of file BCMath.cxx.

double BCMath::LogGaus ( double  x,
double  mean = 0,
double  sigma = 1,
bool  norm = false 
)

Calculate the natural logarithm of a gaussian function with mean and sigma. If norm=true (default is false) the result is multiplied by the normalization constant, i.e. divided by sqrt(2*Pi)*sigma.

Definition at line 16 of file BCMath.cxx.

double BCMath::LogNoverK ( int  n,
int  k 
)

Calculates natural logarithm of the Binomial factor "n over k".

Definition at line 147 of file BCMath.cxx.

double BCMath::LogPoisson ( double  x,
double  par 
)

Calculate the natural logarithm of a poisson distribution.

Definition at line 45 of file BCMath.cxx.

double BCMath::Max ( double  x,
double  y 
) [inline]

Definition at line 92 of file BCMath.h.

int BCMath::Max ( int  x,
int  y 
) [inline]

Returns the "greater or equal" of two numbers

Definition at line 89 of file BCMath.h.

double BCMath::Min ( double  x,
double  y 
) [inline]

Definition at line 101 of file BCMath.h.

int BCMath::Min ( int  x,
int  y 
) [inline]

Returns the "less or equal" of two numbers

Definition at line 98 of file BCMath.h.

int BCMath::Nint ( double  x  ) 

Returns the nearest integer of a double number.

Definition at line 177 of file BCMath.cxx.

double BCMath::rms ( int  n,
const double *  a 
)

Returns the rms of an array.

Definition at line 206 of file BCMath.cxx.


Generated on Mon Sep 15 17:04:30 2008 for Bayesian Analysis Toolkit by  doxygen 1.5.6