optimization
Class Fzero
java.lang.Object
optimization.Fzero
public class Fzero
- extends java.lang.Object
This class was translated by a statistician from the FORTRAN
version of dfzero. It is NOT an official translation. When
public domain Java optimization routines become available
from professional numerical analysts, then THE CODE PRODUCED
BY THE NUMERICAL ANALYSTS SHOULD BE USED.
Meanwhile, if you have suggestions for improving this
code, please contact Steve Verrill at steve@ws13.fpl.fs.fed.us.
Constructor Summary |
Fzero()
|
Method Summary |
static void |
fzero(Fzero_methods zeroclass,
double[] b,
double[] c,
double r,
double re,
double ae,
int[] iflag)
This method searches for a zero of a function f(x) between
the given values b and c until the width of the interval
(b,c) has collapsed to within a tolerance specified by
the stopping criterion, Math.abs(b-c) <= 2.0*(rw*Math.abs(b)+ae). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Fzero
public Fzero()
fzero
public static void fzero(Fzero_methods zeroclass,
double[] b,
double[] c,
double r,
double re,
double ae,
int[] iflag)
This method searches for a zero of a function f(x) between
the given values b and c until the width of the interval
(b,c) has collapsed to within a tolerance specified by
the stopping criterion, Math.abs(b-c) <= 2.0*(rw*Math.abs(b)+ae).
The method used is an efficient combination of bisection
and the secant rule.
The introductory comments from
the FORTRAN version are provided below.
This method is a translation from FORTRAN to Java of the Netlib
(actually it is in the SLATEC library which is available at Netlib)
function dfzero. In the FORTRAN code, L.F. Shampine and H.A. Watts
are listed as the authors.
Translated by Steve Verrill, April 17, 2001.
- Parameters:
zeroclass
- A class that defines a method, f_to_zero,
that returns a value that is to be zeroed.
The class must implement
the Fzero_methods interface (see the definition
in Fzero_methods.java). See FzeroTest.java
for an example of such a class.
f_to_zero must have one
double valued argument.b[1]
- One endpoint of the initial interval. The value returned
for b[1] is usually the better approximation to a
zero of f_to_zero.c[1]
- The other endpoint of the initial interval.r
- Initial guess of a zero. A (better) guess of a zero
of f_to_zero which could help in
speeding up convergence. If f_to_zero(b) and f_to_zero(r) have
opposite signs, a root will be found in the interval
(b,r); if not, but f_to_zero(r) and f_to_zero(c) have opposite
signs, a root will be found in the interval (r,c);
otherwise, the interval (b,c) will be searched for a
possible root. When no better guess is known, it is
recommended that r be set to b or c; because if r is
not interior to the interval (b,c), it will be ignored.re
- Relative error used for rw in the stopping criterion.
If the requested re is less than machine precision,
then rw is set to approximately machine precision.ae
- Absolute error used in the stopping criterion. If the
given interval (b,c) contains the origin, then a
nonzero value should be chosen for AE.iflag[1]
- A status code. User must check iflag[1] after each call.
Control returns to the user from dfzero in all cases.
1: b is within the requested tolerance of a zero.
The interval (b,c) collapsed to the requested
tolerance, the function changes sign in (b,c), and
f_to_zero(x) decreased in magnitude as (b,c) collapsed.
2: f_to_zero(b) = 0. However, the interval (b,c) may not have
collapsed to the requested tolerance.
3: b may be near a singular point of f_to_zero(x).
The interval (b,c) collapsed to the requested tol-
erance and the function changes sign in (b,c), but
f_to_zero(x) increased in magnitude as (b,c) collapsed,i.e.
Math.abs(f_to_zero(b out)) >
Math.max(Math.abs(f_to_zero(b in)),
Math.abs(f_to_zero(c in)))
4: No change in sign of f_to_zero(x) was found although the
interval (b,c) collapsed to the requested tolerance.
The user must examine this case and decide whether
b is near a local minimum of f_to_zero(x), or b is near a
zero of even multiplicity, or neither of these.
5: Too many (> 500) function evaluations used.