jdistlib.math.opt
Class Optimization
- java.lang.Object
-
- jdistlib.math.opt.Optimization
-
public class Optimization extends java.lang.ObjectFunction optimization routines. Currently only Brent's minimization routine. Maybe I'll add Nelder-Meade or other fancier methods.
-
-
Constructor Summary
Constructors Constructor and Description Optimization()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidmain(java.lang.String[] args)static doubleoptimize(UnivariateFunction f, double ax, double bx)Brent's minimization function with default tolerance (1e-10)static doubleoptimize(UnivariateFunction f, double ax, double bx, double tol, int maxiter)Richard Brent's function minimization routine.
Wikipedia's link
Adapted from Netlib's fmin.
Also looked at Numerical Methods in C, 2nd ed.static doublezeroin(UnivariateFunction f, double ax, double bx, double tol, int maxiter)************************************************************************ C math library function ZEROIN - obtain a function zero within the given range Output Zeroin returns an estimate for the root with accuracy 4*EPSILON*abs(x) + tol Algorithm G.Forsythe, M.Malcolm, C.Moler, Computer methods for mathematical computations.
-
-
-
Method Detail
-
optimize
public static final double optimize(UnivariateFunction f, double ax, double bx)
Brent's minimization function with default tolerance (1e-10)- Parameters:
f-ax-bx-- Returns:
- the x at which f(x) is the minimum value
-
optimize
public static final double optimize(UnivariateFunction f, double ax, double bx, double tol, int maxiter)
Richard Brent's function minimization routine.
Wikipedia's link
Adapted from Netlib's fmin.
Also looked at Numerical Methods in C, 2nd ed. Chapter 10 section 1 and 2.- Parameters:
f- the function to minimizeax- lower boundbx- upper boundtol- tolerancemaxiter- the maximum number of iterations
-
zeroin
public static final double zeroin(UnivariateFunction f, double ax, double bx, double tol, int maxiter)
************************************************************************ C math library function ZEROIN - obtain a function zero within the given range Output Zeroin returns an estimate for the root with accuracy 4*EPSILON*abs(x) + tol Algorithm G.Forsythe, M.Malcolm, C.Moler, Computer methods for mathematical computations. M., Mir, 1980, p.180 of the Russian edition The function makes use of the bisection procedure combined with the linear or quadric inverse interpolation. At every step program operates on three abscissae - a, b, and c. b - the last and the best approximation to the root a - the last but one approximation c - the last but one or even earlier approximation than a that 1) |f(b)| <= |f(c)| 2) f(b) and f(c) have opposite signs, i.e., b and c confine the root At every step Zeroin selects one of the two new approximations, the former being obtained by the bisection procedure and the latter resulting in the interpolation (if a,b, and c are all different the quadric interpolation is utilized, otherwise the linear one). If the latter (i.e. obtained by the interpolation) point is reasonable (i.e. lies within the current interval [b,c] not being too close to the boundaries) it is accepted. The bisection result is used in the other case. Therefore, the range of uncertainty is ensured to be reduced at least by the factor 1.6 NOTE: uniroot() --> do_zeroin2() --- in ../main/optimize.c ~~~~~~~~~~~~~~~~~~- Parameters:
f- The function whose zero is soughtax- Root will be sought for within a range [ax,bx]bx-tol- Acceptable tolerance for the root value. May be specified as 0.0 to cause the program to find the root as accurate as possible.maxiter- Max. iterations- Returns:
- the x where f(x) == 0
-
main
public static void main(java.lang.String[] args)
-
-
DMelt 3.0 © DataMelt by jWork.ORG