Open In App

Multiply one Hermite series to another in Python using NumPy

Last Updated : 25 Apr, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

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 coefficients, starting with the lowest order “term” and ending with the highest order “term.” for example, [2,3,4] represents the series 2*P_0 + 3*P_1 + 4*P_2.

Syntax: polynomial.hermite.hermmul(c1, c2)

parameters:

  • c1,c2: array like objects. Hermite series coefficients are arranged from low to high in a 1-D array.

Return: out: ndarray. The product of the coefficients of the Hermite series.

Example:

In this example,  we created two arrays of numbers that represent coefficients using the np.array() method. The shape of the array is defined by the .shape attribute and the dimension of the array is defined by .ndim, the datatype of the array is returned by .dtype attribute. The hermite.hermul() method is used to multiple two Hermite series and the result is returned. 

Python3




# import package
import numpy as np
 
# Creating arrays of coefficients
array = np.array([2, 3, 4])
array2 = np.array([5, 6, 7])
print(array)
print(array2)
 
# shape of the array is
print("Shape of the array1 is : ", array.shape)
print("Shape of the array2 is : ", array2.shape)
 
# dimension of the array
print("The dimension of the array1 is : ", array.ndim)
print("The dimension of the array2 is : ", array2.ndim)
 
# Datatype of the array
print("Datatype of our Array is : ", array.dtype)
print("Datatype of our Array2 is : ", array2.dtype)
 
# new array
print("Multiplication of two hermite series : ",
      np.polynomial.hermite.hermmul(array, array2))


Output:

[2 3 4]

[5 6 7]

Shape of the array1 is :  (3,)

Shape of the array2 is :  (3,)

The dimension of the array1 is :  1

The dimension of the array2 is :  1

Datatype of our Array is :  int64

Datatype of our Array2 is :  int64

Multiplication of two hermite series :  [270. 207. 276.  45.  28.]


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads