{ } Raw JSON

bundles / scipy 1.17.1 / scipy / interpolate / _fitpack_repro / root_rati

function

scipy.interpolate._fitpack_repro:root_rati

source: /scipy/interpolate/_fitpack_repro.py :825

Signature

def   root_rati ( f p0 bracket acc )

Summary

Solve f(p) = 0 using a rational function approximation.

Extended Summary

In a nutshell, since the function f(p) is known to be monotonically decreasing, we

  • maintain the bracket (p1, f1), (p2, f2) and (p3, f3)

  • at each iteration step, approximate f(p) by a rational function r(p) = (u*p + v) / (p + w) and make a step to p_new to the root of f(p): r(p_new) = 0. The coefficients u, v and w are found from the bracket values p1..3 and f1...3

The algorithm and implementation follows https://github.com/scipy/scipy/blob/maintenance/1.11.x/scipy/interpolate/fitpack/fpcurf.f#L229 and https://github.com/scipy/scipy/blob/maintenance/1.11.x/scipy/interpolate/fitpack/fppara.f#L290

Note that the latter is for parametric splines and the former is for 1D spline functions. The minimization is indentical though [modulo a summation over the dimensions in the computation of f(p)], so we reuse the minimizer for both d=1 and d>1.

Aliases

  • scipy.interpolate._fitpack_repro.root_rati