On Tue, Jan 22, 2013 at 2:38 PM, Roberto Colistete Jr.
<[email protected]> wrote:
> Em 22-01-2013 17:36, Aaron Meurer escreveu:
>
>> On Tue, Jan 22, 2013 at 12:25 PM, Roberto Colistete Jr.
>> <[email protected]> wrote:
>>>
>>> Em 22-01-2013 15:43, Aaron Meurer escreveu:
>>>
>>> Cool.  Does mathjax printing work in the notebook (i.e., %load_ext
>>> sympy.interactive.ipythonprinting)?
>>>
>>>
>>> I am trying to learn and document the new features of SymPy 0.7.2 using
>>> IPython 0.13.1 on MeeGo Harmattan OS.
>>>
>>> What is the recommended way to, inside IPython Qt Console or IPython
>>> Notebook, load SymPy with nice printing and online plots (form PyLab) ?
>>>
>>> For example, this sequence works :
>>> In [1]: %pylab inline
>>> In [2]: %load_ext sympy.interactive.ipythonprinting
>>> In [3]: from sympy.interactive import init_session
>>> In [4]: init_session()
>>> Is there another easy way ?
>>
>> I think you could use init_printing instead of the ipython extension,
>> but they should be the same (modulo some bugs; search the issues).
>> Actually, doesn't init_session call init_printing automatically? For
>> Pylab, you'll have to do that separately.  You might want to do it so
>> that it doesn't import the numpy namespace.  We also do that in
>> isympy, but that's just the terminal for now.  Eventually, you will be
>> able to just do isympy -c qtconsole, but it hasn't been implemented
>> yet (http://code.google.com/p/sympy/issues/detail?id=2632).
>
>
>     Thanks, so I think it is better :
>
> In [1]: %pylab inline
> In [2]: from sympy.interactive import *
> In [3]: init_session()
>
> or, with simpler initialization (no symbols, etc) :
>
> In [1]: %pylab inline
> In [2]: from sympy import *
> In [3]: init_printing()
>
> I know that PyLab and SymPy contexts are mixed, e.g, pylab.plot is
> overwritten by sympy.plotting.plot.

If you enable pylab using the IPython API, you can avoid importing
numpy and all that other stuff.  Do

ip = get_ipython()
ip.enable_pylab(gui='inline', import_all=False)

You'll need to do this first (before importing SymPy) because of a
SymPy bug where importing SymPy imports matplotlib and already sets
the backend (see
http://code.google.com/p/sympy/issues/detail?id=3427).

Aaron Meurer

>
>
>>> Also, nice printing has some problems with long results without line
>>> breaking :
>>> In [5]: integrate(sin(x)**20,x)
>>> gives a result that doesn't fit the windows in Qt console.
>>
>> If this is with the Unicode/ASCII pretty printer, you just need to set
>> the num_columns.  For LaTeX, I don't know if there's a way to
>> automatically line break the equations.  Maybe breqn could be used
>> somehow.  I don't even know if that works with MathJax. "Smart" line
>> breaking is something we don't even have implemented for our 2-D text
>> pretty printer (though it's something we would like to have).  I guess
>> you'll just have to make sure that horizontal scrolling works :)
>
>
>     Thanks. A workaround is to use "pprint(integrate(sin(x)**20,x))".
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to