Integrate a Hermite_e series over axis 0 in Python

To integrate a Hermite_e series, use the hermite_e.hermeint() method in Python. This function performs integration along a specified axis of multidimensional coefficient arrays representing Hermite_e series.

Syntax

numpy.polynomial.hermite_e.hermeint(c, m=1, k=[], lbnd=0, scl=1, axis=0)

Parameters

The function accepts the following parameters ?

  • c − Array of Hermite_e series coefficients. If multidimensional, different axes correspond to different variables
  • m − Order of integration (must be positive, default: 1)
  • k − Integration constant(s). Default is empty list (all constants set to zero)
  • lbnd − Lower bound of the integral (default: 0)
  • scl − Scalar multiplier applied after each integration (default: 1)
  • axis − Axis over which the integral is taken (default: 0)

Example

Let's create a multidimensional array and integrate along axis 0 ?

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

# Create a multidimensional array of coefficients
c = np.arange(4).reshape(2,2)

# 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 integrate a Hermite_e series, use the hermite_e.hermeint() method
print("\nResult...\n", H.hermeint(c, axis=0))
Our Array...
 [[0 1]
 [2 3]]

Dimensions of our Array...
2

Datatype of our Array object...
int64

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

Result...
 [[1.  1.5]
 [0.  1. ]
 [1.  1.5]]

How It Works

When integrating along axis 0, the function increases the degree of the polynomial by 1. The original 2×2 array becomes a 3×2 array where each column represents the integrated coefficients of the corresponding Hermite_e series.

Integration with Different Parameters

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

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

# Integration with order m=2 and integration constant k=[1, 2]
result = H.hermeint(c, m=2, k=[1, 2], axis=0)
print("Integration with m=2, k=[1,2]:\n", result)

# Integration with scaling factor
result_scaled = H.hermeint(c, scl=2, axis=0)
print("\nIntegration with scl=2:\n", result_scaled)
Integration with m=2, k=[1,2]:
 [[1.   2.  ]
 [2.   2.  ]
 [0.5  1.  ]
 [0.5  1.  ]
 [0.25 0.5 ]]

Integration with scl=2:
 [[2. 4.]
 [2. 4.]
 [3. 4.]]

Conclusion

The hermeint() function provides flexible integration of Hermite_e series along specified axes. Use the axis parameter to control integration direction and additional parameters like m, k, and scl for customized integration behavior.

Updated on: 2026-03-26T21:17:02+05:30

237 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements