Saturday, November 16, 2024
Google search engine
HomeLanguagesIntegrate a Laguerre series and multiply the result by a scalar before...

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

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

laguerre.lagint method

Laguerre polynomials arise in quantum theory because the Laguerre nodes are used as matching points for optimizing polynomial interpolation. To perform Hermite Integration, NumPy provides a function called laguerre.lagint() method, which is used to integrate the Hermite series with a given order. It will take two parameters, the first is c which takes an array and, the second is scl which is a scalar that is multiplied with the integrated laguerre series before the integration constant is added.

Syntax: laguerre.lagint(c,scl)

Parameter:

  • c: an array
  • scl: A scalar value

Return: Laguerre 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 Laguerre series and multiply the result by a scalar with the value -2 before the integration constant.

Python3




# import the numpy module
import numpy
  
# import laguerre
from numpy.polynomial import laguerre
  
# Create an array of laguerre 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 laguerre series with scale=2
print(    laguerre.lagint(coefficient_array, scl=-2))


Output:

Coefficient array:  [1 2 3 4 3 5]
Dimensions:  1
[-2. -2. -2. -2.  2. -4. 10.]

Example 2

In this example, we will create a two-dimensional NumPy coefficient array with 6 elements each and integrate the Laguerre 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 laguerre
  
# Create an 2d array of laguerre 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(    laguerre.lagint(coefficient_array, scl=-1))


Output:

Coefficient array:  [[1 2 3 4 3 5]
 [4 5 6 4 3 2]]
Dimensions:  2
[[-1. -2. -3. -4. -3. -5.]
 [-3. -3. -3.  0.  0.  3.]
 [ 4.  5.  6.  4.  3.  2.]]

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments