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 over axis 0 in Python
To integrate a Laguerre series over a specific axis in Python, use the numpy.polynomial.laguerre.lagint() method. This function integrates a Laguerre series along a specified axis, returning the integrated coefficients.
Syntax
numpy.polynomial.laguerre.lagint(c, m=1, k=[], lbnd=0, scl=1, axis=0)
Parameters
- c ? Array of Laguerre series coefficients. For multidimensional arrays, different axes correspond to different variables
- m ? Order of integration (must be positive, default: 1)
- k ? Integration constant(s). Default is empty list (all constants set to zero)
- lbnd ? Lower bound of the integral (default: 0)
- scl ? Scaling factor applied after each integration (default: 1)
- axis ? Axis over which the integral is taken (default: 0)
Example
Let's integrate a multidimensional Laguerre series over axis 0 ?
import numpy as np
from numpy.polynomial import laguerre as L
# Create a multidimensional array of coefficients
c = np.arange(4).reshape(2,2)
# 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)
# Integrate the Laguerre series over axis 0
print("\nResult after integration...")
print(L.lagint(c, axis=0))
Our Array... [[0 1] [2 3]] Dimensions of our Array... 2 Datatype of our Array object... int64 Shape of our Array object... (2, 2) Result after integration... [[ 0. 1.] [ 2. 2.] [-2. -3.]]
How It Works
When integrating over axis 0, the function adds a new row to the coefficient matrix. The integration process follows Laguerre polynomial integration rules, where each coefficient is transformed according to the mathematical properties of Laguerre series integration.
Integration with Custom Parameters
You can also specify integration order and constants ?
import numpy as np
from numpy.polynomial import laguerre as L
# Create coefficient array
c = np.array([[1, 2], [3, 4]])
# Integration with order m=2 and integration constant k=1
result = L.lagint(c, m=2, k=1, axis=0)
print("Integration with m=2, k=1:")
print(result)
Integration with m=2, k=1: [[ 1. 2.] [ 4. 6.] [-2. -4.] [ 3. 4.] [-3. -4.]]
Conclusion
The laguerre.lagint() method provides flexible integration of Laguerre series along specified axes. Use the axis parameter to control integration direction and additional parameters for custom integration behavior.
