I am confused by sympy
. First some setup. I entered the following into a python console
>>> import sympy as smp
>>> x, y = smp.symbols('x y', real=True)
>>> f = smp.log(x) + y
followed by
>>> smp.lambdify(x, f)(1)
y
which makes sense to me.
Then I went on to enter
>>> smp.lambdify(y, f)(1)
AttributeError: 'Symbol' object has no attribute 'log'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "\<stdin\>", line 1, in \<module\>
File "\<lambdifygenerated-9\>", line 2, in \_lambdifygenerated
TypeError: loop of ufunc does not support argument 0 of type Symbol which has no callable log method
I did not think much of it, because it is plausible to me that just entering 1 can break things. But then
>>> smp.lambdify(y, f)(smp.sympify(1))
AttributeError: 'Symbol' object has no attribute 'log'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "\<stdin\>", line 1, in \<module\>
File "\<lambdifygenerated-10\>", line 2, in \_lambdifygenerated
TypeError: loop of ufunc does not support argument 0 of type Symbol which has no callable log method
and now I am confused over why not evaluating the logarithm breaks things. I will have a good time for the next few days if I can successfully evaluate y at a number of my choosing and get a sympy object again, so advice from someone who resolved this / found an alternative way of achieving my goal would be much appreciated!