question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inconsistancies in math formula display (ipython console)

See original GitHub issue

Problem Description

Hi, Displaying math formula as png in the console provides ‘random’ output. Whereas the same works fine in a jupyter notebook. I’ve already asked sympy (sympy/sympy#20491), but I guess it is a spyder issue as it works in a notebook?

What steps reproduce the problem?

eg (in the spyder IPython console):

import sympy as sp
sp.var(x)
x*x

image

Ok fine, now: image

Switch to pretty print mode (no image)!

Another example (from IPython doc)

from IPython.display import Math
Math(r'F(k) = \int_{-\infty}^{\infty} f(x) e^{2\pi i k} dx')
Out[1]: 
<IPython.core.display.Math object>

While in a ‘pure’ notebook: image

Versions

Anaconda 3 (updated) spyder 4.1.5

Hope this helps, thanks.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
steff456commented, Dec 1, 2020

Ok, for getting the expected result you need to:

  1. Install Latex in your machine (Miktex in Windows, Texlive in macOS/Linux)
  2. Create a new special console for Sympy in the hamburger menu of the IPython console, so Consoles > New special console > New Sympy console

If you don’t want to use the Sympy console, then you need to read the following documentation to make it work, https://docs.sympy.org/latest/modules/interactive.html?highlight=init_printing#sympy.interactive.printing.init_printing

Please let me know if it works for you

0reactions
ccordoba12commented, Dec 3, 2020

No worries @sylvain-bougnoux.

I forgot to mention that next year we plan to add a new Viewer pane to visualize web content directly inside Spyder. Then we’ll be able to display Sympy objects exactly as it’s done in a Jupyter notebook.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix the display issues with Pretty-Printing of symbolic ...
All we need to do is, go to Preferences-> IPython Console-> Advanced settings-> check use symbolic math. If you want to set a...
Read more >
Can Python/IPython display "pretty math"? - Reddit
Yes, the notebook and qtconsole both have support for latex. SymPy does symbolic calculations like Maple or Wolfram, and it shows it all...
Read more >
Latex equations not rendered in Jupyterlab
I am using jupyter lab on my MacOS with following details; jupyter core : 4.6.3 jupyter-notebook : 6.1.4 qtconsole : 4.7.7 ipython :...
Read more >
LaTeX/Mathematics - Wikibooks, open books for an open world
Typesetting mathematics is one of LaTeX's greatest strengths. It is also a large topic due to the existence of so much mathematical notation....
Read more >
Representing Rational Numbers With Python Fractions
Numbers with infinite decimal expansions cause rounding errors when ... from fractions import Fraction from IPython.display import display, Math Fraction.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found