
- 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
Differentiate a Legendre series with multidimensional coefficients in Python
To differentiate a Legendre series, use the polynomial.laguerre.legder() method in Python. Returns the Legendre series coefficients c differentiated m times along axis. At each iteration the result is multiplied by scl
The 1st parameter, c is an array of Legendre series coefficients. If c is multidimensional the different axis correspond to different variables with the degree in each axis given by the corresponding index. The 2nd parameter, m is the number of derivatives taken, must be non-negative. (Default: 1). The 3rd parameter, scl is a scalar. Each differentiation is multiplied by scl. The end result is multiplication by scl**m. This is for use in a linear change of variable. (Default: 1). The 4th parameter, axis is an Axis over which the derivative is taken. (Default: 0).
Steps
At first, import the required library −
import numpy as np from numpy.polynomial import legendre as L
Create a multidimensional array of coefficients −
c = np.arange(4).reshape(2,2)
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 differentiate a Legendre series, use the polynomial.laguerre.legder() method in Python. Returns the Legendre series coefficients c differentiated m times along axis. At each iteration the result is multiplied by scl −
print("\nResult...\n",L.legder(c))
Example
import numpy as np from numpy.polynomial import legendre as L # Create a multidimensional array of coefficients c = np.arange(4).reshape(2,2) # 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 differentiate a Legendre series, use the polynomial.laguerre.legder() method in Python print("\nResult...\n",L.legder(c))
Output
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... [[2. 3.]]
- Related Articles
- Differentiate a Legendre series with multidimensional coefficients over specific axis in Python
- Differentiate a Legendre series with multidimensional coefficients over axis 1 in Python
- Differentiate a Hermite_e series with multidimensional coefficients in Python
- Differentiate a Hermite series with multidimensional coefficients in Python
- Differentiate a Laguerre series with multidimensional coefficients in Python
- Differentiate a Chebyshev series with multidimensional coefficients in Python
- Differentiate a Hermite_e series with multidimensional coefficients over specific axis in Python
- Differentiate a Hermite_e series with multidimensional coefficients over axis 1 in Python
- Differentiate a Chebyshev series with multidimensional coefficients over specific axis in Python
- Differentiate a Chebyshev series with multidimensional coefficients over axis 1 in Python
- Differentiate a Hermite series with multidimensional coefficients over specific axis in Python
- Differentiate a Hermite series with multidimensional coefficients over axis 1 in Python
- Differentiate a Laguerre series with multidimensional coefficients over specific axis in Python
- Differentiate a Laguerre series with multidimensional coefficients over axis 1 in Python
- Differentiate a polynomial with multidimensional coefficients in Python
