Open In App

pprint function in SymPy

Improve
Improve
Like Article
Like
Save
Share
Report

The pprint() takes two arguments, one is an expression and the other is the use_unicode argument, the use_unicode is a boolean argument. In case the terminal does not support Unicode then ASCII printer is used by default or else we need to pass use_unicode=False. And to call this function the user needs to first import the SymPy library. Here the SymPy variables are defined using the Symbols class.

Syntax:

pprint()

Example 1: Here the Unicode is set to false, so the Ascii codes are used in output.

Python3




# import everything from sympy module
from sympy import *
  
x, y, z, t = symbols('x y z t')
pprint(Integral(sqrt(x)*((x**3)/y), x), use_unicode=False)


 Output

Example 2: Here the Unicode is set to true, so the Unicode codes are used in output.

Python3




# import everything from sympy module
from sympy import *
  
x, y, z, t = symbols('x y z t')
pprint(Integral(sqrt(x)*((x**3)/y), x), use_unicode=True)


 Output


Last Updated : 21 Feb, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads