Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions NeutonMethod.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import math

def newton(function,function1,startingInt): #function is the f(x) and function1 is the f'(x)
x_n=startingInt
while True:
Expand All @@ -9,9 +7,9 @@ def newton(function,function1,startingInt): #function is the f(x) and function1
x_n=x_n1

def f(x):
return math.pow(x,3)-2*x-5
return (x**3)-2*x-5

def f1(x):
return 3*math.pow(x,2)-2
return 3*(x**2)-2

print(newton(f,f1,3))
print(newton(f,f1,3))