Javatpoint Logo
Javatpoint Logo

Differentiate a Legendre Series and Set the Derivatives using NumPy in Python

Introduction:

In this tutorial, we will discuss the differentiation of a Legendre series and set the derivatives using NumPy in Python. There is a method used to differentiate a Legendre series and select the derivatives using NumPy in Python from the NumPy library, the method name is numpy.polynomial.legendre.legder(). In the Legendre series, the coefficient is defined by 'c'. The 'c' is differed 't' times along with the axis are returned. Then we find a value. This value will be multiplied at each iteration by scl (Scl is a scaler quantity). The multiplication value is scl**m. Argument c is a coefficient of the Array. This ranges in degree between low to high along each axis; an example is [5,4,3]. An equation of series initializes this argument. The equation is - 5 *L 0 + 4*L 1 + 3*L 2. Consequently, [[3,1], [3,1]] indicates a series, which is 3 *L 0(x)*L 0(y) + 3*L 1(x)*L 0(y) + 1*L 0(x)*L 1(y) + 1*L 1(x)*L 1(y). If the axis is 0, then it represents the x-axis. Similarly, if the axis is 1, then it represents the y-axis. If the coefficient c is multidimensional, each variable will represent a different axis.

Syntax of the Legendre series, and set the derivatives using NumPy in Python

The syntax of the Legendre series and set of the derivatives using NumPy in Python is given below -

Step 2:

For creating the Array of coefficient c, the code is given below -

Step 3:

For displaying the Array in Python, we use a code, which is given below -

Step 4:

For checking the dimension in Python, we use a code, which is given below -

Step 5:

To get the Datatype, we use a code, which is given below -

Step 6:

For displaying the shape in Python, we use a code, which is given below -

Step 7:

For printing the result of a Legendre series and setting the derivatives using NumPy in Python, we use a code that is given below -

Program Code:

Now we give the program code the generate a Legendre series and set the derivatives using NumPy in Python. It is the basic code for implementing the Legendre series in Python. We write the code in visual studio code, and the program is given in below -

Output:

Now we compile the above program and run it in any manner. After running the program, we found the output, and this output is given below -

The array value is: [2 3 4 5]
The dimension of this Array is: 1
The Datatype of this Array object is: int64
The shape of this Array object is: (4,)
The result is: [12. 75.]

Conclusion

In this tutorial, we discuss the differentiation of a Legendre series and set the derivatives using NumPy in Python. numpy.polynomial.legendre.legder() is the method which is used here. Here we also share the syntax and return value of it. And for the learning purpose, we also share the steps as well as an example of it.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA