Class FuncUtils


  • public class FuncUtils
    extends java.lang.Object
    Utility methods associated with functions. This class contains only static methods.
    Since:
    15 Mar 2018
    Author:
    Mark Taylor
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double findValueMonotonic​(Function f, double xlo, double xhi, double y0, double ytol)
      Locates the X value where a supplied monotonically non-decreasing function is within a specified tolerance of a given Y value.
      static Function interpolateLinear​(NumericFunction nf)
      Returns a function which represents an interpolated representation of the given sample set, using linear interpolation.
      static Function interpolateQuadratic​(NumericFunction nf)
      Returns a function which represents an interpolated representation of the given sample set, using quadratic interpolation with Legendre polynomials.
      static Function interpolateSpline​(NumericFunction nf)
      Returns a function which represents an interpolated representation of the given sample set, using splines.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • interpolateQuadratic

        public static Function interpolateQuadratic​(NumericFunction nf)
        Returns a function which represents an interpolated representation of the given sample set, using quadratic interpolation with Legendre polynomials.
        Parameters:
        nf - input numeric function
        Returns:
        interpolated version of function
      • interpolateSpline

        public static Function interpolateSpline​(NumericFunction nf)
        Returns a function which represents an interpolated representation of the given sample set, using splines.
        Parameters:
        nf - input numeric function
        Returns:
        interpolated version of function
      • interpolateLinear

        public static Function interpolateLinear​(NumericFunction nf)
        Returns a function which represents an interpolated representation of the given sample set, using linear interpolation.
        Parameters:
        nf - input numeric function
        Returns:
        interpolated version of function
      • findValueMonotonic

        public static double findValueMonotonic​(Function f,
                                                double xlo,
                                                double xhi,
                                                double y0,
                                                double ytol)
        Locates the X value where a supplied monotonically non-decreasing function is within a specified tolerance of a given Y value. The bisection method is used. Behaviour is undefined if the supplied function is not monotonic.
        Parameters:
        f - monotonic function
        xlo - lowest X value to consider
        xhi - highest X value to consider
        y0 - required Y value
        ytol - tolerance in Y
        Returns:
        X value corresonding to y0, or NaN if it's not in range