MCPcopy Index your code
hub / github.com/RustPython/RustPython / _newton_raphson

Function _newton_raphson

Lib/statistics.py:875–882  ·  view source on GitHub ↗
(f_inv_estimate, f, f_prime, tolerance=1e-12)

Source from the content-addressed store, hash-verified

873 return pdf, cdf, invcdf, support
874
875def _newton_raphson(f_inv_estimate, f, f_prime, tolerance=1e-12):
876 def f_inv(y):
877 "Return x such that f(x) ≈ y within the specified tolerance."
878 x = f_inv_estimate(y)
879 while abs(diff := f(x) - y) > tolerance:
880 x -= diff / f_prime(x)
881 return x
882 return f_inv
883
884def _quartic_invcdf_estimate(p):
885 # A handrolled piecewise approximation. There is no magic here.

Callers 2

quartic_kernelFunction · 0.85
triweight_kernelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected