|
JavaView® v2.12 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--jvx.numeric.PnRootFinder
Find roots of a real-valued function in one variable or defined on a 1-dimensional curve.
| Constructor Summary | |
PnRootFinder()
|
|
| Method Summary | |
static PdVector |
findRoots(PuFunction fx,
double x1,
double x2,
int maxRoots)
Given a function fx on the interval I=[x1,x2] and a subdivision of I into maxRoots equally spaced subintervals, then find those subintervals with zero crossing and compute a root for each subinterval. |
static double[] |
findValue(PuFunction fx,
double[] a,
double[] b,
double value)
Finds the position of a value on a straight line segment between two vertices using a bisection algorithm. |
static double[] |
findZero(PuFunction fx,
double[] a,
double[] b)
Finds the zero position on a straight line segment between two vertices using a bisection algorithm. |
static double[] |
zbrac(PuFunction fx,
double x1,
double x2)
Given a function fx and initial interval I=[x1,x2], then the method expands the range until a root is bracketed by the returned array. |
static int |
zbrak(PuFunction fx,
double x1,
double x2,
int len,
double[] xb1,
double[] xb2,
int nb)
Given a function fx on the interval I=[x1,x2] and a subdivision of I into len equally spaced subintervals, then find those subintervals with zero crossing and return them as array brackets. |
static double |
zbrent(PuFunction fx,
double x1,
double x2,
double tol)
Given a function fx find a root known to lie in the interval I=[x1,x2]. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PnRootFinder()
| Method Detail |
public static double[] findZero(PuFunction fx,
double[] a,
double[] b)
This method just calls #findValue with value of zero.
a - a double[] with one vertexb - a double[] with another vertex
public static double[] findValue(PuFunction fx,
double[] a,
double[] b,
double value)
First the function is evaluated at the two end points. If either of them is already equal to the value, then a copy of this vertex is returned. If both values are bigger or smaller, then a warning message is issued and the first vertex is returned.
Otherwise the bisection starts by computing the midpoint of the interval, choosing the section with different signs for the difference, bisecting this subinterval again and so on until one of the function values becomes equal. This vertex is finally returned.
HACK: Method should use more efficient root finding algorithm.
a - coordinates of the first vertexb - coordinates of the second vertexvalue - function value to search for its argument vertex
public static PdVector findRoots(PuFunction fx,
double x1,
double x2,
int maxRoots)
Method uses zbrak to find subintervals with zero crossings, and use zbrent to compute the root on each subinterval which is known to contain a root.
fx - Function to evaluate for zero crossings.x1, - x2 Original interval.maxRoots - Number of subintervals to in which to divide interval [x1,x2].zbrak(jv.function.PuFunction, double, double, int, double[], double[], int),
zbrent(jv.function.PuFunction, double, double, double),
PjRootFinder
public static double[] zbrac(PuFunction fx,
double x1,
double x2)
fx - Function to evaluate for zero crossings.x1, - x2 Original interval.null if maximal num of tries exceeded.zbrak(jv.function.PuFunction, double, double, int, double[], double[], int)
public static int zbrak(PuFunction fx,
double x1,
double x2,
int len,
double[] xb1,
double[] xb2,
int nb)
fx - Function to evaluate for zero crossings.x1, - x2 Original interval.len - Number of subintervals to in which to divide interval [x1,x2].xb1, - xb2 Arrays of size 'len to store the brackets of zero crossings.nb - Requested maximal number of zero crossings.zbrac(jv.function.PuFunction, double, double)
public static double zbrent(PuFunction fx,
double x1,
double x2,
double tol)
fx - Function to evaluate.x1, - x2 Interval containing a root of fx.tol - Required precision.zbrac(jv.function.PuFunction, double, double)
|
JavaView® v2.12 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||