Open In App

Multiply a Hermite series by an independent variable in Python using NumPy

In this article, we are going to see how to multiply a Hermite series by an independent variable in Python Using NumPy.

The NumPy method numpy.polynomial.hermite.hermmulx() is used to Multiply a Hermite series by x(independent variable) to get a new one. Let’s understand the syntax to know more about the method. The Hermite series c is multiplied by x, where x is the independent variable.



Syntax: numpy.polynomial.hermite.hermmulx(c)

parameters:



  • c : array like object.The coefficients of the Hermite series are arranged in a 1-D array from low to high.

Return: out: array like object.The result of the multiplication is represented by an array.

Example 1:

In this example,  we created an array of complex numbers which represents 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 numpy.polynomial.hermite.hermmulx(c) is the method used to multiply the Hermite series by an individual variable.




# import package
import numpy as np
 
# Creating an array of coefficients
array = np.array([11, 12, 13])
print(array)
 
# shape of the array is
print("Shape of the array is : ", array.shape)
 
# dimension of the array
print("The dimension of the array is : ", array.ndim)
 
# Datatype of the array
print("Datatype of our Array is : ", array.dtype)
 
# new array
print("new array: ",
      np.polynomial.hermite.hermmulx(array))

Output:

[11 12 13]
Shape of the array is :  (3,)
The dimension of the array is :  1
Datatype of our Array is :  int64
new array:  [12.  31.5  6.   6.5]
Article Tags :