Integrate a Hermite series and set the lower bound of the integral in Python

To integrate a Hermite series, use the hermite.hermint() method in Python. This function integrates Hermite polynomials represented as coefficient arrays and allows you to set a custom lower bound for the integral.

Syntax

The syntax of hermite.hermint() is ?

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

Parameters

The function accepts the following parameters ?

Parameter Description Default
c Array of Hermite series coefficients Required
m Order of integration (must be positive) 1
k Integration constant(s) [] (zeros)
lbnd Lower bound of the integral 0
scl Scaling factor applied after integration 1
axis Axis over which integral is taken 0

Example

Let's create a simple example to demonstrate integrating a Hermite series with a custom lower bound ?

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

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

# Display the coefficient array
print("Coefficient Array:")
print(coefficients)
print(f"Shape: {coefficients.shape}")
print(f"Data type: {coefficients.dtype}")

# Integrate with default lower bound (0)
result_default = H.hermint(coefficients)
print(f"\nIntegral with lbnd=0:")
print(result_default)

# Integrate with custom lower bound (-2)
result_custom = H.hermint(coefficients, lbnd=-2)
print(f"\nIntegral with lbnd=-2:")
print(result_custom)
Coefficient Array:
[1 2 3]
Shape: (3,)
Data type: int64

Integral with lbnd=0:
[0.  0.5 0.5 0.5]

Integral with lbnd=-2:
[15.   0.5  0.5  0.5]

How It Works

The hermite.hermint() function performs the following operations ?

  • Integrates the Hermite series represented by the coefficient array
  • Applies the lower bound lbnd to determine the constant of integration
  • Returns a new coefficient array representing the integrated polynomial
  • The degree of the result is one higher than the input polynomial

Multiple Integration Orders

You can specify higher-order integration using the m parameter ?

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

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

# First-order integration
first_order = H.hermint(coefficients, m=1, lbnd=-1)
print("First-order integration:")
print(first_order)

# Second-order integration
second_order = H.hermint(coefficients, m=2, lbnd=-1)
print("\nSecond-order integration:")
print(second_order)
First-order integration:
[6.  0.5 0.5 0.5]

Second-order integration:
[-2.5  3.   0.25 0.25 0.25]

Conclusion

The hermite.hermint() function provides a powerful way to integrate Hermite series with customizable lower bounds. The lbnd parameter directly affects the constant term in the integrated result, making it useful for specific boundary conditions in mathematical applications.

Updated on: 2026-03-26T20:19:41+05:30

213 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements