- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Multiply one polynomial to another in Python

To multiply one polynomial to another, use the numpy.polynomial.polynomial.polymul() method in Python. Returns the multiplication of two polynomials c1 + c2. The arguments are sequences of coefficients from lowest order term to highest, i.e., [1,2,3] represents the polynomial 1 + 2*x + 3*x**2.

The method returns the coefficient array representing their sum. The parameters c1 and c2 are the 1-D arrays of coefficients representing a polynomial, relative to the “standard” basis, and ordered from lowest order term to highest.

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

Declare Two Polynomials −

p1 = (4,1,6) p2 = (2,5,3)

Display the polynomials −

print("Polynomial 1...\n",p1) print("\nPolynomial 2...\n",p2)

To multiply one polynomial to another, use the numpy.polynomial.polynomial.polymul() method in Python −

mulRes = P.polymul(p1,p2); print("\nResult (Multiply)...\n",mulRes)

## Example

from numpy.polynomial import polynomial as P # Declare Two Polynomials p1 = (4,1,6) p2 = (2,5,3) # Display the polynomials print("Polynomial 1...\n",p1) print("\nPolynomial 2...\n",p2) # To multiply one polynomial to another, use the numpy.polynomial.polynomial.polymul() method in Python. mulRes = P.polymul(p1,p2); print("\nResult (Multiply)...\n",mulRes)

## Output

Polynomial 1... (4, 1, 6) Polynomial 2... (2, 5, 3) Result (Multiply)... [ 8. 22. 29. 33. 18.]

- Related Questions & Answers
- Add one polynomial to another in Python
- Subtract one polynomial to another in Python
- Multiply one Hermite series to another in Python
- Multiply one Laguerre series to another in Python
- Multiply one Legendre series to another in Python
- Multiply one Chebyshev series to another in Python
- Multiply one Hermite_e series to another in Python
- Divide one polynomial by another in Python
- Multiply one BigInteger to another BigInteger in Java
- Multiply one BigDecimal to another BigDecimal in Java
- Add one Python string to another
- Differentiate a polynomial and multiply each differentiation by a scalar in Python
- Add one Chebyshev series to another in Python
- Add one Hermite series to another in Python
- Add one Laguerre series to another in Python