Hello, let's say I'd like to numerically evaluate a single sympy function over an array using sympy as the module. Curiously, passing in regular Python's float numbers makes the evaluation much faster then passing in Sympy's Float instances. I tried several sympy functions, they tend to follow this trend.
Why does this happen? Considering that the following lambda function always return Float instances, I thought that the input was sympified inside a sympy function, thus making the actual python's float evaluation slower due to casting... from sympy import * import numpy as np from mpmath import mpf func = sin(x) f = np.frompyfunc(lambdify(x, func, "sympy"), 1, 1) domain = np.linspace(0, 100, 1000) domain_mpf = [mpf(str(t)) for t in domain] domain_sympy = [Float(t) for t in domain] %timeit f(domain) %timeit f(domain_mpf) %timeit f(domain_sympy) -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/sympy/0bac1ecd-52b2-4256-a1e6-90fa7c502030n%40googlegroups.com.
