Pretty printing

Category: General, Tecnologí­a

Thanks to a patch by Jurjen Bos (with some additions & modifications by me) we now got pretty printing in sympy. To see some examples, running it from isympy (you need sympy from svn):

In [1]: pprint x**2 +x +1
------> pprint(x**2 +x +1)

In [2]: pprint limit(x, x, oo, evaluate=False)
------> pprint(limit(x, x, oo, evaluate=False))
 lim  x

In [3]: pprint sqrt(2)
------> pprint(sqrt(2))
  \\/ 2

Still nesting doesn't work well and it certainly needs some polishing , but at least it works for simple things. note that pprint is just a function defined in sympy.modules.printing.pretty , and there's nothing specific about isympy, only that you can call it without the parenthesis because that's a feature of ipython. For the implementation details: following SAGE, we have agreed to put the code for creating a pretty picture into a classmethod called __pretty__(), and pretty, pprint is just a wrapper around that method. I also commited initial latex support, this time using the same principle as __pretty__ (called __latex__), instead of using xsl on the mathml. More things: we moved the hash algorithm to use MD5 hashes so that we get the same hashes in different platforms. Now all tests should pass ok in all architectures