How to multiply a polynomial to another using NumPy in Python? Last Updated : 29 Aug, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will make a NumPy program to multiply one polynomial to another. Two polynomials are given as input and the result is the multiplication of two polynomials. The polynomial p(x) = C3 x2 + C2 x + C1 is represented in NumPy as : ( C1, C2, C3 ) { the coefficients (constants)}.Let take two polynomials p(x) and q(x) then multiply these to get r(x) = p(x) * q(x) as a result of multiplication of two input polynomials.If p(x) = A3 x2 + A2 x + A1 and q(x) = B3 x2 + B2 x + B1 then result is r(x) = p(x) * q(x) and output is ( (A1 * B1), (A2 * B1) + (A2 * B1), (A3 * B1) + (A2 * B2) + (A1 * B3), (A2 * B2) + (A3 * B2), (A3 * B3) ). This can be calculated using the polymul() method of NumPy. This method evaluates the product of two polynomials and returns the polynomial resulting from the multiplication of two input polynomials ‘p1’ and ‘p2’. Syntax: numpy.polymul(p1, p2) Below is the implementation with some examples : Example 1: Python3 # importing package import numpy # define the polynomials # p(x) = 5(x**2) + (-2)x +5 px = (5, -2, 5) # q(x) = 2(x**2) + (-5)x +2 qx = (2, -5, 2) # mul the polynomials rx = numpy.polynomial.polynomial.polymul(px, qx) # print the resultant polynomial print(rx) Output : [ 10. -29. 30. -29. 10.] Example 2 : Python3 # importing package import numpy # define the polynomials # p(x) = 2.2 px = (0, 0, 2.2) # q(x) = 9.8(x**2) + 4 qx = (9.8, 0, 4) # mul the polynomials rx = numpy.polynomial.polynomial.polymul(px, qx) # print the resultant polynomial print(rx) Output : [ 0. 0. 21.56 0. 8.8 ] Example 3 : Python3 # importing package import numpy # define the polynomials # p(x) = (5/3)x px = (0, 5/3, 0) # q(x) = (-7/4)(x**2) + (9/5) qx = (-7/4, 0, 9/5) # mul the polynomials rx = numpy.polynomial.polynomial.polymul(px, qx) # print the resultant polynomial print(rx) Output : [ 0. -2.91666667 0. 3. ] Comment More infoAdvertise with us Next Article How to multiply a polynomial to another using NumPy in Python? D deepanshu_rustagi Follow Improve Article Tags : Python Python-numpy Python numpy-Mathematical Function Practice Tags : python Similar Reads How to add one polynomial to another using NumPy in Python? In this article, Let's see how to add one polynomial to another. Two polynomials are given as input and the result is the addition of two polynomials. The polynomial p(x) = C3 x2 + C2 x + C1  is represented in NumPy as : ( C1, C2, C3 ) { the coefficients (constants)}. Let take two polynomials p(x) a 2 min read How to divide a polynomial to another using NumPy in Python? In this article, we will make a NumPy program to divide one polynomial to another. Two polynomials are given as input and the result is the quotient and remainder of the division. The polynomial p(x) = C3 x2 + C2 x + C1  is represented in NumPy as : ( C1, C2, C3 ) { the coefficients (constants)}.Let 2 min read How to subtract one polynomial to another using NumPy in Python? In this article, let's discuss how to subtract one polynomial to another. Two polynomials are given as input and the result is the subtraction of two polynomials. The polynomial p(x) = C3 x2 + C2 x + C1  is represented in NumPy as : ( C1, C2, C3 ) { the coefficients (constants)}.Let take two polynom 2 min read Multiply one Hermite series to another in Python using NumPy In this article, we are going to see how to multiply one Hermite series to another in Python Using NumPy. The NumPy polynomial.hermite.hermmul() is used to Multiply one Hermite series by another series. The product of two Hermite series c1 * c2 is returned. The arguments are sequences of coefficient 2 min read Convert a polynomial to Hermite_e series using NumPy in Python In this article, we will cover how to convert a polynomial to Hermite_e series using NumPy in Python. hermite_e.poly2herme method We use the hermite_e.poly2herme() function present in the NumPy module of python to convert a polynomial to a Hermite series. Here we need to convert an array of polynomi 2 min read Like