Last update: 11 September 2012                                                                                                                              Main Page of Michael Thomas Flanagan's Java Scientific Library

This class contains the constructor and methods for performing an interpolation within a four dimensional array of data points, y = f(x1,x2,x3, x4), using a natural quadricubic spline.

The class, PolyCubicSplineFast, may be faster if repeated interpolation within large data arrays is to be performed.

SUMMARY OF CONSTRUCTOR AND METHODS

 Constructor public QuadriCubicSpline(double[] x1, double[] x2, double[] x3, double[] x4, double[][][][] y) Interpolate public double interpolate(double xx1, double xx2, double xx3, double xx4) Rounding Error Options public static void noRoundingErrorCheck() public static void potentialRoundingError(double potentialRoundingError)

CONSTRUCTOR

CONSTRUCTOR
public QuadriCubicSpline(double[] x1, double[] x2, double[] x3, double[] x4, double[][][][] y)
Creates an instance of the QuadriCubicSpline object with its internal data arrays initialised to copies of the values in the x1, x2, x3, x4 and y arrays where y is the tabulated function y = f(x1, x2, x3, x4). The variables x1, x2, x3 and x4 are are one dimensional arrays of type double and y is an four-dimensional array of doubles containing the tabulated values of y = f(x1,x2,x3,x4). The y elements are ordered as {{{{f(x1[0],x2[0],x3[0],x4[0]),  f(x1[0],x2[0],x3[0],x4[1]) . . . f(x1[0],x2[0],x3[0],x4[r-1])} , {etc.
i.e. as in the order of the following nested for loops if you were reading in or calculating the tabulated data:
for(int i=0; i<x1.length; i++){
for(int j=0; j<x2.length; j++){
for(int k=0; k<x3.length; k++){
for(int l=0; l<x4.length; l++){
yValues[i][j][k][l] = 'read statement' or 'calculation of f(x1, x2, x3, x4)';
}
}
}
}

METHODS

INTERPOLATION
public double interpolate(double xx1, double xx2, double xx3, double xx4)
Usage:                      y1 = aa.interpolate(xx1, xx2, xx3, xx4);
Returns the interpolated value of y, y1, for given values of xx1, xx2, xx3 and xx4, using the y=f(x1, x2, x3, x4) data entered via the constructor. This method may be called as often as required. The inner second derivatives needed for the interpolation are calculated and stored on instantiation so that they need not be recalculated on each call to this method. This method throws an IllegalArgumentException if xx1, xx2, xx3 or xx4 is outside the range of the values of x1[], x2[], x3[] or x4[] supplied to the constructor or if two x1, x2, x3 or x4 values within the y = f(x1,x2,x3,x4) data set are identical.

ROUNDING ERROR OPTIONS
public static void noRoundingErrorCheck()
Seveveral applications that call QuadriCubicSpline, e.g. plotting programs, may calculate an array of points to be fed to an instance of cubic spline that should lie between the limits initially supplied to the instance but which, due to rounding errors in the calculation of the array, may have extreme values that lie outside the limits by the an amount equal to the rounding error, e.g. an array that should lie between limits of 0 and 4 may run from 0 to 4.0000000000000003. The default option of the QuadriCubicSpline class is to check for such violations of the order of a rounding error and round the extreme value to the limit thus preventing an out of range exception being thrown. This method allows this default option to be ignored so that an out of range exception is thrown if any value lies outside he range of the limis no matter how small the violation is.

public static void potentialRoundingError(double potentialRoundingError)