SymPy printing in the ipython notebook

10 messages
Open this post in threaded view
|

SymPy printing in the ipython notebook

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 printingprinting.init_printing()from __future__ import divisionimport sympy as symfrom 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 [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev Reply | Threaded Open this post in threaded view | Re: SymPy printing in the ipython notebook 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. Jason moorepants.info +01 530-601-9791 On Fri, Apr 4, 2014 at 2:34 AM, Richard Johns 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 printingprinting.init_printing()from __future__ import divisionimport sympy as symfrom 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)

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
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-dev

_______________________________________________
IPython-dev mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-dev
Open this post in threaded view
|

Re: [sympy] Re: SymPy printing in the ipython notebook

 On Fri, Apr 4, 2014 at 5:40 AM, Jason Moore 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 _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev
Open this post in threaded view
|

Re: [sympy] Re: SymPy printing in the ipython notebook

 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.rc1RichardOn Fri, Apr 4, 2014 at 8:14 AM, Ondřej Čertík wrote: On Fri, Apr 4, 2014 at 5:40 AM, Jason Moore 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 _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev
Open this post in threaded view
|

Re: [sympy] Re: SymPy printing in the ipython notebook

 The latest version of SymPy is 0.7.5. Maybe you just need to upgrade?Jasonmoorepants.info +01 530-601-9791 On Fri, Apr 4, 2014 at 1:28 PM, Richard Johns 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.rc1Richard On Fri, Apr 4, 2014 at 8:14 AM, Ondřej Čertík wrote: On Fri, Apr 4, 2014 at 5:40 AM, Jason Moore 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 _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev
Open this post in threaded view
|

Re: [sympy] Re: SymPy printing in the ipython notebook

Open this post in threaded view
|

Re: [sympy] Re: SymPy printing in the ipython notebook

Open this post in threaded view
|

Re: [sympy] Re: SymPy printing in the ipython notebook

 Thanks Aaron, will do.When I was upgrading to 7.5 I noticed that the documentation said:'After the download is complete, you should have a folder called “sympy”. From your favorite command line terminal, change directory into that folder and execute the following:'The folder should actually be 'sympy-0.7.5'.Also, clicking on the downloads link leads to a message saying that the downloads have moved to github. Wouldn't it be more efficient to just link the new location directly to https://github.com/sympy/sympy/releasesThanks again for the great software.Richard On Fri, Apr 4, 2014 at 12:16 PM, Aaron Meurer wrote: Yes, at some point IPython stopped working and we had to fix it (either they changed their API or SymPy was using non-public APIs, I don't remember which). But it should work with the latest version. If you run into any more issues with the latest versions of IPython and SymPy, be sure to let us know. Aaron MeurerOn Fri, Apr 4, 2014 at 1:22 PM, Richard Johns wrote: Yes that was the problem. I should have thought of that myself, however; it would have been nice if the example web page had used something like:  %load_ext version_information%version_information numpy, matplotlib, scipy, sympy Thanks for the help.Richard On Fri, Apr 4, 2014 at 10:46 AM, Ondřej Čertík wrote: Yes, definitely upgrade. The 0.7.1 was released 3 years ago, so I am not surprised it doesn't work. Ondrej On Fri, Apr 4, 2014 at 11:44 AM, Jason Moore <[hidden email]> wrote: > The latest version of SymPy is 0.7.5. Maybe you just need to upgrade? > > > Jason > moorepants.info > +01 530-601-9791 > > > On Fri, Apr 4, 2014 at 1:28 PM, Richard Johns <[hidden email]> 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 >> >> >> On Fri, Apr 4, 2014 at 8:14 AM, Ondřej Čertík <[hidden email]> >> wrote: >>> >>> >>> >>> >>> On Fri, Apr 4, 2014 at 5:40 AM, Jason Moore <[hidden email]> 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 >>> >>> _______________________________________________ >>> IPython-dev mailing list >>> [hidden email] >>> http://mail.scipy.org/mailman/listinfo/ipython-dev >>> >> >> >> _______________________________________________ >> IPython-dev mailing list >> [hidden email] >> http://mail.scipy.org/mailman/listinfo/ipython-dev >> > > -- > 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 [hidden email]. > To post to this group, send email to [hidden email]. > 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. _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev
 On Fri, Apr 4, 2014 at 2:45 PM, Richard Johns wrote: Thanks Aaron, will do. When I was upgrading to 7.5 I noticed that the documentation said:'After the download is complete, you should have a folder called “sympy”. From your favorite command line terminal, change directory into that folder and execute the following:'The folder should actually be 'sympy-0.7.5'.Hmm, this is unintentional. I will take a look at this the next time I do a release.  Also, clicking on the downloads link leads to a message saying that the downloads have moved to github. Wouldn't it be more efficient to just link the new location directly to https://github.com/sympy/sympy/releasesThanks for pointing that out. I fixed it at https://github.com/sympy/sympy/pull/7367. Aaron Meurer  Thanks again for the great software.Richard On Fri, Apr 4, 2014 at 12:16 PM, Aaron Meurer wrote: Yes, at some point IPython stopped working and we had to fix it (either they changed their API or SymPy was using non-public APIs, I don't remember which). But it should work with the latest version. If you run into any more issues with the latest versions of IPython and SymPy, be sure to let us know. Aaron MeurerOn Fri, Apr 4, 2014 at 1:22 PM, Richard Johns wrote: Yes that was the problem. I should have thought of that myself, however; it would have been nice if the example web page had used something like:  %load_ext version_information%version_information numpy, matplotlib, scipy, sympy Thanks for the help.Richard On Fri, Apr 4, 2014 at 10:46 AM, Ondřej Čertík wrote: Yes, definitely upgrade. The 0.7.1 was released 3 years ago, so I am not surprised it doesn't work. Ondrej On Fri, Apr 4, 2014 at 11:44 AM, Jason Moore <[hidden email]> wrote: > The latest version of SymPy is 0.7.5. Maybe you just need to upgrade? > > > Jason > moorepants.info > +01 530-601-9791 > > > On Fri, Apr 4, 2014 at 1:28 PM, Richard Johns <[hidden email]> 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 >> >> >> On Fri, Apr 4, 2014 at 8:14 AM, Ondřej Čertík <[hidden email]> >> wrote: >>> >>> >>> >>> >>> On Fri, Apr 4, 2014 at 5:40 AM, Jason Moore <[hidden email]> 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 >>> >>> _______________________________________________ >>> IPython-dev mailing list >>> [hidden email] >>> http://mail.scipy.org/mailman/listinfo/ipython-dev >>> >> >> >> _______________________________________________ >> IPython-dev mailing list >> [hidden email] >> http://mail.scipy.org/mailman/listinfo/ipython-dev >> > > -- > 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 [hidden email]. > To post to this group, send email to [hidden email]. > 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. _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev _______________________________________________ IPython-dev mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/ipython-dev