I've just started using numexpr's evaluate function and I've come across an annoying error.
I want it to print, per se, sin(10), and it does that just perfectly, but if I do sec(10), I get "TypeError: 'VariableNode' object is not callable"
Example code:
import mpmath as mp
from numexpr import evaluate as ne
cos = mp.cos
sin = mp.sin
csc = mp.csc
sec = mp.sec
print(ne('cos(50)'))
>>> 0.9649660284921133
print(ne('sin(50)')
>>> -0.26237485370392877
print(ne('csc(50)')
>>> TypeError: 'VariableNode' object is not callable
print(ne('sec(50)')
>>> TypeError: 'VariableNode' object is not callable
When I use eval, it instead returns the correct values, like it should.
Why does this occur? Is it because numexpr is an expansion of numpy and automatically sources its functions from numpy (numpy doesn't have sec, csc, cot) and thus, cannot source functions from mpmath?
Many thanks in advance! :)