ZeroFunction
has been replaced by ZerosFunction
.public class ZeroFunction extends Object implements Serializable, Cloneable
ZeroFunction
computes n real zeros of
a real function f. Given a user-supplied function
f(x) and an n-vector of initial guesses
x1,x2,…,xn, the routine uses Muller's method
to locate n real zeros of f, that
is, n real values of x for which
f(x) = 0. The routine has two convergence criteria:
the first requires that
|f(xmi)|
be less than errorAbsolute
, specified by the
setAbsoluteError
method; the second requires that the relative
change of any two successive approximations to an xi
be less than ErrorRelative
, specified by the
setAbsoluteError
method.
Here,
xmi
is the m-th approximation to xi. Let
errorAbsolute
be ε1, and
errorRelative
be ε2. The
criteria may be stated mathematically as follows:
Criterion 1:
|f(xmi)|<ε1
Criterion 2:
|xm+1i−xmixmi|<ε2
"Convergence" is the satisfaction of either criterion.
Modifier and Type | Class and Description |
---|---|
static interface |
ZeroFunction.Function
Deprecated.
ZeroFunction has been replaced by ZerosFunction . |
Constructor and Description |
---|
ZeroFunction()
Deprecated.
Creates an instance of the solver.
|
Modifier and Type | Method and Description |
---|---|
boolean |
allConverged()
Deprecated.
Returns true if the iterations for all of the roots have converged.
|
double[] |
computeZeros(ZeroFunction.Function objectF,
double[] guess)
Deprecated.
Returns the zeros of a univariate function.
|
int |
getIterations(int nRoot)
Deprecated.
Returns the number of iterations used to compute a root.
|
void |
setAbsoluteError(double errorAbsolute)
Deprecated.
Sets first stopping criterion.
|
void |
setMaxIterations(int maxIterations)
Deprecated.
Sets the maximum number of iterations allowed per root.
|
void |
setRelativeError(double errorRelative)
Deprecated.
Sets second stopping criterion is the relative error.
|
void |
setSpread(double spread)
Deprecated.
Sets the spread.
|
void |
setSpreadTolerance(double spreadTolerance)
Deprecated.
Sets the spread criteria for multiple zeros.
|
public ZeroFunction()
public void setAbsoluteError(double errorAbsolute)
errorAbsolute
- a double
value specifying the
first stopping criterionIllegalArgumentException
- is thrown if errorAbsolute
is less than 0public void setRelativeError(double errorRelative)
errorRelative
- a double
value specifying the
second stopping criterionIllegalArgumentException
- is thrown if errorRelative
is less than 0 or greater than 1public void setSpreadTolerance(double spreadTolerance)
x[i]
has been computed and
|x[i]−x[j]|< spreadTolerance
, where
x[j]
is a previously computed zero, then the computation is restarted with
a guess equal to x[i]
+spread.
The default value for spreadTolerance is 1.0e-5.spreadTolerance
- a double
value specifying
the spread toleranceIllegalArgumentException
- is thrown if spreadTolerance
is less than zero.public void setSpread(double spread)
spread
- is the new spread. Its default value is 1.0.ZeroFunction.setSpreadTolerance(double)
public void setMaxIterations(int maxIterations)
maxIterations
- an int
specifying the
maximum number of iterations allowed
per rootIllegalArgumentException
- is thrown if maxIterations
is less than zero.public int getIterations(int nRoot)
nRoot
- an int
specifying the index of the rootpublic boolean allConverged()
public double[] computeZeros(ZeroFunction.Function objectF, double[] guess)
objectF
- contains the function for which the zeros will be found.guess
- a double
array containing an initial
guess of the zeros. A zero will be found for
each point in guess.Copyright © 2020 Rogue Wave Software. All rights reserved.