public class DasMath
extends java.lang.Object
Constructor and Description |
---|
DasMath()
Creates a new instance of DasMath
|
Modifier and Type | Method and Description |
---|---|
static double |
biggerOf(double x1,
double x2)
returns the bigger number of two numbers
|
static double |
exp10(double x) |
static double |
exp10(int x) |
static double[] |
findex(double[] datax,
double[] x)
Returns the "floating point indeces" of x within array datax.
|
static double |
findex(double[] datax,
double x,
int guess) |
static double |
gcd(double[] A,
double error)
Returns the greatest common divisor of a group of numbers.
|
static double |
interpolate(double[] datay,
double findex)
Interpolate just one point
|
static double[] |
interpolate(double[] datay,
double[] findex)
interpolate an array of points.
|
static double |
log10(double x) |
static void |
main(java.lang.String[] args) |
static double |
max(double[] A)
return the maximum of the list
|
static double |
mean(double[] A)
return the mean of the list.
|
static double |
median(double[] A)
return the median of the list length N, which is the value at index N/2 of
the sorted list.
|
static double |
min(double[] A)
return the minimum of the list
|
static double |
modp(double x,
double t)
just like modulo (%) function, but negative numbers return positive phase.
|
static int |
modp(int x,
int t)
just like modulo (%) function, but negative numbers return positive phase.
|
static double |
roundNFractionalDigits(double x,
int n)
round the decimal to the number of fractional decimal places.
|
static double |
roundNSignificantDigits(double x,
int n)
Round the double to n significant digits by removing the exponent to make the number order one,
then rounding the mantissa, then replacing the exponent.
|
static double[] |
sort(double[] A)
return a sorted version of the array.
|
static double |
tanh(double x) |
public static double log10(double x)
public static double exp10(double x)
public static double exp10(int x)
public static double roundNFractionalDigits(double x, int n)
DasMath.roundNFractionalDigits(1.2345678,3)==1.23
Note the name implies that there will be three decimals in the fractional
part, but this implementation will return only two.x
- a doublen
- number of decimal placesroundNSignificantDigits(double, int)
,
https://github.com/autoplot/dev/blob/master/demos/2023/20230910/roundNDigits.jy
public static double roundNSignificantDigits(double x, int n)
x
- a doublen
- number of decimal placesroundNFractionalDigits(double, int)
,
https://github.com/autoplot/dev/blob/master/demos/2023/20230910/roundNDigits.jy
public static double tanh(double x)
public static double interpolate(double[] datay, double findex)
public static double[] interpolate(double[] datay, double[] findex)
public static double[] findex(double[] datax, double[] x)
public static final double findex(double[] datax, double x, int guess)
public static void main(java.lang.String[] args)
public static double modp(double x, double t)
x
- the numeratort
- the devisorpublic static int modp(int x, int t)
x
- the numeratort
- the devisorpublic static double biggerOf(double x1, double x2)
x1
- a numberx2
- a numberpublic static double gcd(double[] A, double error)
A
- the array of numberserror
- the limit of the error to deal with numerical noisepublic static double mean(double[] A)
A
- public static double median(double[] A)
A
- the list of numberspublic static double max(double[] A)
A
- the list of numberspublic static double min(double[] A)
A
- the listpublic static double[] sort(double[] A)
A
-