Most of my schoolwork for numerical analysis is done in excel, so I use excel functions extensively. However, I would like to start incorporating sympy into my workflow.
My question is is there a way to print functions from sympy to make them copy-paste-able to excel? What I end up doing when I get my output in sympy is reformatting it for excel i.e., regroup some terms so they are clearer to excel, and more often, change ** to ^.
I am aware that I can simply use mathematica for this, which prints my output to plaintext (where exponents are by default expressed with ^), but I am wondering if I can do the same with sympy.
If mathematica style output is sufficient then the following should do:
import sympy
from sympy.printing import mathematica_code
x = sympy.symbols('x')
sympy.printing.mathematica_code(sympy.integrate(x**2,x))
Documentation here.
There are lots of other printing options which might work even better than mathematica style output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With