Sujet : Re: Beazley's Problem
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.pythonDate : 21. Sep 2024, 16:18:07
Autres entêtes
Organisation : Stefan Ram
Message-ID : <newton-20240921151727@ram.dialup.fu-berlin.de>
References : 1 2
Paul Rubin <
no.email@nospam.invalid> wrote or quoted:
def ddx(f,x,h=0.001): return (f(x+h)-f(x-h))/(2*h) # numerical derivative
def newton(f,x0): return x0 - f(x0)/ddx(f,x0) # Newton-Raphson iteration
It's hella rad to see you bust out those "next-level math tricks"
with just a single line each!