Class FXYSum

    • Field Detail

      • FXY_LINEAR

        public static final FXY[] FXY_LINEAR
      • FXY_BI_LINEAR

        public static final FXY[] FXY_BI_LINEAR
      • FXY_QUADRATIC

        public static final FXY[] FXY_QUADRATIC
      • FXY_BI_QUADRATIC

        public static final FXY[] FXY_BI_QUADRATIC
      • FXY_CUBIC

        public static final FXY[] FXY_CUBIC
      • FXY_BI_CUBIC

        public static final FXY[] FXY_BI_CUBIC
      • FXY_4TH

        public static final FXY[] FXY_4TH
      • FXY_BI_4TH

        public static final FXY[] FXY_BI_4TH
    • Constructor Detail

      • FXYSum

        public FXYSum​(FXY[] functions)
        Constructs a new sum of terms sum(c[i] * f[i](x,y), i=0, n-1) for the given vector of functions. The vector c is initally set to zero and will remeain zero until the method approximate(double[][], int[]) is performed with given data on this function sum.
        Parameters:
        functions - the vector F of functions
      • FXYSum

        public FXYSum​(FXY[] functions,
                      int order)
        Constructs a new sum of terms sum(c[i] * f[i](x,y), i=0, n-1) for the given vector of functions and a polynomial order. The vector c is initally set to zero and will remeain zero until the method approximate(double[][], int[]) is performed with given data on this function sum.
        Parameters:
        functions - the vector F of functions
        order - the polynomial order (for descriptive purpose only), -1 if unknown
      • FXYSum

        public FXYSum​(FXY[] functions,
                      int order,
                      double[] coefficients)
        Constructs a new sum of terms sum(c[i] * f[i](x,y), i=0, n-1) for the given vector of functions and a polynomial order. The vector c is set by the coefficients parameter. The coefficients will be recalculated if the method approximate(double[][], int[]) is called.
        Parameters:
        functions - the vector F of functions
        order - the polynomial order (for descriptive purpose only), -1 if unknown
        coefficients - the vector c
    • Method Detail

      • createFXYSum

        public static FXYSum createFXYSum​(int order,
                                          double[] coefficients)
        Creates a FXYSum by the given order and coefficients.

        Note: This factory method supprots only the creation of instances of the following FXYSum classes:

        Parameters:
        order - the order of the sum
        coefficients - the coefficients
        Returns:
        returns a FXYSum instance, or null if the resulting instance is one of the supported.
      • createCopy

        public static FXYSum createCopy​(FXYSum fxySum)
        Creates a copy of the given fxySum.
        Parameters:
        fxySum - the FXYSum to copy
        Returns:
        a copy of the given FXYSum
      • getNumTerms

        public final int getNumTerms()
        Gets the number n of terms c[i] * f[i](x,y).
        Returns:
        the number of function terms
      • getFunctions

        public final FXY[] getFunctions()
        Gets the vector f of functions elements f[i](x,y).
        Returns:
        the vector F of functions
      • getCoefficients

        public final double[] getCoefficients()
        Gets the vector c of coefficient elements c[i].
        Returns:
        the vector F of functions
      • getOrder

        public int getOrder()
        Gets the polynomial order, if any.
        Returns:
        the polynomial order or -1 if unknown
      • getRootMeanSquareError

        public double getRootMeanSquareError()
        Gets the root mean square error.
        Returns:
        the root mean square error
      • getMaxError

        public double getMaxError()
        Gets the maximum, absolute error of the approximation.
        Returns:
        the maximum, absolute error
      • computeZ

        public double computeZ​(double x,
                               double y)
        Computes this sum of function terms z(x,y) = sum(c[i] * f[i](x,y), i=0, n-1). The method will return zero unless the approximate(double[][], int[]) is called in order to set the coefficient vector c.
        Parameters:
        x - the x value
        y - the y value
        Returns:
        the z value
        See Also:
        computeZ(FXY[], double[], double, double)
      • computeZ

        public static double computeZ​(FXY[] f,
                                      double[] c,
                                      double x,
                                      double y)
        Computes z(x,y) = sum(c[i] * f[i](x,y), i = 0, n - 1).
        Parameters:
        f - the function vector
        c - the coeffcient vector
        x - the x value
        y - the y value
        Returns:
        the z value
      • createCFunctionCode

        public String createCFunctionCode​(String fname,
                                          String x,
                                          String y)
        Returns this sum of function terms as human-readable C-code.
        Parameters:
        fname - the name of the function z(x,y) = sum(C[i]*F[i](x,y), i, n)
        x - the name of the x variable
        y - the name of the y variable
        Returns:
        the C-code