kroghInterpolate#

swordfish.function.kroghInterpolate()#

Interpolating polynomial for a set of points. The polynomial passes through all the pairs (X, Y) and returns the derivative interpolated at the x-points.

One may additionally specify a number of derivatives at each point Xi; this is done by repeating the value Xi and specifying the derivatives as successive Yi values.

  • When the vector of Xi contains only distinct values, Yi represents the function value.

  • When an element of Xi occurs two or more times in a row, the corresponding Yi represents derivative values. For example, if X = [0,0,1,1] and Y = [1,0,2,3], then Y[0]=f(0), Y[1]=f’(0), Y[2]=f(1) and Y[3]=f’(1).

Parameters:
  • X (Constant) – A numeric vector indicating the x-coordinates. It must be sorted in increasing order with no null values contained.

  • Y (Constant) – A numeric vector of the same length as Xi, indicating the y-coordinates. It cannot contain null values.

  • newX (Constant) – A numeric vector specifying the points at which to evaluate the derivatives.

  • der (Constant, optional) – A non-negative integer indicating how many derivatives to evaluate. The default value is 0, meaning the function value is used as the 0th derivative.