
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Multiply a Legendre series by an independent variable in Python
To multiply the Legendre series c by x, where x is the independent variable, use the polynomial.laguerre.legmulx() method in Python Numpy. The method returns an array representing the result of the multiplication. Returns the difference of two Legendre series c1 - c2. The arguments are sequences of coefficients ordered from lowest order term to highest, i.e., [1,2,3] represents the series P_0 + 2*P_1 + 3*P_2. The parameter, c is a 1-D array of Legendre series coefficients ordered from low to high.
Steps
At first, import the required library −
import numpy as np from numpy.polynomial import laguerre as L
Create an array −
c = np.array([1, 2, 3])
Display the array −
print("Our Array...\n",c)
Check the Dimensions −
print("\nDimensions of our Array...\n",c.ndim)
Get the Datatype −
print("\nDatatype of our Array object...\n",c.dtype)
Get the Shape −
print("\nShape of our Array object...\n",c.shape)
To multiply the Legendre series c by x, where x is the independent variable, use the polynomial.laguerre.legmulx() method in Python Numpy −
print("\nResult....\n",L.legmulx(c))
Example
import numpy as np from numpy.polynomial import legendre as L # Create an array c = np.array([1, 2, 3]) # Display the array print("Our Array...\n",c) # Check the Dimensions print("\nDimensions of our Array...\n",c.ndim) # Get the Datatype print("\nDatatype of our Array object...\n",c.dtype) # Get the Shape print("\nShape of our Array object...\n",c.shape) # To multiply the Legendre series c by x, where x is the independent variable, use the polynomial.laguerre.legmulx() method in Python Numpy print("\nResult....\n",L.legmulx(c))
Output
Our Array... [1 2 3] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (3,) Result.... [0.66666667 2.2 1.33333333 1.8 ]
- Related Articles
- Multiply a Chebyshev series by an independent variable in Python
- Multiply a Hermite series by an independent variable in Python
- Multiply a Laguerre series by an independent variable in Python
- Multiply a Hermite_e series by an independent variable in Python
- Differentiate a Legendre series and multiply each differentiation by a scalar in Python
- Multiply one Legendre series to another in Python
- Differentiate a Legendre series, set the derivatives and multiply each differentiation by a scalar in Python
- Integrate a Legendre series and multiply the result by a scalar before the integration constant is added in Python
- Divide one Legendre series by another in Python
- Differentiate a Legendre series in Python
- Integrate a Legendre series in Python
- Convert a polynomial to Legendre series in Python
- Raise a Legendre series to a power in Python
- Convert a Legendre series to a polynomial in Python
- Evaluate a Legendre series at points x in Python
