sympy / numba #25391
Replies: 8 comments 2 replies
-
You should be able to use numba on any numerical function, i.e. whatever comes out of lambdify. Here is an PR that seems to show how someone else used it: https://github.com/sympy/sympy/pull/20088/files |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot! |
Beta Was this translation helpful? Give feedback.
-
My experience with Numba and I'd also suggest using |
Beta Was this translation helpful? Give feedback.
-
Thanks for the hint! '@njit Thanks again! |
Beta Was this translation helpful? Give feedback.
-
No, Numba would fail in that case because SciPy's |
Beta Was this translation helpful? Give feedback.
-
Thanks!! |
Beta Was this translation helpful? Give feedback.
-
Numba is very strict, especially when using |
Beta Was this translation helpful? Give feedback.
-
By the way, you don't need the level of indirection here. Putting force_vector_lam = njit(sympy.lambdify(parameters, force_vector, cse=True)) |
Beta Was this translation helpful? Give feedback.
-
I play around a lot with sympy.physics.mechanics, which invariably leads to numerically solving differentual equations.
I heared, that numba can speed up the execution, and I would like to test it.
Let's say I have a function like this:
force_vector_lam = sympy.lambdify(parameters, force_vector, cse=True)
Would this be correct:
from numba import jit
@jit
def force_vector_num(parameters):
return force_vector_lam(parameters)
Thanks a lot for any advice!!
Beta Was this translation helpful? Give feedback.
All reactions