uk.ac.ed.ph.integrator
Class DataPoint

java.lang.Object
  extended by uk.ac.ed.ph.integrator.DataDerivative
      extended by uk.ac.ed.ph.integrator.DataPoint
All Implemented Interfaces:
Cloneable

public class DataPoint
extends DataDerivative

Class to hold a single DataPoint consisting of an x coordinate and a array of y coordinates for use in integrator methods.


Field Summary
 
Fields inherited from class uk.ac.ed.ph.integrator.DataDerivative
fmt, x, y
 
Constructor Summary
DataPoint()
          Default constrcuor, set x=0 and y[] array to null
DataPoint(double x, double[] y)
          Constructor to form a DataPoint from a x coordinate and y array
DataPoint(int size)
          Constrcuor to form a DataPoint with specified size of y array, and all values are set to zero
 
Method Summary
 void addToX(double step)
          Method add to the current value of the X.
 void addToY(int i, double delta)
          Method to add to a single y element.
 DataPoint clone()
          Method to return a clone of the current DataPoint including a copy of the y array.
 double error(DataPoint p)
          The default error between two DataPoints, currently set as the normalsied square error
 DataPoint eulerStep(DataDerivative delta, double step)
          Method to for a new DataPoint by propagating the current point a specified distance (step), with the differentials in delta using the simple Euler scheme
 String formatPoint()
          Method to format a point as a String for file output with x value and each y[] element seperated by a space.
 double maximumError(DataPoint p)
          Method to calcuate the absolute maximum error between elemenst of the y paramter array
 void setDefaultError(int code)
          Method to set the default error
 double squareError(DataPoint p)
          Calcualte the normalsied square error between the current DataPoint as the specified DataPoint
 DataPoint weightedStep(DataDerivative[] delta, double[] w, double step)
          Method to a new DataPoint be propagating the current DataPoint by a weighted step.
 
Methods inherited from class uk.ac.ed.ph.integrator.DataDerivative
getX, getY, getY, setFormatString, setX, setY, setY, size, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataPoint

public DataPoint()
Default constrcuor, set x=0 and y[] array to null


DataPoint

public DataPoint(double x,
                 double[] y)
Constructor to form a DataPoint from a x coordinate and y array

Parameters:
x - the x value
y - the y data array

DataPoint

public DataPoint(int size)
Constrcuor to form a DataPoint with specified size of y array, and all values are set to zero

Parameters:
size - size of y variable array
Method Detail

clone

public DataPoint clone()
Method to return a clone of the current DataPoint including a copy of the y array.

Overrides:
clone in class DataDerivative
Returns:
DataPoint clone of current DataPoint

addToX

public void addToX(double step)
Method add to the current value of the X.

Parameters:
step - the value to ve added.

addToY

public void addToY(int i,
                   double delta)
Method to add to a single y element.

Parameters:
i - the element to be set
delta - the valeu to be added.

formatPoint

public String formatPoint()
Method to format a point as a String for file output with x value and each y[] element seperated by a space.

Returns:
String formatted String.

squareError

public double squareError(DataPoint p)
Calcualte the normalsied square error between the current DataPoint as the specified DataPoint

Parameters:
p - the specified DataPoint
Returns:
double Normalsied square error.

maximumError

public double maximumError(DataPoint p)
Method to calcuate the absolute maximum error between elemenst of the y paramter array

Parameters:
p - the spefied DataPoint
Returns:
double the absolute maximun error (not normalsied)

setDefaultError

public void setDefaultError(int code)
Method to set the default error


error

public double error(DataPoint p)
The default error between two DataPoints, currently set as the normalsied square error

Parameters:
p - the specified DataPoint
Returns:
double the default error

eulerStep

public DataPoint eulerStep(DataDerivative delta,
                           double step)
Method to for a new DataPoint by propagating the current point a specified distance (step), with the differentials in delta using the simple Euler scheme

Parameters:
delta - the specified differential
step - the step distance.

weightedStep

public DataPoint weightedStep(DataDerivative[] delta,
                              double[] w,
                              double step)
Method to a new DataPoint be propagating the current DataPoint by a weighted step.

Parameters:
delta - array of differntials
w - the wieght of the corresponding differentials (assumed to sum to 1.0)
step - the step
Returns:
DataPoint the wiegthed steped DataPoint.