Evaluate a Legendre Series at Multidimensional Array of Points X in Python

Introduction:

In this tutorial, we will discuss how to evaluate a Legendre series at multidimensional array of points x in Python. The Legendre series at multidimensional Array have multiple methods; one most common method is the polynomial.legendre.legval() method. This method functions the calculus and arithmetic operation in the Legendre series. It is one of the essential functions provided by the Legendre class. polynomial.legendre.legval() method is used to generate the Legendre series, and this method is used the Array, which is multidimensional. As well as this method is available in the Legendre module in Python.

Syntax:

The syntax of the Legendre series at multidimensional array of points x in Python is given below -

Parameters:

The parameters of the Legendre series at multidimensional array of points x in Python are given below -

  1. x is defining the tuple or list. It is converted into an array. It is a scalar type. x supports multiplication and addition with its elements and elements of c.
  2. c is the coefficient order of the Array. The degree of this coefficient is n. So, the coefficient is written as c[n]. When the coefficient is multidimensional, the rest of the value indicates the multiple polynomials. In the case of two dimensional, the coefficient is stored in the column c.
  3. tensor defines the value of optional or Boolean. If the value of the tensor is true, then it is extended to the left of the x, and the scalar of the value is 0. If the tensor value is false, then x is developed in the value of c.

Return Value

The return value of the Legendre series at multidimensional array of points x in Python is a new Array.

Steps of the Legendre Series at Multidimensional Array of Points X in Python

The steps of the Legendre series at multidimensional array of points x in Python are given below -

Step 1:

Firstly, import the required library in Python. The example 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:

If the value of x is a 2D Array, then we use a code in Python, which is given below -

Step 8:

For printing the result of a Legendre series in a multidimensional Array using NumPy in Python, we use a code, which is given below:

Code:

Now we give the program code the generate a Legendre series at multidimensional array of points x in Python. It is the basic code for implementing the Legendre series at a multidimensional Array 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]
The dimension of this Array is: 1
The Datatype of this Array object is: int64
The shape of this Array object is: (3,)
The result is: [[2. 2.]
 [2. 2.]]

Conclusion:

This tutorial has discusses how to evaluate a Legendre series at multidimensional array of points x in Python. Legval is the primary method of it. Here we also share its syntax, parameters, and return value. And for the learning purpose, we also share the steps and an example.






Latest Courses