Abstract class with some extra useful math functions. More...
Static Public Member Functions | |
static final double | log2 (double x) |
Computes the logarithm of base 2. More... | |
static final int | sq (int x) |
Square an integer number. More... | |
static final double | sq (double x) |
Square a double. More... | |
static final double | cube (double x) |
cube a double number More... | |
static final int | exp2 (int x) |
Calculate x to the power of 2 where x is an integer. More... | |
static final double | exp2 (double x) |
Calculate x to the power of 2 where x is a double. More... | |
static final double | volumeOfASphere (double r) |
Calculate the volume of a sphere with radius r. More... | |
static final double | volumeOfACylinder (double r, double l) |
Calculate the volume of a cylinder with radius r and length l. More... | |
static final double | areaOfACircle (double r) |
Calculate the area of circle with radius r. More... | |
static final double | radiusOfASphere (double v) |
Calculate the radius of a sphere with volume v. More... | |
static final double | radiusOfASphere (double v, double lZ) |
Calculate the radius of a sphere with volume v assuming repetition along 3rd dimension. More... | |
static final double | radiusOfACylinder (double v, double l) |
Returns the radius of a cylinder with volume v and length l. More... | |
static final double | pointDistance (double x1, double y1, double z1, double x2, double y2, double z2) |
Calculate the distance between 2 points for points specified in X,Y,Z. More... | |
static final double | pointDistance (ContinuousVector p1, ContinuousVector p2) |
Calculate the distance between 2 points for points specified as continuous vectors. More... | |
static double | gammaCorrection (double v, double gamma) |
Perform gamma correction of value v: v^gamma check that v is in the [0,* 1] range. More... | |
static double | max (double a, double b) |
Return the maximum among 2 doubles. More... | |
static double | min (double a, double b) |
Return the minimum among 2 doubles. More... | |
static double | max (double[] a) |
Return the maximum entry in a double array. More... | |
static double | average (double[] a) |
Return the average entry in a double array. More... | |
static double | min (double[] a) |
Return the minimum entry in a double array. More... | |
static double | maxSquare (double a, double b) |
Return the maximum square among 2 doubles. More... | |
static boolean | sameSign (double a, double b) |
Determine if two doubles are the same sign. More... | |
static double | sumVector (double vector[]) |
Return the sum of a vector. More... | |
static String | toString (double value, boolean scFormat) |
Output a double value as a string, in a particular decimal format. More... | |
static double | getUniRand () |
Return a uniform distributed random number between 0 and 1. More... | |
static int | getUniRandInt (int lBound, int hBound) |
Return an integer random number between two set bounds. More... | |
static double | getUniRand (double lBound, double hBound) |
Return a double random number between two set bounds. More... | |
static double | getNormRand () |
Return a truncated N(0,1) distributed random number. Normal distributed random numbers are truncated at 2*sigma to prevent extreme values. More... | |
static double | getExp2Rand () |
Return 2 to the power of a uniformly distributed random number in [0,1]. More... | |
static double | deviateFrom (double mu, double sigma) |
Randomise a value with a gaussian distribution in a range fixed by the ratio sigma. More... | |
static double | mean (double[] v) |
Calculate the mean of a double array v. More... | |
static double | stddev (double[] v) |
Calculate the standard deviation of a double array v. More... | |
Static Public Attributes | |
static java.text.DecimalFormat | dfSc = new DecimalFormat("000.###E0") |
static java.text.DecimalFormat | dfUs = new DecimalFormat("########.##") |
static Random | random |
Abstract class with some extra useful math functions.
Abstract class with some extra useful math functions
|
static |
Calculate the area of circle with radius r.
Calculate the area of circle with radius r
r | Radius of the circle |
|
static |
Return the average entry in a double array.
Return the average entry in a double array
a | Vector of doubles |
|
static |
cube a double number
cube a double number
x | : value to cube |
|
static |
Randomise a value with a gaussian distribution in a range fixed by the ratio sigma.
Randomise a value with a gaussian distribution in a range fixed by the ratio sigma. If mu = 1 and sigma = .1, the results form a truncated gaussian distribution between 0.8 and 1.2 (2*sigma interval)
mu | mean value |
sigma | standard deviation |
|
static |
Calculate x to the power of 2 where x is an integer.
Calculate x to the power of 2 where x is an integer
x | Number to be raised to power of 2 |
|
static |
Calculate x to the power of 2 where x is a double.
Calculate x to the power of 2 where x is an double
x | Number to be raised to power of 2 |
|
static |
Perform gamma correction of value v: v^gamma check that v is in the [0,* 1] range.
Perform gamma correction of value v: v^gamma check that v is in the [0,* 1] range
v | Value to check |
gamma | Gamma Constant |
|
static |
Return 2 to the power of a uniformly distributed random number in [0,1].
Return 2 to the power of a uniformly distributed random number in [0,1]
|
static |
Return a truncated N(0,1) distributed random number. Normal distributed random numbers are truncated at 2*sigma to prevent extreme values.
Return a truncated N(0,1) distributed random number. Normal distributed random numbers are truncated at 2*sigma to prevent extreme values.
|
static |
Return a uniform distributed random number between 0 and 1.
Return a uniform distributed random number between 0 and 1
|
static |
Return a double random number between two set bounds.
Return a double random number between two set bounds
lBound | Lower bound |
hBound | Upper bound |
|
static |
Return an integer random number between two set bounds.
Return an integer random number between two set bounds
lBound | Lower bound |
hBound | Upper bound |
|
static |
Computes the logarithm of base 2.
Computes the logarithm of base 2
x | a number greater than 0.0 |
|
static |
Return the maximum among 2 doubles.
Return the maximum among 2 doubles
a | Double 1 |
b | Double 2 |
|
static |
Return the maximum entry in a double array.
Return the maximum entry in a double array
a | Vector of doubles |
|
static |
Return the maximum square among 2 doubles.
Return the maximum square among 2 doubles
a | Double 1 |
b | Double 2 |
|
static |
Calculate the mean of a double array v.
Calculate the mean of a double array v
v | The double array |
|
static |
Return the minimum among 2 doubles.
Return the minimum among 2 doubles
a | Double 1 |
b | Double 2 |
|
static |
Return the minimum entry in a double array.
Return the minimum entry in a double array
a | Vector of doubles |
|
static |
Calculate the distance between 2 points for points specified in X,Y,Z.
Calculate the distance between 2 points for points specified in X,Y,Z
x1 | X coordinate of point 1 |
y1 | Y coordinate of point 1 |
z1 | Z coordinate of point 1 |
x2 | X coordinate of point 2 |
y2 | Y coordinate of point 2 |
z2 | Z coordinate of point 2 |
|
static |
Calculate the distance between 2 points for points specified as continuous vectors.
Calculate the distance between 2 points for points specified as continuous vectors
p1 | Point 1 |
p2 | Point 2 |
|
static |
Returns the radius of a cylinder with volume v and length l.
Returns the radius of a cylinder with volume v and length l
v | Volume of the cylinder |
l | Length of the cylinder |
|
static |
Calculate the radius of a sphere with volume v.
v | Volume of the sphere |
|
static |
Calculate the radius of a sphere with volume v assuming repetition along 3rd dimension.
Calculate the radius of a sphere with volume v assuming repetition along 3rd dimension
v | Volume of the sphere |
lZ | Omitted dimension |
|
static |
Determine if two doubles are the same sign.
Determine if two doubles are the same sign
a | Double 1 |
b | Double 2 |
|
static |
Square an integer number.
Square an integer number
x | value to square |
|
static |
Square a double.
Square a double
x,: | value to square |
|
static |
Calculate the standard deviation of a double array v.
Calculate the standard deviation of a double array v
v | The double array |
|
static |
Return the sum of a vector.
Return the sum of a vector
vector | Vector to sum |
|
static |
Output a double value as a string, in a particular decimal format.
Output a double value as a string, in a particular decimal format
value | Value to be output |
scFormat | The decimal format to use |
|
static |
Calculate the volume of a cylinder with radius r and length l.
Calculate the volume of a cylinder with radius r and length l
r | Radius of the cylinder |
l | Length of the cylinder |
|
static |
Calculate the volume of a sphere with radius r.
Calculate the volume of a sphere with radius r
r | Radius of the sphere |
|
static |
One option for decimal of decimals when these are written to the screen
|
static |
Second option for decimal of decimals when these are written to the screen
|
static |
Random number generator