mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-18 16:27:02 +00:00
Removed Unnecessary Assignment for 'error' Var (#920)
`error = abs(f(a))` was declared on line 24 and line 32. It is unnecessary to have in both places.
I removed the second instance since it wastes resources to keep redefining the variable inside the for loop.
This fixes an [issue found by lgtm](66c4afbd0f/files/maths/newton_raphson.py
)
This commit is contained in:
parent
234b0a77c4
commit
2b365284c8
|
@ -29,7 +29,6 @@ def newton_raphson(f, x0=0, maxiter=100, step=0.0001, maxerror=1e-6,logsteps=Fal
|
|||
a = a - f(a)/f1(a) #Calculate the next estimate
|
||||
if logsteps:
|
||||
steps.append(a)
|
||||
error = abs(f(a))
|
||||
if error < maxerror:
|
||||
break
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue
Block a user