Multiply a Hermite_e series by an independent variable in Python

PythonNumpyServer Side ProgrammingProgramming

To multiply the Hermite_e series by x, where x is the independent variable, use the polynomial.hermite.hermemulx() method in Python Numpy. The method returns an array representing the result of the multiplication. The parameter, c is a 1-D array of Hermite_e series coefficients ordered from low to high.

Steps

At first, import the required library −

import numpy as np
from numpy.polynomial import hermite_e as H

Create an array −

c = np.array([1, 2, 3])

Display the array −

print("Our Array...\n",c)

Check the Dimensions −

print("\nDimensions of our Array...\n",c.ndim)

Get the Datatype −

print("\nDatatype of our Array object...\n",c.dtype)

Get the Shape −

print("\nShape of our Array object...\n",c.shape)

To multiply the Hermite_e series by x, where x is the independent variable, use the polynomial.hermite.hermemulx() method −

print("\nResult....\n",H.hermemulx(c))

Example

import numpy as np
from numpy.polynomial import hermite_e as H

# Create an array
c = np.array([1, 2, 3])

# Display the array
print("Our Array...\n",c)

# Check the Dimensions
print("\nDimensions of our Array...\n",c.ndim)

# Get the Datatype
print("\nDatatype of our Array object...\n",c.dtype)

# Get the Shape
print("\nShape of our Array object...\n",c.shape)

# To multiply the Hermite_e series by x, where x is the independent variable, use the polynomial.hermite.hermemulx() method in Python Numpy
print("\nResult....\n",H.hermemulx(c))

Output

Our Array...
   [1 2 3]

Dimensions of our Array...
1

Datatype of our Array object...
int64

Shape of our Array object...
(3,)

Result....
   [2. 7. 2. 3.]
raja
Updated on 10-Mar-2022 05:34:01

Advertisements