com.kutsyy.util
Class Numeric

java.lang.Object
  |
  +--com.kutsyy.util.Numeric

public final class Numeric
extends Object

Numeric class include some maximization and simmular numeric functions.
Created by Vadim Kutsyy

Author:
Vadim Kutsyy

Field Summary
private static double CGOLD
           
private static int ITMAX
           
private static Function local_f
           
private static MvFunction local_mvF
           
private static boolean min
           
private static double tol
           
private static double ZEPS
           
 
Constructor Summary
Numeric()
           
 
Method Summary
private static double brent_(double ax, double bx, double cx, double tol)
          Insert the method's description here.
static double brent(double ax, double bx, double cx, Function _f, double tol)
          Function Minimizaton based on Brent method
static double brent(double ax, double bx, double cx, Function _f, double tol, String min_max)
          Function Minimizaton based on Brent method
private static double expQgauss(Function F, int n)
          Insert the method's description here.
private static double f(double x)
          Insert the method's description here.
private static void gauher(double[] x, double[] w)
          Insert the method's description here.
private static double golden_(double ax, double bx, double cx, double tol)
          Insert the method's description here.
static double golden(double ax, double bx, double cx, Function _f, double tol)
          Function Minmizaton based on golden search
static double golden(double ax, double bx, double cx, Function _f, double tol, String min_max)
          Function Minmizaton based on golden search
private static double min(double[] x)
          Insert the method's description here.
static double minimize(double ax, double bx, double cx, Function _f, double tol, String min_max)
          Insert the method's description here.
private static void mnbrac_(double[] x, double[] fx)
          Insert the method's description here.
private static double mvF(double[] x)
          Insert the method's description here.
static double[] mvGrid(double[] x, double[] a, double[] b, MvFunction mvF, double[] tol, String min_max)
          Multivariate minimizaton based on discrete grid.
static double[] mvGrid(double[] x, double[] a, double[] b, MvFunction mvF, double tol, String min_max)
          Multivariate minimizaton based on discrete grid.
private static double qgauss(Function F, int n)
          Insert the method's description here.
private static double sign(double a, double b)
          Insert the method's description here.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

min

private static boolean min

local_f

private static Function local_f

local_mvF

private static MvFunction local_mvF

tol

private static final double tol

ITMAX

private static final int ITMAX

CGOLD

private static final double CGOLD

ZEPS

private static final double ZEPS
Constructor Detail

Numeric

public Numeric()
Method Detail

brent

public static double brent(double ax,
                           double bx,
                           double cx,
                           Function _f,
                           double tol)
Function Minimizaton based on Brent method
Parameters:
ax - double - lower limit for x
bx - double - initial gess for x
cx - double -upper limit for x
_f - kutsyy.util.Function - inteface with function f(double) to minimize
tol - double - tolerance
Returns:
double - value of x with minimize function f

brent

public static double brent(double ax,
                           double bx,
                           double cx,
                           Function _f,
                           double tol,
                           String min_max)
Function Minimizaton based on Brent method
Parameters:
ax - double - lower limit for x
bx - double - initial gess for x
cx - double -upper limit for x
_f - kutsyy.util.Function - inteface with function f(double) to minimize
tol - double - tolerance
min_max - java.lang.String - "max" or "min" -to maximize or minimize
Returns:
double - value of x with minimize function f

golden

public static double golden(double ax,
                            double bx,
                            double cx,
                            Function _f,
                            double tol)
Function Minmizaton based on golden search
Parameters:
ax - double - lower limit for x
bx - double - initial gess for x
cx - double -upper limit for x
_f - kutsyy.util.Function - inteface with function f(double) to minimize
tol - double - tolerance
Returns:
double - value of x with minimize function f

golden

public static double golden(double ax,
                            double bx,
                            double cx,
                            Function _f,
                            double tol,
                            String min_max)
Function Minmizaton based on golden search
Parameters:
ax - double - lower limit for x
bx - double - initial gess for x
cx - double -upper limit for x
_f - kutsyy.util.Function - inteface with function f(double) to minimize
tol - double - tolerance
min_max - java.lang.String - "max" or "min" -to maximize or minimize
Returns:
double - value of x with minimize function f

minimize

public static double minimize(double ax,
                              double bx,
                              double cx,
                              Function _f,
                              double tol,
                              String min_max)
Insert the method's description here.
Parameters:
ax - double
bx - double
cx - double
_f - com.kutsyy.util.Function
tol - double
min_max - java.lang.String
Returns:
double

mvGrid

public static double[] mvGrid(double[] x,
                              double[] a,
                              double[] b,
                              MvFunction mvF,
                              double[] tol,
                              String min_max)
Multivariate minimizaton based on discrete grid. Next point is found by fitting 2 degree multivariate polinomial, and maximizing it.
Parameters:
x - double[] - imput initial gues, output, value that minimize/maximize function
a - double[] - lower limit for x;
b - double[] - upper limit for x;
mvF - kutsyy.util.MvFunction -inteface that contain f(double[]) to be minimaze/maximize
tol - double[] - tolerance for each dimention
min_max - java.lang.String - "min" or "max" for minimizaton, or maximization.
Returns:
double - value of function at the minimum/maximum;

mvGrid

public static double[] mvGrid(double[] x,
                              double[] a,
                              double[] b,
                              MvFunction mvF,
                              double tol,
                              String min_max)
Multivariate minimizaton based on discrete grid. Next point is found by fitting 2 degree multivariate polinomial, and maximizing it.
Parameters:
x - double[] - imput initial gues, output, value that minimize/maximize function
a - double[] - lower limit for x;
b - double[] - upper limit for x;
mvF - kutsyy.util.MvFunction -inteface that contain f(double[]) to be minimaze/maximize
tol - double - tolerance
min_max - java.lang.String - "min" or "max" for minimizaton, or maximization.
Returns:
double - value of function at the minimum/maximum;

brent_

private static double brent_(double ax,
                             double bx,
                             double cx,
                             double tol)
Insert the method's description here. Creation date: (2/13/00 6:09:40 PM)
Parameters:
ax - double
bx - double
cx - double
tol - double
Returns:
double

expQgauss

private static double expQgauss(Function F,
                                int n)
Insert the method's description here. Creation date: (3/16/00 5:00:58 PM)
Parameters:
n - int
F - Description of Parameter
Returns:
Description of the Returned Value

f

private static double f(double x)
Insert the method's description here. Creation date: (2/13/00 7:08:35 PM)
Parameters:
x - double
Returns:
double

gauher

private static void gauher(double[] x,
                           double[] w)
Insert the method's description here. Creation date: (3/16/00 4:35:14 PM)
Parameters:
x - double[]
w - double[]

golden_

private static double golden_(double ax,
                              double bx,
                              double cx,
                              double tol)
Insert the method's description here. Creation date: (2/13/00 6:09:40 PM)
Parameters:
ax - double
bx - double
cx - double
tol - double
Returns:
double

min

private static double min(double[] x)
Insert the method's description here. Creation date: (3/21/00 10:50:39 PM)
Parameters:
x - double[]
Returns:
double

mnbrac_

private static void mnbrac_(double[] x,
                            double[] fx)
Insert the method's description here. Note Minimazation Creation date: (2/13/00 5:20:57 PM)
Parameters:
x - double[]
fx - double[]

mvF

private static double mvF(double[] x)
Insert the method's description here. Creation date: (3/19/00 8:08:16 PM)
Parameters:
x - double[]
Returns:
double

qgauss

private static double qgauss(Function F,
                             int n)
Insert the method's description here. Creation date: (3/16/00 5:00:58 PM)
Parameters:
n - int
F - Description of Parameter
Returns:
Description of the Returned Value

sign

private static double sign(double a,
                           double b)
Insert the method's description here. Creation date: (2/14/00 1:48:26 PM)
Parameters:
a - double
b - double
Returns:
double