Re: [IPython-dev] SymPy printing in the ipython notebook

26 views
Skip to first unread message

Jason Moore

unread,
Apr 4, 2014, 7:40:00 AM4/4/14
to IPython developers list, sy...@googlegroups.com
Hi Richard,

I don't think SymPy has tested with IPython 2.0 yet. It is possible that the printing is no broken... It should display in mathjax/latex by default in the notebook and pretty print in the terminal.

If you don't mind please submit an issue on github to the main sympy repository.



On Fri, Apr 4, 2014 at 2:34 AM, Richard Johns <rjoh...@gmail.com> wrote:
If I open a new notebook and carry out the steps below the output is mathematically correct but it isn't displayed in latex/mathjax format:
from IPython.display import display

from sympy.interactive import printing
printing.init_printing()

from __future__ import division
import sympy as sym
from sympy import *
x, y, z = symbols("x y z")
k, m, n = symbols("k m n", integer=True)
f, g, h = map(Function, 'fgh')

Rational(3,2)*pi + exp(I*x) / (x**2 + y)

The output is:

3*pi/2 + exp(I*x)/(x**2 + y)
 
SoftwareVersion
Python2.7.3 (default, Feb 27 2014, 20:00:17) [GCC 4.6.3]
IPython2.0.0
OSposix [linux2]
numpy1.6.1
matplotlib 1.1.1rc
scipy0.9.0
Thu Apr 03 00:02:41 2014 MST

If I open a terminal in the same directory and repeat these steps the output is displayed in a pretty printing format:

rj@rjslptp:~$ ipython
Python 2.7.3 (default, Feb 27 2014, 20:00:17)
Type "copyright", "credits" or "license" for more information.

IPython 2.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from IPython.display import display

In [2]:

In [2]: from sympy.interactive import printing

In [3]: printing.init_printing()

In [4]:

In [4]: from __future__ import division

In [5]: import sympy as sym

In [6]: from sympy import *

In [7]: x, y, z = symbols("x y z")

In [8]: k, m, n = symbols("k m n", integer=True)

In [9]: f, g, h = map(Function, 'fgh')

In [10]: Rational(3,2)*pi + exp(I*x) / (x**2 + y)
        ⅈ⋅x
3⋅π    ℯ   
─── + ──────
 2     2   
      x  + y

I imagine I'm missing something simple but I haven't been able to figure out what it is. Any help would be appreciated.

Richard

_______________________________________________
IPython-dev mailing list
IPyth...@scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-dev


Ondřej Čertík

unread,
Apr 4, 2014, 11:14:12 AM4/4/14
to sympy, IPython developers list


On Fri, Apr 4, 2014 at 5:40 AM, Jason Moore <moore...@gmail.com> wrote:
Hi Richard,

I don't think SymPy has tested with IPython 2.0 yet. It is possible that the printing is no broken... It should display in mathjax/latex by default in the notebook and pretty print in the terminal.

If you don't mind please submit an issue on github to the main sympy repository.

I think SymPy works with IPython 2.0. Which version of SymPy are you using?

Ondrej

Jason Moore

unread,
Apr 4, 2014, 1:44:32 PM4/4/14
to IPython developers list, sy...@googlegroups.com
The latest version of SymPy is 0.7.5. Maybe you just need to upgrade?



On Fri, Apr 4, 2014 at 1:28 PM, Richard Johns <rjoh...@gmail.com> wrote:
Hi Ondrej:

I assumed that SymPy worked with 2.0 since the example notebook included this at the bottom of the page:

nbviewer version: 4c2edac (Mon, 31 Mar 2014 09:14:05 -0500)

IPython version: 2.0.0-dev ( 65651b5 )

Rendered on: Mon, 31 Mar 2014 18:26:32 UTC


I originally tried to do this, with no success, by installing 2.0.0-dev when it didn't work with my old ipython.



My SymPy version is:

In [14]: sym.__version__
0.7.1.rc1

Richard


_______________________________________________
IPython-dev mailing list
IPyth...@scipy.org
http://mail.scipy.org/mailman/listinfo/ipython-dev

Ondřej Čertík

unread,
Apr 4, 2014, 1:46:13 PM4/4/14
to sympy, IPython developers list
Yes, definitely upgrade. The 0.7.1 was released 3 years ago, so I am
not surprised it doesn't work.

Ondrej
> --
> 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/CAP7f1Ai%3DphBnADJ2h9%3DfzmbVK4MrKyeJZJGU%2Br3Jzv6-gGf-6A%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages