Sunday, September 22, 2024
Google search engine
HomeLanguagespprint function in SymPy

pprint function in SymPy

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

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments