Deutsch English Français Italiano |
<newton-20240921151727@ram.dialup.fu-berlin.de> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail From: ram@zedat.fu-berlin.de (Stefan Ram) Newsgroups: comp.lang.python Subject: Re: Beazley's Problem Date: 21 Sep 2024 14:18:07 GMT Organization: Stefan Ram Lines: 8 Expires: 1 Jul 2025 11:59:58 GMT Message-ID: <newton-20240921151727@ram.dialup.fu-berlin.de> References: <problem-20240921130726@ram.dialup.fu-berlin.de> <87tte941ko.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de 4rTPyldfPqZz+oTTP2mQ9gEMoZMVZbiq1yiu3lcLd2/rcw Cancel-Lock: sha1:8Ug6AdJFZziZ8IpkwDTVwKuf+As= sha256:yH8Kc0U2+QSOvLgAho02Vai+WjSXp1b1ozYdpXYriow= X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved. Distribution through any means other than regular usenet channels is forbidden. It is forbidden to publish this article in the Web, to change URIs of this article into links, and to transfer the body without this notice, but quotations of parts in other Usenet posts are allowed. X-No-Archive: Yes Archive: no X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some services to mirror the article in the web. But the article may be kept on a Usenet archive server with only NNTP access. X-No-Html: yes Content-Language: en-US Bytes: 1722 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!