This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / interpolate / _fitpack_repro / add_knot

function

scipy.interpolate._fitpack_repro:add_knot

source: build-install/usr/lib/python3.14/site-packages/scipy/interpolate/_fitpack_repro.py:76

Signature

def add_knot(x, t, k, residuals, periodic = False)

Summary

Add a new knot.

Extended Summary

(Approximately) replicate FITPACK's logic:

  • split the x array into knot intervals, t(j+k) <= x(i) <= t(j+k+1)

  • find the interval with the maximum sum of residuals

  • insert a new knot into the middle of that interval.

NB: a new knot is in fact an x value at the middle of the interval. So the knots are a subset of `x`.

This routine is an analog of https://github.com/scipy/scipy/blob/v1.11.4/scipy/interpolate/fitpack/fpcurf.f#L190-L215 (cf _split function)

and https://github.com/scipy/scipy/blob/v1.11.4/scipy/interpolate/fitpack/fpknot.f

Aliases

  • scipy.interpolate._fitpack_repro.add_knot