Skip to content

Instantly share code, notes, and snippets.

@donabrams
Created September 4, 2012 14:24
Show Gist options
  • Select an option

  • Save donabrams/3621626 to your computer and use it in GitHub Desktop.

Select an option

Save donabrams/3621626 to your computer and use it in GitHub Desktop.
Newton's Metod
newtonApprox = (x0, f, fprime, error) ->
x1 = x0 - f(x0)/fprime(x0)
if Math.abs(x1-x0) < error
x1
else
newtonApprox(x1, f, fprime, error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment