public class GoldenSectionSearch extends Object
Modifier and Type | Class and Description |
---|---|
static class |
GoldenSectionSearch.Result
The results of the golden section search.
|
Constructor and Description |
---|
GoldenSectionSearch()
Creates a new instance of GoldenSectionSearch
|
Modifier and Type | Method and Description |
---|---|
static GoldenSectionSearch.Result |
minimize(double a,
double b,
NumFunction f,
double tol)
Implements the Golden Section search based from the book
"Numerical Recipes : The Art of Scientific Computing" with search interval : ]a, b[.
|
static GoldenSectionSearch.Result |
minimizeInt(int a,
int b,
NumFunction f,
double tol)
Similar to
minimize(double,double,NumFunction,double) but for
integer (discrete) function. |
public GoldenSectionSearch()
public static GoldenSectionSearch.Result minimize(double a, double b, NumFunction f, double tol)
a
- the lower of the 2 points : a < c < b.b
- the higher of the 2 points : a < c < b.f
- the function to evaluate.tol
- the tolerance parameter.public static GoldenSectionSearch.Result minimizeInt(int a, int b, NumFunction f, double tol)
minimize(double,double,NumFunction,double)
but for
integer (discrete) function. Only discrete are evaluated.
Note that the search interval is ]a, b[.a
- the lower of the 2 points : a < b.b
- the higher of the 2 points : a < b.f
- the function to evaluate.tol
- the tolerance parameter. Minimum tolerance is 1, if smaller, the tolerance
will be automatically be set to 1.