(function,function1,startingInt)
| 1 | # Newton's Method - https://en.wikipedia.org/wiki/Newton%27s_method |
| 2 | |
| 3 | def newton(function,function1,startingInt): #function is the f(x) and function1 is the f'(x) |
| 4 | x_n=startingInt |
| 5 | while True: |
| 6 | x_n1=x_n-function(x_n)/function1(x_n) |
| 7 | if abs(x_n-x_n1) < 10**-5: |
| 8 | return x_n1 |
| 9 | x_n=x_n1 |
| 10 | |
| 11 | def f(x): |
| 12 | return (x**3) - (2 * x) -5 |