- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Raise a polynomial to a power in Python
To raise a polynomial to a power, use the numpy.polynomial.polynomial.polypow() method in Python. Returns the polynomial c raised to the power pow. The argument c is a sequence of coefficients ordered from low to high. i.e., [1,2,3] is the series 1 + 2*x + 3*x**2. The method returns the array of coefficient series representing the quotient and remainder.
The 1st parameter, c is a 1-D array of array of series coefficients ordered from low to high degree. The 2nd parameter, pow is a Power to which the series will be raised. The 3rd parameter, maxpower, is the maximum power allowed. This is mainly to limit growth of the series to unmanageable size. Default is 16.
This numpy.polynomial.polynomial module provides a number of objects useful for dealing with polynomials, including a Polynomial class that encapsulates the usual arithmetic operations.
Steps
At first, import the required libraries −
from numpy.polynomial import polynomial as P
Polynomial and a power −
poly = (4,1,6) power = 3
Display the polynomial −
print("Polynomial...\n",poly)
Display the power −
print("\nPower...\n",power)
To raise a polynomial to a power, use the numpy.polynomial.polynomial.polypow() method in Python. Returns the polynomial c raised to the power pow. The argument c is a sequence of coefficients ordered from low to high. i.e., [1,2,3] is the series 1 + 2*x + 3*x**2 −
res = P.polypow(poly,power); print("\nResult...\n",res)
Example
from numpy.polynomial import polynomial as P # Polynomial and a power poly = (4,1,6) power = 3 # Display the polynomial print("Polynomial...\n",poly) # Display the power print("\nPower...\n",power) # To raise a polynomial to a power, use the numpy.polynomial.polynomial.polypow() method in Python. res = P.polypow(poly,power); print("\nResult...\n",res)
Output
Polynomial... (4, 1, 6) Power... 3 Result... [ 64. 48. 300. 145. 450. 108. 216.]
- Related Articles
- Raise a Laguerre series to a power in Python
- Raise a Hermite series to a power in Python
- Raise a Legendre series to a power in Python
- Raise a Hermite_e series to a power in Python
- Raise a Chebyshev series to a power in Python
- Raise a square matrix to the power n in Linear Algebra in Python
- Raise elements of tuple as power to another tuple in Python
- In MySQL, how to raise a number to the power of another number?
- Raise x to the power n using Recursion in Java
- How To Raise a "File Download" Dialog Box in Python?
- How to create a column of raise to the power 3 in data frames stored in R list?
- How to raise Python exception from a C extension?
- Integrate a polynomial in Python
- Differentiate a polynomial in Python
- Convert a Laguerre series to a polynomial in Python
