symforce-org / symforce

Fast symbolic computation, code generation, and nonlinear optimization for robotics
https://symforce.org
Apache License 2.0
1.41k stars 145 forks source link

feat: Symbolic integration #379

Closed ThomasGreenhill closed 8 months ago

ThomasGreenhill commented 9 months ago

I'd like to use sympy's integrate API, similar to how sympy's diff API is already available through symforce.symbolic.

I'm hoping all that's required is adding a from sympy import integrate and a from symengine import integrate in symbolic.py.

Thanks in advance!

aaron-skydio commented 9 months ago

SymEngine doesn't have integrate except for series, as far as I can tell (unless they've added it recently). You can use sympy.integrate while using the SymEngine symbolic API the same way you can for sympy.solve, as suggested here: https://github.com/symforce-org/symforce/issues/376#issuecomment-1828514482, or you can use sf.sympy.integrate if using the SymPy symbolic API.

This should be easy to add though, like you said it would be as simple as from sympy import integrate when on the SymPy symbolic API, and a wrapper that calls the sympy version when on the SymEngine symbolic API, like we do for limit in symbolic.py.

ThomasGreenhill commented 9 months ago

Thanks for the quick response! I can definitely just use sympy integrate for the time being :)

ThomasGreenhill commented 8 months ago

Thanks a lot for taking care of that, Aaron. Much appreciated.

When will the next symforce release be cut?

aaron-skydio commented 8 months ago

We're planning to cut a release very soon, probably when numba 0.59 is out (the last of our dependencies to not have py3.12 support)