Integrate a Hermite series and set the order of integration in Python

To integrate a Hermite series, use the hermite.hermint() method in Python. This function integrates a Hermite polynomial series and allows you to specify the order of integration.

Syntax

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

Parameters

The function accepts the following parameters ?

  • c ? Array of Hermite series coefficients. For multidimensional arrays, different axes correspond to different variables
  • m ? Order of integration, must be positive (Default: 1)
  • k ? Integration constant(s). If empty list (default), all constants are 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 simple example integrating a Hermite series with different integration orders ?

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

# Create an array of coefficients
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 integrate a Hermite series, use the hermite.hermint() method in Python
print("\nResult (m=3)...\n", H.hermint(c, m=3))
Our Array...
 [1 2 3]

Dimensions of our Array...
1

Datatype of our Array object...
int64

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

Result (m=3)...
 [ 0.125     -0.25       0.125      0.02083333  0.01041667  0.00625   ]

Different Integration Orders

Here's how different integration orders affect the result ?

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

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

# Integration with m=1 (first order)
result1 = H.hermint(c, m=1)
print("Integration order m=1:", result1)

# Integration with m=2 (second order)
result2 = H.hermint(c, m=2)
print("Integration order m=2:", result2)

# Integration with m=3 (third order)
result3 = H.hermint(c, m=3)
print("Integration order m=3:", result3)
Integration order m=1: [ 0.5 -0.5  0.5  0.25]
Integration order m=2: [ 0.25 -0.5   0.25  0.08333333  0.0625    ]
Integration order m=3: [ 0.125     -0.25       0.125      0.02083333  0.01041667  0.00625   ]

Using Integration Constants

You can specify integration constants using the k parameter ?

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

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

# Integration with constants
result_with_k = H.hermint(c, m=2, k=[1, 2])
print("With integration constants [1, 2]:", result_with_k)

# Compare with default (no constants)
result_no_k = H.hermint(c, m=2)
print("Without integration constants:", result_no_k)
With integration constants [1, 2]: [ 1.25 -0.5   0.25  0.08333333  0.0625    ]
Without integration constants: [ 0.25 -0.5   0.25  0.08333333  0.0625    ]

Conclusion

The hermite.hermint() method provides flexible integration of Hermite series with customizable integration order, constants, and bounds. Higher integration orders result in more coefficients and different polynomial behavior.

Updated on: 2026-03-26T20:17:27+05:30

207 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements