Using lambdastr for copy and paste into non-python programing language

19 views
Skip to first unread message

Adam Lange

unread,
Oct 7, 2016, 12:32:26 PM10/7/16
to sympy
Hello,

I formulated a long expression using sympy.  I have to say, when I pressed enter and the expression was printed to the console, I was super glad that I didn't have to write it all out by hand.

Now I need to numerically evaluate this string using another language - either c or modelica.

>>>lambdastr((),longExpression)

I could almost copy and paste the output from the above command into c.  The biggest problem are the exponential terms.  Is there a way to make lambdastr express exponents in a 'c' way, with pow()?

Thanks,
Adam

Aaron Meurer

unread,
Oct 7, 2016, 12:33:07 PM10/7/16
to sy...@googlegroups.com
Use ccode() to convert expressions to C. 

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+unsubscribe@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/f9854130-9c74-4f77-afeb-156d916881d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adam Lange

unread,
Oct 7, 2016, 3:23:58 PM10/7/16
to sympy
Awesome.  Thank you.
Reply all
Reply to author
Forward
0 new messages