Differentiate a Legendre Series with multidimensional coefficients in Python

Method legendre.legder

The Python Legendre module offers several functions, such as a ledger, that can be used to conduct mathematical and calculus operations on the Legendre series. It is one of the features that the Legendre class offers. The following is a list of the ledger method's syntax. This technique is used to create the Legendre series and is available in the Python NumPy module. It returns a multidimensional coefficient array.

Syntax:

Parameter:

  • x: Tuple or a List
  • m: Derivatives taken should always be non-negative.(Default: 1)
  • axis: Derivatives that are taken over this.(Default:0)

Return: Legendre series

Use Python's polynomial.laguerre.ledger() method to distinguish a Legendre series. The returned values are the Legendre series coefficients, differentiated c times along the axis. At each repetition, the result is multiplied by scl. Legendre module provides operations like arithmetic and calculus to the ledger to perform.

An array of Legendre series coefficients makes up the first parameter, c. If c is multidimensional, then the associated index determines each axis' degree, and a different set of axes represents each axis' distinct variables. The second parameter, m, which represents how many derivatives were used, must not be negative. (Preset: 1). A scalar is the third parameter, Scl. SCL is used to multiply each differentiation. Scl**m multiplication is the result. This is for use when changing a variable linearly. (Preset: 1). The derivative is taken over the axis represented by the fourth parameter, the axis. (Default:0).

Steps

Step 1: Initially, we import the required libraries-

Step 2: Creation of a multidimensional array of coef-

Step 3: Displaying of array

Step 4: Dimensions checking-

Step 5: Getting Datatype-

Step 6: Getting Shape-

Use Python's polynomial. Laguerre.ledger () method to distinguish a Legendre series. The returned values are the Legendre series coefficients, differentiated c times along the axis. The result is multiplied by scl at each iteration.

Output:

Our Array...
   [[0 1]
   [2 3]]
Dimensions of our Array...
2
The datatype of our Array object...
int64
The shape of our Array object...
(2, 2)
Result...
   [[2. 3.]]

Example 1:

This example shows how to create a 5 x 3 coefficient multidimensional array and display the size and form of an array. Additionally, we use the legendre. ledger() technique to distinguish a Legendre series.

Output:

[[ 1  2  3  4  5]
 [ 3  4  2  6  7]
 [43 45  2  6  7]]
The shape of an array: (3, 5)
Dimension: 2
Differentiated legendre series [[  3.  4.   2.   6.   7.]
 [129. 135.   6.  18.  21.]]

Example 2:

In this example, we'll create a 5 x 2 coefficient multidimensional array and show how an array is shaped and sized. The number of derivatives employed is 2, and the axis along which the derivative is taken is 1.

Output:

[[ 1  2  3  4  5]
 [43 45  2  6  7]]
The shape of an array: (2, 5)
Dimension: 2
Differentiated Legendre series [[ 59.  60. 175.]
 [ 76.  90. 245.]]