FYI: maple supports python code generation

103 views
Skip to first unread message

Denis Akhiyarov

unread,
Jan 29, 2015, 2:02:25 AM1/29/15
to sy...@googlegroups.com
Has anyone tried out Python (sympy, numpy. scipy) code generation from Maple?


Python(proc (m) options operator, arrow; add(ithprime(i), i = 1 .. m) end proc) 

import sympy
 

def cg0 (m): 
   r = 0 
   for i in range(1, m + 1): 
       r = r + sympy.prime(i) 
   return(r)

Aaron Meurer

unread,
Jan 29, 2015, 12:45:35 PM1/29/15
to sy...@googlegroups.com
Thanks for pointing this out. That's pretty exciting. If someone has access to Maple 18, it would be great to see what all this does. It looks like it also uses NumPy and SciPy.

Aaron Meurer

--
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 sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/491d119b-e7f8-4c3f-a665-0d0da7872c8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aaron Meurer

unread,
Jan 29, 2015, 12:48:47 PM1/29/15
to sy...@googlegroups.com
I searched the Maple docs, but the only mention of SymPy is that one example. I'm curious what all functions from SymPy they use. Is it only number theory functions that aren't in stdlib math or numpy/scipy?

Aaron Meurer

David Verelst

unread,
Jan 29, 2015, 4:35:44 PM1/29/15
to sy...@googlegroups.com
Interesting. I haven't used Maple in years, but they have it here at work. I'll see if I can check out somewhere next week.

On a slightly related note, a year ago I tried to create a Maple workbook to Python/Sympy (or IPython notebook) converter. It uses pyparsing to parse the Maple syntax. A big Maple workbook is included for testing. I never solved all the corner cases though...but the general principle worked. I am not sure how useful it is, but if someone is interested in helping out we might get it to work a little better? Be advised, you'll notice that my coding skills are not top notch... The code is here: https://github.com/davidovitch/maple-to-python (in case the GPL3 license is too restrictive: this can be changed.)

Regards,
David

Aaron Meurer

unread,
Jan 29, 2015, 4:38:25 PM1/29/15
to sy...@googlegroups.com
It sounds like something that could be useful as sympy.parsing.maple (we already have a pretty simple sympy.parsing.mathematica). The GPL would obviously have to be changed to BSD to do that.

Aaron Meurer

Reply all
Reply to author
Forward
0 new messages