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:
PatOnTheBack 2019-07-07 11:45:42 -04:00 committed by John Law
parent 234b0a77c4
commit 2b365284c8

View File

@ -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: