mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-25 10:28:39 +00:00
Update arithmetic_analysis/newton_raphson.py
Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
parent
baa524385a
commit
4074513e9c
@ -20,12 +20,10 @@ def newton_raphson(func: str, a: float, precision: float = 10**-10) -> float:
|
||||
"""
|
||||
x = a
|
||||
symbol = symbols("x")
|
||||
exp = sympify(
|
||||
func
|
||||
) # expressions to be represented symbolically and manipulated algebraically
|
||||
exp_diff = diff(
|
||||
exp, symbol
|
||||
) # calculates the derivative value at the current x value
|
||||
# expressions to be represented symbolically and manipulated algebraically
|
||||
exp = sympify(func)
|
||||
# calculate the derivative value at the current x value
|
||||
exp_diff = diff(exp, symbol)
|
||||
maximum_iterations = 100
|
||||
|
||||
for _ in range(maximum_iterations):
|
||||
|
Loading…
x
Reference in New Issue
Block a user