This code is taken from the Sympy tutorial:
init_printing(use_unicode=False, wrap_line=False, no_global=True)
x = Symbol('x')
r = integrate(x**2 + x + 1, x)
print(r)
The output is: x**3/3 + x**2/2 + x
It's correct, but in tutorial the output was:
3 2
x x
-- + -- + x
3 2
How can I reach this form of output?
If necessary: IDE is pyCharm, python ver. is 3.3
You need a pretty printer
pprint
instead of normalprint
. Refer the Sympy Tutorial section PrintingNote For non string objects, print statement (Python 2.X) or the print function (Python 3.X) converts the object to string using the rules for string conversion.