public final class Util
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
static double |
defaultNumericalPrecision |
The default precision for numerical analysis.
|
static double |
LOG10 |
|
static double |
SQRT2PI |
| Modifier and Type | Method | Description |
|---|---|---|
static int |
checkSorting(double[] array) |
Checks if an array is sorted.
|
static double |
computeAverage(double[] array,
int start,
int num) |
Computes the average value of a subset of an array.
|
static Function |
constantFunction(double c) |
Creates a function having a constant value.
|
static double |
evalMath(java.lang.String str) |
Evalautes a mathematical expression without variables.
|
static java.lang.String |
f2(double d) |
Convert a double to a string, printing two decimal places.
|
static java.lang.String |
f3(double d) |
Convert a double to a string, printing three decimal places.
|
static java.lang.String |
f4(double d) |
Convert a double to a string, printing four decimal places.
|
static double[] |
functionFill(Function f,
double start,
double stop,
double[] data) |
Fills the given double[n] array with f(x) on the interval [start, stop].
|
static double[][] |
functionFill(Function f,
double start,
double stop,
double[][] data) |
Fills the given double[2][n] array with x and f(x) values on interval [start, stop].
|
static Function |
gaussian(double x0,
double sigma) |
Creates a Guassian (normal) distribution function.
|
static double[] |
getRange(Function f,
double a,
double b,
int n) |
Gets the approximate range of a function within the given domain.
|
static Function |
linearFunction(double m,
double b) |
Creates a linear function with the given slope and intercept.
|
static double |
relativePrecision(double epsilon,
double result) |
Computes the relativePrecision except near zero where the absolute precision is returned.
|
public static final double SQRT2PI
public static final double LOG10
public static final double defaultNumericalPrecision
public static java.lang.String f2(double d)
d - Input doublepublic static java.lang.String f3(double d)
d - Input doublepublic static java.lang.String f4(double d)
d - Input doublepublic static double relativePrecision(double epsilon,
double result)
epsilon - the absolute errorresult - the resultpublic static int checkSorting(double[] array)
array - double[]public static double[] getRange(Function f, double a, double b, int n)
f - Functiona - doubleb - doublen - intpublic static double[][] functionFill(Function f, double start, double stop, double[][] data)
f - Functionstart - doublestop - doubledata - double[][]public static double[] functionFill(Function f, double start, double stop, double[] data)
f - Functionstart - double starting value of xstop - double stopping value of xdata - double[]public static double computeAverage(double[] array,
int start,
int num)
array - the data to be averagedstart - the index of the first point to be averagednum - the total number of points to be averagedpublic static Function constantFunction(double c)
c - public static Function linearFunction(double m, double b)
m - double slopeb - double interceptpublic static Function gaussian(double x0, double sigma)
x0 - double center of the distributionsigma - double width of the distributuonpublic static double evalMath(java.lang.String str)
str - String