Best GUI for sympy with Latex formatting... how do I force Latex printing of a function ?

75 views
Skip to first unread message

linux guy

unread,
Jan 3, 2020, 1:18:34 AM1/3/20
to sympy

Hi.

I'm working on a big math problem.   Sympy is saving my butt.  Many thanks for this excellent tool.  Open source rules !

What is the best (gui) environment to run sympy in ?  

I love seeing equations formatted in Latex so that I can be sure the code I am writing in python is matching what I want the equation to be.  It's also great to copy and paste Latex equations into my documentation, rather than a line of python.

I've been using the Jupyter notebook, but I don't usually use an interactive shell.  I find Jupyter notebook to be kind of clumsy.

I develop in Fedora, so I am familiar with Spyder, Eclipse, Kwrite, Konsole, etc.  I prefer to write code and run it.  If I do that, how do I force sympy to output symbols in Latext (to a console) ?

Also, if I run this code in Jupyter, it outputs the latext equation for width in Latex.

width = r*cos(theta)*sin(phi)
width

But if I run this code in Jupyter cell, it only outputs phi, not width

width = r*cos(theta)*sin(phi)
width
phi = symbols('phi')
phi

Why ?

And if I run print(latex(width)) it will output "width" in Latex, not the equation that is assigned to width.

How do I get sympy to output the equation of width in Latex ?

Better yet, how do I get sympy to output "width =... equation..." in Latex ?

Thank you.


linux guy

unread,
Jan 3, 2020, 1:21:19 AM1/3/20
to sympy

One other thing... I see that sympy appears to be used in Octave !  Personally, I'd rather work in Python than Octave, but I'd rather work in Octave than Jupyter.  Is there a way to get latex output from sympy in Octave ? 

linux guy

unread,
Jan 3, 2020, 1:31:16 AM1/3/20
to sympy

Maybe I just don't know how to use Jupyter very well...

Lets say that I have 30 code cells in Jupyter, each with a few lines of python in them.   And I'm happy with how everything runs.   Is there an easy way to export just the code cells to a file, without manually cutting and pasting them individually ?

There is file->download as -> Python.py, but it puts blank lines between the code lines and includes the output lines.  Kind of a pain... If it exported cleanly, I could do all my math development in a Jupyter notebook and then export the code to a file when I was done.   This way if I make a change to the notebook I have to re export the code and then spend time cleaning it up.   Write a script ?   Am I the only one that thinks this way ?

Other things I don't like about Jupyter include the lack of key shortcuts for simple things like deleting a cell... am I missing something ?

Aaron Meurer

unread,
Jan 3, 2020, 3:13:05 AM1/3/20
to sympy
Jupyter is what I'd generally recommend. Jypyter lab is newer than the
notebook so I would suggest using that.

Another thing you can try is Spyder, which supports SymPy LaTeX output
and is better if you are trying to edit .py files.

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 view this discussion on the web visit https://groups.google.com/d/msgid/sympy/62427a0c-7042-4cc1-baa9-c773bcf9d9a7%40googlegroups.com.

Jason Moore

unread,
Jan 3, 2020, 9:04:52 AM1/3/20
to sympy
You could use the qtconsole version of IPython. I think that may be what Spyder defaults to.

Jason

Reply all
Reply to author
Forward
0 new messages