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

I got the error before this, after I run these functions:


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)


What am I missing?



-- 
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 [email protected].
To post to this group, send email to [email protected].
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.

Reply via email to