taylor
Class Polyfit

java.lang.Object
  extended by taylor.Polyfit

public class Polyfit
extends java.lang.Object

A container class for sets of partial polynomials generated by polyfit method.

It's strongly recommended to use Solver in stead of calling methods of this class.

Author:
Vasek Vopenka

Constructor Summary
Polyfit(Element pol)
          Loads container from XML.
Polyfit(Polynomials pol)
          Loads container with given partial polynomials.
 
Method Summary
 void appendResults(Element pol)
          Appends new sets of partial polynomials to this container.
 void appendResults(Polyfit pol)
          Appends sets of partial polynomials from different result.
 double[] eval(double t)
          Evaluates unknow functions at given time.
 double[][] eval(double[] t)
          Evaluates all results at given times.
 double[] eval(int order, double t)
          Evaluates given order at given time.
 double[][] eval(int order, double[] t)
          Evaluates only given order at given times.
 double[][] eval(int polynomial, int order, double[] t)
          Evaluates given polynomial and given order at times t.
 double[] eval(java.lang.String label, double[] t)
          Evaluates requested unknow function at given times.
 java.lang.String[] getLabels()
          Returns array of labels of polynoms.
 int getNumberOfPoints()
          Returns number of points used by getTArray.
 int[] getOrders()
          Returns orders of partial polynomials.
 double getPlottmax()
          Gets maximal time for plot.
 double getPlottmin()
          Gets minimal time for plot.
 Polynomials getPolynomials(int poz)
          Returns one set of partial polynomilas.
 int getSteps()
          Returns number of partial polynomials generated for each unknown function.
 double[] getTArray()
          Returns an array of time in range [tmin, tmax] which is going to have n values.
 double getTmax()
          Return maximal time for which were the polynomials generated.
 java.lang.String info()
          Returns a basic information about equations.
 void setNumberOfPoints(int numberOfPoints)
          Sets number of points used by getTArray to generate an array of time.
 void setPlottmax(double plottmax)
          Sets maximal time for plot.
 void setPlottmin(double plottmin)
          Sets minimal time for plot.
 int size()
          Returns number of polynomials in each set.
 java.lang.String toString()
          Returns string representation of polynomials.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Polyfit

public Polyfit(Element pol)
        throws taylor.XML.XMLReadException
Loads container from XML.

Parameters:
pol - Element representing sets of partial polynomials.
Throws:
taylor.XML.XMLReadException

Polyfit

public Polyfit(Polynomials pol)
Loads container with given partial polynomials.

Parameters:
pol - Partial polynomials to load container with.
Method Detail

appendResults

public void appendResults(Element pol)
                   throws taylor.XML.XMLReadException
Appends new sets of partial polynomials to this container.

Parameters:
pol - XML Element representing new sets of partial polynomials.
Throws:
taylor.XML.XMLReadException

appendResults

public void appendResults(Polyfit pol)
Appends sets of partial polynomials from different result.

Parameters:
pol - Sets of partial polynomials to be appended.

getNumberOfPoints

public int getNumberOfPoints()
Returns number of points used by getTArray.

Returns:
Number of points.

setNumberOfPoints

public void setNumberOfPoints(int numberOfPoints)
Sets number of points used by getTArray to generate an array of time.

Parameters:
numberOfPoints - Number of points.

getPlottmax

public double getPlottmax()
Gets maximal time for plot. This is used by getTArray.

Returns:
Maximal time.

setPlottmax

public void setPlottmax(double plottmax)
Sets maximal time for plot. This is used by getTArray.

Parameters:
plottmax - Maximal time.

getPlottmin

public double getPlottmin()
Gets minimal time for plot. This is used by getTArray.

Returns:
Minimal time.

setPlottmin

public void setPlottmin(double plottmin)
Sets minimal time for plot. This is used by getTArray.

Parameters:
plottmin - Minimal time.

getTArray

public double[] getTArray()
Returns an array of time in range [tmin, tmax] which is going to have n values.

Returns:
Array of times of ploting and evaluation.

getLabels

public java.lang.String[] getLabels()
Returns array of labels of polynoms.

Returns:
Array of labels.

eval

public double[] eval(java.lang.String label,
                     double[] t)
Evaluates requested unknow function at given times.

Parameters:
label - Label of unknow function to evaluate.
t - Times at which to evaluate.
Returns:
Result of unknow function.

eval

public double[] eval(double t)
Evaluates unknow functions at given time.

Parameters:
t - Time at which you want the results.
Returns:
y_i(t).

eval

public double[] eval(int order,
                     double t)
Evaluates given order at given time. It's similar to eval but it only evaluates at one time.

Parameters:
order - Order to evaluate.
t - Time at which you want the results.
Returns:
y_i^{(i)}(t_0) / i! * (t - t_0)^i

eval

public double[][] eval(double[] t)
Evaluates all results at given times.

Parameters:
t - Time array at which to evaluate results.
Returns:
Results of unknown functions at given times.

eval

public double[][] eval(int order,
                       double[] t)
Evaluates only given order at given times. The result is going to be:
y_i = y_i^{(i)}(t_0) / i! * (t - t_0)^i

Parameters:
order - Order i which you want to evaluate.
t - Time array at whcich to evaluate.
Returns:
Partial results.

eval

public double[][] eval(int polynomial,
                       int order,
                       double[] t)
Evaluates given polynomial and given order at times t. The differenc to eval is that this function evaluates only the given partial polynomial on entire t.

Parameters:
polynomial - Polynomial number to evaluate.
order - Order which you want to evaluate.
t - Time array at wchich to evaluate.
Returns:
Partial result of given polynomial.

getPolynomials

public Polynomials getPolynomials(int poz)
Returns one set of partial polynomilas. Polynomials are order from 0 to n as they were added.

Parameters:
poz - Which polynomial to return.
Returns:
Requested polynomial.

toString

public java.lang.String toString()
Returns string representation of polynomials.

Overrides:
toString in class java.lang.Object
Returns:
String representation of polynomials.

size

public int size()
Returns number of polynomials in each set. This is a number of unknown equations.

Returns:
Number of polynomials in each set.

info

public java.lang.String info()
Returns a basic information about equations.

Returns:
Basic information.

getTmax

public double getTmax()
Return maximal time for which were the polynomials generated.

Returns:
Maximal time.

getSteps

public int getSteps()
Returns number of partial polynomials generated for each unknown function.

Returns:
Number of partial polynomials.

getOrders

public int[] getOrders()
Returns orders of partial polynomials.

Returns:
Orders of partial polynomials.