18 int quadratic(
double a,
double b,
double c,
double& x1,
double& x2);
21 int cubic(
double a,
double b,
double c,
double d,
double x[3]);
23 double pythag(
double a,
double b);
27 double Sinc(
double x);
35 double dChoose(
unsigned int n,
unsigned int k);
37 double dLogChoose(
unsigned int n,
unsigned int k);
41 double Gamma(
double x);
47 double Beta(
double a,
double b);
49 double LogBeta(
double a,
double b);
58 inline int FuzzySign(
double x,
double eps=dEpsilon) {
return (x>eps?1:(x<-eps?-1:0)); }
66 int quadratic(
float a,
float b,
float c,
float& x1,
float& x2);
67 int cubic(
float a,
float b,
float c,
float d,
float x[3]);
68 float pythag(
float a,
float b);
72 float fFactorial(
unsigned int n);
73 float fLogFactorial(
unsigned int n);
74 float fChoose(
unsigned int n,
unsigned int k);
75 float fLogChoose(
unsigned int n,
unsigned int k);
80 float Beta(
float a,
float b);
86 inline int FuzzySign(
float x,
float eps=fEpsilon) {
return (x>eps?1:(x<-eps?-1:0)); }
88 inline bool OpposingSigns_neg(
float a,
float b) {
return (a<=fZero) != (b<=fZero); }
109 for(
unsigned int i=1;i<=n;i++) x*=i;
117 for(
unsigned int j=0;j<k;j++) fact*=(n-j);
122 inline unsigned int Choose(
unsigned int n,
unsigned int k)
128 inline Real rFactorial(
unsigned int n) {
return dFactorial(n); }
129 inline Real LogFactorial(
unsigned int n) {
return dLogFactorial(n); }
130 inline Real rChoose(
unsigned int n,
unsigned int k) {
return dChoose(n,k); }
131 inline Real LogChoose(
unsigned int n,
unsigned int k) {
return dLogChoose(n,k); }
int FuzzySign(double x, double eps=dEpsilon)
Returns -1 if x<eps, 0 if |x|<=eps, 1 if x>eps.
Definition: misc.h:58
Common math typedefs, constants, functions.
int cubic(double a, double b, double c, double d, double x[3])
Definition: misc.cpp:70
double dChoose(unsigned int n, unsigned int k)
Computes n choose k in double precision.
Definition: misc.cpp:166
double LogBeta(double a, double b)
Computes log B(a,b)
Definition: misc.cpp:173
double Beta(double a, double b)
Computes the beta function B(a,b)
Definition: misc.cpp:172
T IntegerPower(const T x, int i)
Calculates x^i where i is an integer (in O(log i) time)
Definition: misc.h:94
unsigned int Choose(unsigned int n, unsigned int k)
Returns `n choose k' = n!/k!(n-k)! in O(k) time.
Definition: misc.h:122
double NormalizedIncompleteBeta(double a, double b, double x)
Computes the normalized incomplete beta function B(a,b,x)
Definition: misc.cpp:174
unsigned int Factorial(unsigned int n)
Returns n! in O(n) time.
Definition: misc.h:105
double Sinc(double x)
Computes the sinc function sin(x)/x (stable for small x)
Definition: misc.cpp:119
double TaylorCoeff(double x, unsigned int n)
Computes the taylor series coefficient x^n/n!
Definition: misc.cpp:168
bool OpposingSigns_neg(double a, double b)
Same as above, but treats 0 as a negative number.
Definition: misc.h:63
double Sinc_Dx(double x)
Computes the derivative of the sinc function.
Definition: misc.cpp:130
unsigned int FactorialTruncated(unsigned int n, unsigned int k)
Returns n!/(n-k)! in O(k) time.
Definition: misc.h:114
double pythag_leg(double a, double c)
Returns b where a^2+b^2=c^2.
Definition: misc.cpp:111
double dLogChoose(unsigned int n, unsigned int k)
Computes the log of n choose k.
Definition: misc.cpp:167
bool OpposingSigns_pos(double a, double b)
Definition: misc.h:61
int quadratic(double a, double b, double c, double &x1, double &x2)
Definition: misc.cpp:20
double Gamma(double x)
Computes the gamma function.
Definition: misc.cpp:169
double dLogFactorial(unsigned int n)
Computes the log of the factorial of n.
Definition: misc.cpp:165
Contains all definitions in the Math package.
Definition: WorkspaceBound.h:12
double dFactorial(unsigned int n)
Computes the factorial of n, with double precision.
Definition: misc.cpp:164
double ErfComplimentary(double x)
Computes the complimentary error function?
Definition: misc.cpp:176
double pythag(double a, double b)
Returns c where a^2+b^2=c^2.
Definition: misc.cpp:99
double Erf(double x)
Computes the error function.
Definition: misc.cpp:175
double LogGamma(double x)
Computes log gamma(x)
Definition: misc.cpp:170
double GammaInv(double x)
Computes 1 / gamma(x)
Definition: misc.cpp:171