Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Integrate a Laguerre series in Python
To integrate a Laguerre series, use the laguerre.lagint() method in Python. The method returns the Laguerre series coefficients c integrated m times from lbnd along axis. At each iteration the resulting series is multiplied by scl and an integration constant, k, is added. The scaling factor is for use in a linear change of variable.
Syntax
laguerre.lagint(c, m=1, k=[], lbnd=0, scl=1, axis=0)
Parameters
The function accepts the following parameters ?
- c ? Array of Laguerre series coefficients. If c is multidimensional the different axis correspond to different variables with the degree in each axis given by the corresponding index.
- m ? Order of integration, must be positive. (Default: 1)
- k ? Integration constant(s). The value of the first integral at lbnd is the first value in the list, the value of the second integral at lbnd is the second value, etc. If k == [] (the default), all constants are set to zero. If m == 1, a single scalar can be given instead of a list.
- lbnd ? Lower bound of the integral. (Default: 0)
- scl ? Scalar. Following each integration the result is multiplied by scl before the integration constant is added. (Default: 1)
- axis ? Axis over which the integral is taken. (Default: 0)
Example
Let's create a Laguerre series and integrate it using different parameters ?
import numpy as np
from numpy.polynomial import laguerre as L
# Create an array of coefficients
c = np.array([1, 2, 3])
# 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)
# To integrate a Laguerre series, use the laguerre.lagint() method
print("\nResult...")
print(L.lagint(c, 2, scl=-1))
Our Array... [1 2 3] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (3,) Result... [ 1. 0. 0. -4. 3.]
Integration with Different Parameters
Here are examples showing different integration parameters ?
import numpy as np
from numpy.polynomial import laguerre as L
c = np.array([1, 2, 3])
# Single integration (m=1)
print("Single integration:")
print(L.lagint(c, m=1))
# Double integration with scaling factor
print("\nDouble integration with scl=-1:")
print(L.lagint(c, m=2, scl=-1))
# Integration with custom constant
print("\nIntegration with integration constant k=5:")
print(L.lagint(c, m=1, k=5))
# Integration with lower bound
print("\nIntegration with lbnd=1:")
print(L.lagint(c, m=1, lbnd=1))
Single integration: [0. 1. 0. 1.] Double integration with scl=-1: [ 1. 0. 0. -4. 3.] Integration with integration constant k=5: [5. 1. 0. 1.] Integration with lbnd=1: [0. 1. 0. 1.]
Conclusion
The laguerre.lagint() function provides flexible Laguerre series integration with customizable order, scaling, and boundary conditions. Use different parameters to control the integration behavior according to your mathematical requirements.
