Skip to content

Instantly share code, notes, and snippets.

@jdh30
Created November 21, 2022 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdh30/fa85479cb884e367cd16bf3b194a9989 to your computer and use it in GitHub Desktop.
Save jdh30/fa85479cb884e367cd16bf3b194a9989 to your computer and use it in GitHub Desktop.
Newton-Raphson root finder
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