# 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’)

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.