Created
November 21, 2022 11:47
-
-
Save jdh30/fa85479cb884e367cd16bf3b194a9989 to your computer and use it in GitHub Desktop.
Newton-Raphson root finder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let δ = ∛ ε | |
let d f x = (f(x+δ) - f(x-δ))/(2*δ) | |
let rec fixedPoint f x = | |
let fx = f x in | |
if fx = x then x else fixedPoint f fx | |
let newtonRaphson f df x = fixedPoint [x → x - f x / df x] x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment