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
Multiply a Laguerre series by an independent variable in Python
To multiply a Laguerre series by an independent variable, use the polynomial.laguerre.lagmulx() method in Python. This function multiplies the Laguerre series c by x, where x is the independent variable. The parameter c is a 1-D array of Laguerre series coefficients ordered from low to high.
Syntax
numpy.polynomial.laguerre.lagmulx(c)
Parameters:
-
c- 1-D array of Laguerre series coefficients ordered from low to high
Returns: Array representing the Laguerre series multiplied by x
Example
Let's create a Laguerre series with coefficients [1, 2, 3] and multiply it by the independent variable ?
import numpy as np
from numpy.polynomial import laguerre as L
# Create an array of Laguerre coefficients
coefficients = np.array([1, 2, 3])
# Display the original array
print("Original coefficients:", coefficients)
print("Dimensions:", coefficients.ndim)
print("Shape:", coefficients.shape)
# Multiply the Laguerre series by x
result = L.lagmulx(coefficients)
print("Result after multiplication by x:", result)
Original coefficients: [1 2 3] Dimensions: 1 Shape: (3,) Result after multiplication by x: [-1. -1. 11. -9.]
How It Works
The lagmulx() function performs multiplication of a Laguerre series by the independent variable x. The original series has 3 coefficients, but the result has 4 coefficients because multiplying by x increases the degree of the polynomial by 1.
Multiple Examples
import numpy as np
from numpy.polynomial import laguerre as L
# Example 1: Simple coefficients
c1 = np.array([1, 0])
result1 = L.lagmulx(c1)
print("Input [1, 0]:", result1)
# Example 2: All ones
c2 = np.array([1, 1, 1])
result2 = L.lagmulx(c2)
print("Input [1, 1, 1]:", result2)
# Example 3: Floating point coefficients
c3 = np.array([0.5, 1.5, 2.5])
result3 = L.lagmulx(c3)
print("Input [0.5, 1.5, 2.5]:", result3)
Input [1, 0]: [ 0. -1. 2.] Input [1, 1, 1]: [-1. 0. 6. -6.] Input [0.5, 1.5, 2.5]: [-0.5 -0.5 5.5 -7.5]
Conclusion
The lagmulx() function is essential for manipulating Laguerre series by multiplying with the independent variable. It automatically handles the coefficient transformation and increases the polynomial degree by one.
