How do I print equality?

13 views
Skip to first unread message

Boris Kheyfets

unread,
Sep 11, 2013, 9:24:20 AM9/11/13
to sy...@googlegroups.com

Hello SymPy users,

Suppose I have a = b**2, and I want to pprint:

     2
a = b

How can I do it? The closest I can get is:

#!/usr/bin/python

from sympy import *

var("a b")

a = b**2

pprint({"a": a)

But it

  • prints : instead of = and also
  • prints ugly {} around equality (or assignment).

Ideally I want something like:

pprint(a.__name__ + " = " + a)

Aaron Meurer

unread,
Sep 11, 2013, 1:30:14 PM9/11/13
to sy...@googlegroups.com
Use Eq(), like Eq(a, b**2).

Aaron Meurer
> --
> 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.
> For more options, visit https://groups.google.com/groups/opt_out.

Boris Kheyfets

unread,
Sep 11, 2013, 4:04:44 PM9/11/13
to sy...@googlegroups.com
Cool thanks.


You received this message because you are subscribed to a topic in the Google Groups "sympy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sympy/FRqInVjMO1s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sympy+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages