de.grogra.math
public class Newton extends java.lang.Object
| Constructor and Description |
|---|
Newton() |
| Modifier and Type | Method and Description |
|---|---|
static void |
findExtremum(ObjectToDouble<double[]> function,
double[] x,
double[] prec,
int maxSteps,
double[] eps,
double relax)
Finds a local extremum by looking for a root of an
approximation of the derivative of
function. |
static void |
findRoot(ObjectToObject<double[],double[]> function,
double[] x,
double[] prec,
int maxSteps,
double[] eps,
double relax)
Finds a root of
function. |
static void |
fit(ObjectToDouble<double[][]> function,
DataTable data,
double[] params,
double[] prec) |
static void |
fit(ObjectToDouble<double[][]> function,
DataTable data,
double[] params,
double[] prec,
int maxSteps,
double[] eps,
double relax)
Fits
function to data. |
static void |
fitParameters(ObjectToDouble<double[]> function,
DataTable data,
double[] params,
double[] prec) |
static void |
fitParameters(ObjectToDouble<double[]> function,
DataTable data,
double[] params,
double[] prec,
int maxSteps,
double[] eps,
double relax) |
static DataTable |
toDataTable(Dataset set) |
public static void findExtremum(ObjectToDouble<double[]> function, double[] x, double[] prec, int maxSteps, double[] eps, double relax)
function.
The approximation is obtained by difference quotients, the
delta being given by eps.function - the functionx - the start value and (after method invocation completes normally)
the final valueprec - the precision to achievemaxSteps - maximal number of iterationseps - the delta to approximate differential quotientsrelax - relaxation factor for stepfindRoot(de.grogra.xl.lang.ObjectToObject, double[], double[], int, double[], double) public static void findRoot(ObjectToObject<double[],double[]> function, double[] x, double[] prec, int maxSteps, double[] eps, double relax)
function. Starting at x,
the derivative of function is approximated by difference
quotients (using eps as delta) to compute a new
x according to Newton's method, using relax
as factor which reduces the x-movement computed by
Newton's method. If the movement is less than prec in all
dimensions, this method returns normally. Otherwise, after
maxSteps an ArithmeticException is thrown.
All arrays have to be of the same length.
function - the functionx - the start value and (after method invocation completes normally)
the final valueprec - the precision to achievemaxSteps - maximal number of iterationseps - the delta to approximate differential quotientsrelax - relaxation factor for steppublic static void fit(ObjectToDouble<double[][]> function, DataTable data, double[] params, double[] prec)
public static void fit(ObjectToDouble<double[][]> function, DataTable data, double[] params, double[] prec, int maxSteps, double[] eps, double relax)
function to data. function
gets an array as input whose first component contains the
x-vector and whose second component contains the
parameter vector. data contains for each row a data set
consisting of the x-vector and (as last entry)
the function value.function - the functiondata - the data tableparams - the start value for the parameter vector and
(after method invocation completes normally) the final valueprec - the precision to achievemaxSteps - maximal number of iterationseps - the delta to approximate differential quotientsrelax - relaxation factor for stepfindExtremum(de.grogra.xl.lang.ObjectToDouble, double[], double[], int, double[], double) ,
findRoot(de.grogra.xl.lang.ObjectToObject, double[], double[], int, double[], double) public static void fitParameters(ObjectToDouble<double[]> function, DataTable data, double[] params, double[] prec)
public static void fitParameters(ObjectToDouble<double[]> function, DataTable data, double[] params, double[] prec, int maxSteps, double[] eps, double relax)