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
Raise a Laguerre series to a power in Python
To raise a Laguerre series to a power, use the polynomial.laguerre.lagpow() method in NumPy. The method returns the Laguerre series c raised to the power pow. The argument c is a sequence of coefficients ordered from low to high. For example, [1,2,3] represents the series P? + 2*P? + 3*P?.
Syntax
numpy.polynomial.laguerre.lagpow(c, pow, maxpower=16)
Parameters
The function accepts the following parameters ?
- c ? 1-D array of Laguerre series coefficients ordered from low to high
- pow ? Power to which the series will be raised
- maxpower ? Maximum power allowed (default is 16). This limits growth to manageable size
Example
Let's create a Laguerre series and raise it to the power of 3 ?
import numpy as np
from numpy.polynomial import laguerre as L
# Create 1-D array of Laguerre series coefficients
c = np.array([1, 2, 3])
# Display the coefficient array
print("Our coefficient 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)
# Raise Laguerre series to power 3
print("\nResult (c^3)...")
print(L.lagpow(c, 3))
Our coefficient Array... [1 2 3] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (3,) Result (c^3)... [ 150. -1116. 4590. -9672. 11934. -8100. 2430.]
Understanding the Result
The original series [1, 2, 3] represents P? + 2*P? + 3*P?. When raised to the power of 3, it produces a higher-degree polynomial with 7 coefficients. The resulting coefficients show how the Laguerre polynomials interact when the series is cubed.
Conclusion
The lagpow() function efficiently raises Laguerre series to specified powers. Use the maxpower parameter to control polynomial growth and prevent memory issues with high powers.
