I am being stupid (and not reading the manual :->): I want to show the
nice pretty printing of sympy in ipython. To get the nicest I check out
the hg trunk.
But I can't get it working (no multiline output). I must be missing some
switch.
On a side note, I must be missing some dependency for isympy:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
~ $ isympy
---------------------------------------------------------------------------
ImportError Traceback (most recent call
last)
/home/varoquau/dev/<input> in <module>()
----> 1
2
3
4
5
ImportError: No module named interactive
Python 2.5.1 console for SymPy 0.4.2
These commands were executed:
>>> from __future__ import division
>>> from sympy import *
>>> x, y, z = symbols('xyz')
>>> k, m, n = symbols('kmn', integer=True)
>>> f = Function("f")
Documentation can be found at http://sympy.org/
In [1]:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Cheers,
Gaël
it seems that your are mixing old SymPy 0.4.2 with latest isympy.
isympy will import globally availably sympy module (eg.
/usr/share/python2.5/ ...). However if you would cd to hg root
directory and run ./bin/isympy then it will import locally available
module tree, eg.:
matt@neutrino ~ $ cd hg/sympy
matt@neutrino ~/hg/sympy $ ./bin/isympy -q
Python 2.5.1 console for SymPy 0.5.13-hg
In [1]:
Do you really want to exit ([y]/n)?
Exiting ...
matt@neutrino ~/hg/sympy $ cd bin/
matt@neutrino ~/hg/sympy/bin $ ./isympy -q
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/home/matt/hg/sympy/bin/<input> in <module>()
----> 1
2
3
4
5
ImportError: No module named interactive
Python 2.5.1 console for SymPy 0.5.13
In [1]:
Do you really want to exit ([y]/n)?
Exiting ...
matt@neutrino ~/hg/sympy/bin $
Mateusz
2008/4/9, Gael Varoquaux <gael.va...@normalesup.org>:
Strange. I am probably getting all mixed up with virtualenv again. You
are probably right that the wrong versions get imported, but I don't
undestand where.
> isympy will import globally availably sympy module (eg.
> /usr/share/python2.5/ ...). However if you would cd to hg root
> directory and run ./bin/isympy then it will import locally available
> module tree, eg.:
That does solve the problem. I won't try to look further.
My original question remains, though, how can I enable multiline pretty
printing in vanilly ipython? It does work in isympy.
Cheers,
Gaėl
There are two ways to achieve this:
[1] init_ipython() from sympy.interactive
[2] ipythonrc-sympy from data/IPython
(you will need to copy it manually into ~/.ipython)
(both were added in 0.5.13-hg so you will need latest repo).
Examples:
matt@neutrino ~/hg/sympy $ ipython -nobanner
In [1]: from sympy.interactive import *
In [2]: init_ipython()
In [3]: solve([x+y-z, x-y+2*z],[x,y])
Out[3]:
⎧ 3*z -z⎫
⎨y: ───, x: ──⎬
⎩ 2 2 ⎭
In [4]:
Do you really want to exit ([y]/n)?
Exiting ...
matt@neutrino ~/hg/sympy $ ipython -p sympy
Python 2.5.1 console for SymPy 0.5.13-hg
In [1]: solve([x+y-z,x-y+2*z], [x,y])
Out[1]:
⎧ 3*z -z⎫
⎨y: ───, x: ──⎬
⎩ 2 2 ⎭
In [2]:
Mateusz
2008/4/9, Gael Varoquaux <gael.va...@normalesup.org>:
>
> Gaël
>
> >
>
> In [1]: from sympy.interactive import *
> In [2]: init_ipython()
> In [3]: solve([x+y-z, x-y+2*z],[x,y])
> Out[3]:
> ⎧ 3*z -z⎫
> ⎨y: ───, x: ──⎬
> ⎩ 2 2 ⎭
Rocks! Fantastic.
Cheers,
Gaël