mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Remove Multiple Unused Imports and Variable
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import math
|
||||
import numpy
|
||||
|
||||
def LUDecompose (table): #table that contains our data
|
||||
def LUDecompose (table):
|
||||
#table that contains our data
|
||||
#table has to be a square array so we need to check first
|
||||
rows,columns=numpy.shape(table)
|
||||
L=numpy.zeros((rows,columns))
|
||||
@@ -31,4 +31,4 @@ def LUDecompose (table): #table that contains our data
|
||||
matrix =numpy.array([[2,-2,1],[0,1,2],[5,3,1]])
|
||||
L,U = LUDecompose(matrix)
|
||||
print(L)
|
||||
print(U)
|
||||
print(U)
|
||||
|
||||
@@ -3,16 +3,14 @@
|
||||
|
||||
from sympy import diff
|
||||
from decimal import Decimal
|
||||
from math import sin, cos, exp
|
||||
|
||||
def NewtonRaphson(func, a):
|
||||
''' Finds root from the point 'a' onwards by Newton-Raphson method '''
|
||||
while True:
|
||||
x = a
|
||||
c = Decimal(a) - ( Decimal(eval(func)) / Decimal(eval(str(diff(func)))) )
|
||||
|
||||
x = c
|
||||
a = c
|
||||
|
||||
# This number dictates the accuracy of the answer
|
||||
if abs(eval(func)) < 10**-15:
|
||||
return c
|
||||
|
||||
Reference in New Issue
Block a user