Package com.imsl.math

Class ZeroFunction

java.lang.Object
com.imsl.math.ZeroFunction
All Implemented Interfaces:
Serializable, Cloneable

public class ZeroFunction extends Object implements Serializable, Cloneable
Deprecated.
ZeroFunction has been replaced by ZerosFunction.
Muller's method to find the zeros of a univariate function, f(x).

ZeroFunction computes n real zeros of a real function f. Given a user-supplied function f(x) and an n-vector of initial guesses \(x_1, x_2, \ldots, x_n\), 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

$$\left| {f\,\left( {x_i^m } \right)} \right|$$

be less than errorAbsolute, specified by the setAbsoluteError method; the second requires that the relative change of any two successive approximations to an \(x_i\) be less than ErrorRelative, specified by the setAbsoluteError method.

Here,

$$x_i^m$$

is the m-th approximation to \(x_i\). Let errorAbsolute be \(\varepsilon _1\), and errorRelative be \(\varepsilon _2\). The criteria may be stated mathematically as follows:

Criterion 1:

$$\left| {f\,\left( {x_i^m } \right)} \right| \lt \,\,\varepsilon _1$$

Criterion 2:

$$\left| {\frac{{x_i^{m + 1} - x_i^m }}{{x_i^m }}} \right|\; \lt \;\varepsilon _2$$

"Convergence" is the satisfaction of either criterion.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Deprecated.
    ZeroFunction has been replaced by ZerosFunction.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
    Creates an instance of the solver.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ZeroFunction

      public ZeroFunction()
      Deprecated.
      Creates an instance of the solver.
  • Method Details

    • setAbsoluteError

      public void setAbsoluteError(double errorAbsolute)
      Deprecated.
      Sets first stopping criterion. A zero x[i] is accepted if \(|f(x[i])|\) is less than this tolerance. Its default value is about 1.0e-8.
      Parameters:
      errorAbsolute - a double value specifying the first stopping criterion
      Throws:
      IllegalArgumentException - is thrown if errorAbsolute is less than 0
    • setRelativeError

      public void setRelativeError(double errorRelative)
      Deprecated.
      Sets second stopping criterion is the relative error. A zero x[i] is accepted if the relative change of two successive approximations to x[i] is less than this tolerance. Its default value is about 1.0e-8.
      Parameters:
      errorRelative - a double value specifying the second stopping criterion
      Throws:
      IllegalArgumentException - is thrown if errorRelative is less than 0 or greater than 1
    • setSpreadTolerance

      public void setSpreadTolerance(double spreadTolerance)
      Deprecated.
      Sets the spread criteria for multiple zeros. If the zero x[i] has been computed and \(|x[i]-x[j]| \lt\) 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.
      Parameters:
      spreadTolerance - a double value specifying the spread tolerance
      Throws:
      IllegalArgumentException - is thrown if spreadTolerance is less than zero.
    • setSpread

      public void setSpread(double spread)
      Deprecated.
      Sets the spread. See setSpreadTolerance.
      Parameters:
      spread - is the new spread. Its default value is 1.0.
      See Also:
    • setMaxIterations

      public void setMaxIterations(int maxIterations)
      Deprecated.
      Sets the maximum number of iterations allowed per root. Its default value is 100.
      Parameters:
      maxIterations - an int specifying the maximum number of iterations allowed per root
      Throws:
      IllegalArgumentException - is thrown if maxIterations is less than zero.
    • getIterations

      public int getIterations(int nRoot)
      Deprecated.
      Returns the number of iterations used to compute a root.
      Parameters:
      nRoot - an int specifying the index of the root
    • allConverged

      public boolean allConverged()
      Deprecated.
      Returns true if the iterations for all of the roots have converged.
    • computeZeros

      public double[] computeZeros(ZeroFunction.Function objectF, double[] guess)
      Deprecated.
      Returns the zeros of a univariate function.
      Parameters:
      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.