Use of symengine via Sympy

137 views
Skip to first unread message

schw...@gmail.com

unread,
Dec 31, 2017, 10:32:45 AM12/31/17
to symengine
Hi!
First and foremost, Thank you all for your work/support/community in symengine!
At our institute we all use proprietary software for symbolic computation. This particular one has a horrible syntax. Sympy as a solution to price and fitness would be great, would there not be the major drawback of speed.
Symengine to the rescue. I calculated the forward dynamics of a 7-Axis Robot manipulator using symengine and it's matrix functions (most notably jacobian). This is great and in terms of speed well comparable to the proprietary solution we would otherwise use! Both implementations run in at around 2min.

My question is twofold,
for day-to-day use I need 2 more thing out of my current "uneducated" workflow:
1) Display in Jupyter: at the moment I convert all my expressions to sympy and display those, but this often takes long - this would be one bottleneck I can live with, because for very long expressions, displaying is very hard anyway.

2) Simplify trigonometric expressions. In mechanics you have a lot of sin**2 + cos**2 expressions and other trigonometric identities which not only simplify expressions, but also make numeric evaluation faster and more precise. I found a trig_simp() function in symengine's code, but I cannot seem to think of a way to expose it to sympy. Can you tell me, if this is implemented yet, or at "worst" guide me how to extend the python wrapper to get this function into my calculation?

Thanks again,
Mike

Isuru Fernando

unread,
Dec 31, 2017, 11:20:03 AM12/31/17
to symengine, Shikhar Jaiswal
Hi,

On Sun, Dec 31, 2017 at 8:57 PM, <schw...@gmail.com> wrote:
Hi!
First and foremost, Thank you all for your work/support/community in symengine!
At our institute we all use proprietary software for symbolic computation. This particular one has a horrible syntax. Sympy as a solution to price and fitness would be great, would there not be the major drawback of speed.
Symengine to the rescue. I calculated the forward dynamics of a 7-Axis Robot manipulator using symengine and it's matrix functions (most notably jacobian). This is great and in terms of speed well comparable to the proprietary solution we would otherwise use! Both implementations run in at around 2min.
 
Nice to know that you've found symengine useful.


My question is twofold,
for day-to-day use I need 2 more thing out of my current "uneducated" workflow:
1) Display in Jupyter: at the moment I convert all my expressions to sympy and display those, but this often takes long - this would be one bottleneck I can live with, because for very long expressions, displaying is very hard anyway.

Do you mean outputting as Latex? We'd welcome a PR adding latex printing. It should be easy to do.


2) Simplify trigonometric expressions. In mechanics you have a lot of sin**2 + cos**2 expressions and other trigonometric identities which not only simplify expressions, but also make numeric evaluation faster and more precise. I found a trig_simp() function in symengine's code, but I cannot seem to think of a way to expose it to sympy. Can you tell me, if this is implemented yet, or at "worst" guide me how to extend the python wrapper to get this function into my calculation?

 
There's no such functionality as of yet. We've been experimenting with using sympy's python code with symengine as the backend. I don't know the status of the simplify module. Shikhar, do you know whether we can use symengine as the backend for sympy.simplify code?

Isuru

Thanks again,
Mike

--
You received this message because you are subscribed to the Google Groups "symengine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to symengine+unsubscribe@googlegroups.com.
To post to this group, send email to syme...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/symengine/a4e73e31-bdab-4a37-8070-4331080171c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shikhar Jaiswal

unread,
Dec 31, 2017, 2:17:07 PM12/31/17
to symengine
Hi,


There's no such functionality as of yet. We've been experimenting with using sympy's python code with symengine as the backend. I don't know the status of the simplify module. Shikhar, do you know whether we can use symengine as the backend for sympy.simplify code?

I had worked briefly over the summers on the Simplify module in SymPy. But unfortunately, it is one of those modules requiring a ton of work. I had opened a PR here, but as you can see, a lot of imports are still needed to be cleared. Though the changes created in the PR passed the tests locally, for some reason Travis builds failed, and I wasn't able to figure out why. Simplify module is pretty dense and even tracing the errors cost me a huge amount of time. I made a few notes for future use (which I'll put up very soon), but other than that, not much progress.

Shikhar
Reply all
Reply to author
Forward
0 new messages