Created
August 16, 2018 18:32
-
-
Save 19007361/a3357f99893d80a754d7eab7b50dddb0 to your computer and use it in GitHub Desktop.
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
def secant(p, pOld, tol, iters): | |
iters -= 1 | |
pOld = p | |
pNew = p - (f(p))*(p - pOld) | |
if abs(pNew - p) < tol or iters == 0: | |
return pNew | |
else: | |
secant(pNew, pOld, tol) | |
def f(x): | |
if __name__ == "__main__": | |
secant( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment