Thursday, November 20, 2025
HomeLanguagesPython | sympy.as_poly() method

Python | sympy.as_poly() method

With the help of sympy.as_poly() method, we can make the mathematical function into a polynomial object by using sympy.as_poly() method.

Syntax : sympy.as_poly()
Return : Return the polynomial object.

Example #1 :
In this example we can see that by using sympy.as_poly() method, we are able to get the polynomial from mathematical operation.




# import sympy
from sympy import *
  
# Use sympy.as_poly() method
x = symbols('x')
gfg = (x**2 + 4 * x + 16).as_poly()
  
print(gfg)


Output :

Poly(x**2 + 4*x + 16, x, domain=’ZZ’)

Example #2 :




# import sympy
from sympy import *
  
# Use sympy.as_poly() method
x = symbols('x')
gfg = (x + 5 * x + 6).as_poly()
  
print(gfg)


Output :

Poly(6*x + 6, x, domain=’ZZ’)

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

Most Popular

Dominic
32404 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6776 POSTS0 COMMENTS
Nicole Veronica
11924 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11994 POSTS0 COMMENTS
Shaida Kate Naidoo
6904 POSTS0 COMMENTS
Ted Musemwa
7160 POSTS0 COMMENTS
Thapelo Manthata
6859 POSTS0 COMMENTS
Umr Jansen
6846 POSTS0 COMMENTS