Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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