corina.index
Class Polynomial

java.lang.Object
  |
  +--corina.index.Index
        |
        +--corina.index.Polynomial
All Implemented Interfaces:
Graphable, Runnable, Solver.Solveable, UndoableEdit

public class Polynomial
extends Index
implements Solver.Solveable

A polynomial-fit index to a data sample. The user specifies the degree of polynomial to use.

Version:
$Id: Polynomial.java,v 1.2 2002/04/29 14:36:30 bitpoet Exp $
Author:
Ken Harris

Field Summary
protected  int degree
           
 
Fields inherited from class corina.index.Index
data, msg, source
 
Constructor Summary
Polynomial(Sample s, int degree)
          Construct a new polynomial fit from a sample, given a degree polynomial to fit.
 
Method Summary
 double[] f(double x)
          Evaluate the basis polynomial at x, for Solver.leastSquares().
 int getID()
           
 String getName()
          Return the name, e.g., "Polynomial (3o)" for a third-degree polynomial.
 void index()
          Compute the index.
 
Methods inherited from class corina.index.Index
addEdit, apply, canRedo, canUndo, die, getChi2, getData, getPresentationName, getR, getRedoPresentationName, getScale, getStart, getTarget, getUndoPresentationName, isSignificant, redo, replaceEdit, run, setProxy, toString, unapply, undo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

degree

protected int degree
Constructor Detail

Polynomial

public Polynomial(Sample s,
                  int degree)
Construct a new polynomial fit from a sample, given a degree polynomial to fit.
Parameters:
s - the Sample to index
degree - the degree polynomial to use
Method Detail

f

public double[] f(double x)
Evaluate the basis polynomial at x, for Solver.leastSquares(). The basis polynomial is:
f(x) = [ 1 x x2 x3 ... xdegree ]
Specified by:
f in interface Solver.Solveable
Parameters:
x - the x-value to evaluate the polynomial at
Returns:
the y-value of the basis polynomial at this x

getName

public String getName()
Return the name, e.g., "Polynomial (3o)" for a third-degree polynomial.
Overrides:
getName in class Index
Returns:
name of this index

index

public void index()
Compute the index.
Overrides:
index in class Index

getID

public int getID()
Overrides:
getID in class Index