Thursday, November 20, 2025
HomeLanguagesIntegrate a Hermite series and multiply the result by a scalar before...

Integrate a Hermite series and multiply the result by a scalar before the integration constant is added using NumPy in Python

In this article, we will see how to integrate a Hermite series and multiply the result by a scalar before the integration constant is added in Python.

hermite.hermint method    

Hermite nodes are utilised as matching points for optimising polynomial interpolation, Hermite polynomials are important in approximation theory. NumPy has a function called hermite.hermint() that can be used to integrate the Hermite series in a specific order. It will require two parameters: c, which is an array, and scl, which is a scalar that will be multiplied by the integrated Hermite series before the integration constant is added.

Syntax: hermite.hermint(c,scl)

Parameter:

  • c: an array
  • scl: A scalar value

Return: Hermite series coefficients of the integral.

Example 1

In this example, we will create a one-dimensional NumPy coefficient array with 6 elements and integrate the Hermite series and multiply the result by a scalar with the value -2  before the integration constant.

Python3




# import the numpy module
import numpy
  
# import hermite
from numpy.polynomial import hermite
  
# Create an array of hermite series
# coefficients with 6 elements
coefficient_array = numpy.array([1, 2, 3, 4, 3, 5])
  
# display array
print("Coefficient array: ", coefficient_array)
  
# display the dimensions
print("Dimensions: ", coefficient_array.ndim)
  
# integrate hermite series with scale=2
print(    hermite.hermint(coefficient_array, scl=-2))


Output:

Coefficient array:  [1 2 3 4 3 5]

Dimensions:  1

[-90.          -1.          -1.          -1.          -1.

  -0.6         -0.83333333]   

Example 2

In this example, we will create a two-dimensional NumPy coefficient array with 6 elements each and integrate the Hermite series and multiply the result by a scalar with value -1 before the integration constant.

Python3




# import the numpy module
import numpy
  
# import hermite
from numpy.polynomial import hermite
  
# Create an 2d array of hermite series
# coefficients with 6 elements each
coefficient_array = numpy.array([[1, 2, 3, 4, 3, 5], 
                                 [4, 5, 6, 4, 3, 2]])
  
# display array
print("Coefficient array: ", coefficient_array)
  
# display the dimensions
print("Dimensions: ", coefficient_array.ndim)
  
# integrate hermite series with scale=-1
print(    hermite.hermint(coefficient_array, scl=-1))


Output:

Coefficient array:  [[1 2 3 4 3 5]
 [4 5 6 4 3 2]]
Dimensions:  2
[[-2.   -2.5  -3.   -2.   -1.5  -1.  ]
 [-0.5  -1.   -1.5  -2.   -1.5  -2.5 ]
 [-1.   -1.25 -1.5  -1.   -0.75 -0.5 ]]
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32404 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6776 POSTS0 COMMENTS
Nicole Veronica
11924 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11994 POSTS0 COMMENTS
Shaida Kate Naidoo
6904 POSTS0 COMMENTS
Ted Musemwa
7160 POSTS0 COMMENTS
Thapelo Manthata
6859 POSTS0 COMMENTS
Umr Jansen
6846 POSTS0 COMMENTS