Provides some useful math functions.
|
static double | approximateErf (double x) |
| Returns an approximation for the error function of x. More...
|
|
static double | approximateInverseErf (double x) |
| Returns an approximation for the inverse of the error function. More...
|
|
static double | bend (double x) |
| The bend function has a slope of 1 at very negative values of x, and 2 at very positive values of x, and a smooth transition in between. More...
|
|
static double | bendDerivative (double x) |
| The derivative of the bend function. More...
|
|
static double | bendInverse (double y) |
| The inverse of the bend function. More...
|
|
static double | functionInverse (double(*func)(const double *params, double x), const double *params, double y, double x1, double x2, double epsilon) |
| Inverts a function using linear interpolation to iteratively find the target output. Assumes the function is monotonic in the region it will explore func gives the function to invert. params specifies parameters to the function. y is the target output. x1 and x2 are two initial estimates to seed the search. The search is complete when the output is within epsilon of the target. Throws an exception if progress stalls. More...
|
|
static double | fuzzy (double x, double y, double alpha) |
| If false = 0.0 and true = 1.0, then not(x) = -x = fuzzy(x, 0.0, 0), and(x, y) = fuzzy(x, y, 1.0), or(x, y) = -fuzzy(x, y, 0.0), xor(x, y) = -fuzzy(x, y, 0.5), nand(x, y) = -fuzzy(x, y, 1.0), nor(x, y) = fuzzy(x, y, 0.0), nxor(x, y) = fuzzy(x, y, 0.5). More...
|
|
static double | gamma (double x) |
| The gamma function. More...
|
|
static double | gaussian (double x) |
| The gaussian function. More...
|
|
static double | incompleteBeta (double x, double a, double b, int steps) |
| Estimates the Incomplete Beta function by "integrating" with the specified number of steps. More...
|
|
static double | integrate (MathFunc pFunc, double dStart, double dEnd, int nSteps, void *pThis) |
| Integrates the specified function from dStart to dEnd. More...
|
|
static double | interpolatingFunc (double x) |
| A soft step function with a very high degree of continuity at 0 and 1. More...
|
|
static double | logFactorial (int x) |
| returns log(x!) More...
|
|
static double | logGamma (double x) |
| returns log(Gamma(x)) More...
|
|
static double | logistic (double x) |
| The logistic sigmoid function. More...
|
|
static double | logisticDerivative (double x) |
| This evaluates the derivative of the sigmoid function. More...
|
|
static double | logisticInverse (double y) |
| This is the inverse of the logistic sigmoid function. More...
|
|
static double | mackeyGlass (double x, double xt, double beta=0.2, double gamma=0.1, double n=10) |
| Given x(t), returns x(t + 1) in the Mackey-Glass series. x is x(t), xt is x(t - TAO), and beta, gamma, and n are other Mackey-Glass parameters. Call this in a loop to get a series. More...
|
|
static double | nChooseK (unsigned int n, unsigned int k) |
| Returns the value of n choose k. More...
|
|
static void | newtonPolynomial (const double *pTValues, double *pFuncValues, int nPoints) |
| This implements Newton's method for determining a polynomial f(t) that goes through all the control points pFuncValues at pTValues. (You could then convert to a Bezier curve to get a Bezier curve that goes through those points.) The polynomial coefficients are put in pFuncValues in the form c0 + c1*t + c2*t*t + c3*t*t*t + ... More...
|
|
static void | pascalsTriangle (size_t *pOutRow, size_t nRow) |
| Returns the specified row from Pascal's triangle. pOutRow must be big enough to hold nRow + 1 elements Row 0 1 Row 1 1 1 Row 2 1 2 1 Row 3 1 3 3 1 Row 4 1 4 6 4 1 etc. such that each value is the sum of its two parents. More...
|
|
static double | productLog (double x) |
| Computes the y where x = y*exp(y). This is also known as the Omega function, or the Lambert W function. x must be > -1/e. More...
|
|
static double | signedRoot (double x) |
| Returns sign(x) * sqrt(ABS(x)) More...
|
|
static double | softExponential (double alpha, double x) |
| If alpha=1, returns exp(x). If alpha = 0, returns x. If alpha = -1, returns log_e(x). Alpha can be any continuous value from -1 to 1 to continuously interpolate among these functions. More...
|
|
static double | softStep (double x, double steepness) |
| Calculates a function that always passes through (0, 0), (1, 1), and (0.5, 0.5). The slope at (0.5, 0.5) will be "steepness". If steepness is > 1, then the slope at (0, 0) and (1, 1) will be 0. If steepness is < 1, the slope at (0, 0) and (1, 1) will be infinity. If steepness is exactly 1, the slope will be 1 at those points. softStep(1/x, 2) = PI*cauchy(x-1). More...
|
|
static void | test () |
| Performs unit tests for this class. Throws an exception if there is a failure. More...
|
|
static double | tTestAlphaValue (size_t v, double t) |
| Computes the p-value from the degrees of freedom, and the t-value obtained from a T-test. More...
|
|
static double | wilcoxonPValue (int n, double t) |
| This computes the Wilcoxon P-value assuming n is large enough that the Normal approximation will suffice. More...
|
|
static double GClasses::GMath::fuzzy |
( |
double |
x, |
|
|
double |
y, |
|
|
double |
alpha |
|
) |
| |
|
static |
If false = 0.0 and true = 1.0, then not(x) = -x = fuzzy(x, 0.0, 0), and(x, y) = fuzzy(x, y, 1.0), or(x, y) = -fuzzy(x, y, 0.0), xor(x, y) = -fuzzy(x, y, 0.5), nand(x, y) = -fuzzy(x, y, 1.0), nor(x, y) = fuzzy(x, y, 0.0), nxor(x, y) = fuzzy(x, y, 0.5).