Traceback (most recent call last):
File "./H.py", line 130, in <module>
r5 = newton_method(0, w())
File "./H.py", line 123, in newton_method
fprime = lambdify(t,diff(w(), t), 'numpy')
TypeError: 'Add' object is not callable
from sympy.utilities import lambdify
from sympy.abc import b, c, d, f as F, g, h, t , z, q
from sympy import diff
import numpy as np
def w(x=t):
return b*(x) + c*(x**2) + d*(x**3) + F*(x**4) + g*(x**5) + h*(x**6) - z
def m(x=t):
return b*x - z
def newton_method(x, w, n=5):
fprime = lambdify(t,diff(w(), t), 'numpy')
for i in range(n):
if fprime(x) == 0:
return x
x -= np.divide(lambdify(x, w(x), 'numpy'), fprime(x))
return x
r5 = newton_method(0, w())
r6 = newton_method(0, m(), 12)
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/94c5dd34-38c6-4a60-bba6-6bbf1500005e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.