|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.graph.math.Curve
org.faceless.graph.math.FunctionCurve
org.faceless.graph.math.Polynomial
public class Polynomial
Represents a Polynomial Curve of any degree > 2. A polynomial
can be fitted to a DataCurve
to give a smoother
curve, but owing to the nature of polynomial functions this
may result in some large "wiggles" in the curve (we suspect
this is not the correct mathematical term). Generally the
best choice for a curve fitting function is a
Spline
curve.
Constructor Summary | |
---|---|
Polynomial(int order,
double[] x)
Create a polynomial of the specified order with the specified coefficients. |
Method Summary | |
---|---|
static Polynomial |
fit(DataCurve d)
Return a new polynomial that is fitted to the specified data curve within the tolerance set by setFitTolerance . |
static Polynomial |
fit(double[] xvals,
double[] yvals)
Return a new polynomial that is fitted to the specified array of X and Y values within the tolerance set by setFitTolerance . |
static Polynomial |
fit(int order,
double[] xvals,
double[] yvals)
Return a new polynomial of the specified order that is fitted to the specified array of X and Y values within the tolerance set by setFitTolerance . |
double |
get(double x)
Return the value of this curve at the specified X position. |
double |
maxMatchError(double[] xvals,
double[] yvals)
Return the maximum distance from the specified set of X and Y values of this polynomial. |
static void |
setFitTolerance(double v)
When fitting a polynomial to a curve, the Fit Tolerance is the maximum distance from each point the polynomial can be, as a proportion of the value of the point. |
String |
toString()
|
Methods inherited from class org.faceless.graph.math.FunctionCurve |
---|
getMax, getMin, point, steps |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Polynomial(int order, double[] x)
2
and the array [1, 2, 1]
creates
a polynomial representing x^2 + 2x + 1
Method Detail |
---|
public String toString()
toString
in class Object
public double get(double x)
Curve
Double.NaN
get
in class Curve
public static void setFitTolerance(double v)
public static Polynomial fit(DataCurve d)
setFitTolerance
.
public static Polynomial fit(double[] xvals, double[] yvals)
setFitTolerance
.
public static Polynomial fit(int order, double[] xvals, double[] yvals)
setFitTolerance
.
public double maxMatchError(double[] xvals, double[] yvals)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |