|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensourcephysics.numerics.Util
public final class Util
A utility class for numerical analysis. This class cannot be subclassed or instantiated because all methods are static.
| Field Summary | |
|---|---|
static double |
defaultNumericalPrecision
The default precision for numerical analysis. |
static double |
LOG10
|
static double |
SQRT2PI
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double SQRT2PI
public static final double LOG10
public static final double defaultNumericalPrecision
| Method Detail |
|---|
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 double
public static double relativePrecision(double epsilon,
double result)
epsilon - the absolute errorresult - the result
public static int checkSorting(double[] array)
array - double[]
public static double[] getRange(Function f,
double a,
double b,
int n)
f - Functiona - doubleb - doublen - int
public 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 averaged
public static Function constantFunction(double c)
c -
public static Function linearFunction(double m,
double b)
m - double slopeb - double intercept
public static Function gaussian(double x0,
double sigma)
x0 - double center of the distributionsigma - double width of the distributuon
public static double evalMath(java.lang.String str)
str - String
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||