Raise a Hermite series to a power in Python
The Hermite polynomials, like the other classical orthogonal polynomials, can be defined from a variety of starting locations. In this article let’s see how to Raise a Hermite series to a power in Python. The NumPy package provides us polynomial.hermite.hermpow() method to raise a Hermite series.
Syntax: polynomial.hermite.hermpow(c, pow, maxpower=16)
- c: The coefficients of the Hermite series are arranged in a 1-D array from low to high.
- pow: The series’ power will be increased according to the number specified.
- maxpower: by default it is 16. Maximum power is permitted. This is mostly to prevent the series from becoming unmanageable in size.
Returns: an array of raised hermite series is returned.
The NumPy package is imported. An array is created which represents coefficients of the hermite series. polynomial.hermite.hermpow() is used to raise the Hermite series, in the below example , 2 is given as the value for the pow parameter, it raises the Hermite series by power 2. The shape, datatype and dimension of the array are found by using the .shape, .dtype and .ndim attributes.
[3 1 4] Shape of the array is : (3,) The dimension of the array is : 1 Datatype of our Array is : int64 [139. 38. 153. 8. 16.]
In this example a new parameter maxpower is returned, it represents the maximum permitted power. we cannot give a value to pow parameter which is greater than the maxpower, else a ValueError gets raised, saying “power is too large”.
[3 1 4] Shape of the array is : (3,) The dimension of the array is : 1 Datatype of our Array is : int64 raise ValueError("Power is too large") ValueError: Power is too large