This is the error I get when I try to run my code:
TypeError: loop of ufunc does not support argument 0 of type Zero which has no callable exp method
Now, ufunc is a lambdified function (which contains exponentials, in case you needed it), but I don't understand what this error means.
Edit: Here is part of the code:
x, nu, t = sympy.symbols('x nu t')
phi = (sympy.exp(-(x - 4 * t)**2 / (4 * nu * (t + 1))) +
sympy.exp(-(x - 4 * t - 2 * sympy.pi)**2 / (4 * nu * (t + 1))))
phiprime = phi.diff(x)
fig = plt.figure()
u = -2 * nu * (phiprime / phi) + 4
ufunc = lambdify((t,x,nu), u)
x = np.linspace(0, Dx * np.pi, nx)
t = 0
u = np.asarray([ufunc(t, x0, nu) for x0 in x])
At least the relevant part (the variables are declared and set before this and the animation function and plotting are after).
And here is the complete error message:
AttributeError: 'Zero' object has no attribute 'exp'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Utente\AppData\Local\Programs\Python\Python38\Step_4_NS.py", line 33, in <module>
u = np.asarray([ufunc(t, x0, nu) for x0 in x])
File "C:\Users\Utente\AppData\Local\Programs\Python\Python38\Step_4_NS.py", line 33, in <listcomp>
u = np.asarray([ufunc(t, x0, nu) for x0 in x])
File "<lambdifygenerated-1>", line 2, in _lambdifygenerated
return (-2*nu*(-1/4*(-8*t + 2*x)*exp(-1/4*(-4*t + x)**2/(nu*(t + 1)))/(nu*(t + 1)) - 1/4*(-8*t + 2*x - 4*pi)*exp(-1/4*(-4*t + x - 2*pi)**2/(nu*(t + 1)))/(nu*(t + 1)))/(exp(-1/4*(-4*t + x - 2*pi)**2/(nu*(t + 1))) + exp(-1/4*(-4*t + x)**2/(nu*(t + 1)))) + 4)
TypeError: loop of ufunc does not support argument 0 of type Zero which has no callable exp method
So? What does that error mean and how do i fix it?