Integrate a Hermite_e series over specific axis in Python

To integrate a Hermite_e series over a specific axis, use the hermite_e.hermeint() method in Python. This function integrates Hermite_e series coefficients along the specified axis while preserving other dimensions.

Syntax

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

Parameters

The function accepts several parameters to control the integration:

  • c: Array of Hermite_e series coefficients. For multidimensional arrays, different axes correspond to different variables
  • m: Order of integration (default: 1), must be positive
  • k: Integration constants (default: []). All constants are zero by default
  • 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 different axes:

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...")
print(c)

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

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

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

# Integrate along axis 1
print("\nResult (axis=1)...")
print(H.hermeint(c, axis=1))
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 (axis=1)...
[[0.5 0.  0.5]
 [1.5 2.  1.5]]

Integration Along Different Axes

Compare integration results along different axes:

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

c = np.arange(6).reshape(2,3)
print("Original array:")
print(c)

print("\nIntegration along axis 0:")
print(H.hermeint(c, axis=0))

print("\nIntegration along axis 1:")
print(H.hermeint(c, axis=1))
Original array:
[[0 1 2]
 [3 4 5]]

Integration along axis 0:
[[1.5 0.  1.5]
 [2.5 4.  2.5]]

Integration along axis 1:
[[0.5 0.  0.5 1. ]
 [1.5 3.  2.  2.5]]

How It Works

When integrating along an axis, the function increases that dimension by one (adding the integration constant term) while preserving other dimensions. The integration follows Hermite_e polynomial properties where each coefficient contributes to the integrated series according to the mathematical rules.

Conclusion

The hermite_e.hermeint() method integrates Hermite_e series along specified axes in multidimensional arrays. The axis parameter controls which dimension to integrate, making it useful for processing complex polynomial data structures.

Updated on: 2026-03-26T21:14:05+05:30

259 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements