Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

fast_callable x numpy

fast_callable is very handy for evaluating symbolic expressions with numpy arrays. Like

my_expr = integral(sin(x),x)
f = fast_callable(my_expr, vars=[x])

import numpy as np
z = np.linspace(0,10,5)
f(z)

However, it does't work when the expression involves a special function.

my_expr2 = integral(sin(x^2),x)
g = fast_callable(my_expr2, vars=[x])
g(z)

Throws The Function erf does not support numpy arrays as arguments.

Is there any way of turn symbolic expressions containing special functions into numpy-callable? Thus avoiding to rewrite them using scipy special functions?