Class FuncUtils

java.lang.Object
uk.ac.starlink.dpac.math.FuncUtils

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

    • 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