Python Articles

Page 222 of 855

Convert a Legendre series to a polynomial in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 311 Views

In Python, you can convert a Legendre series to a polynomial using NumPy's polynomial.legendre.leg2poly() method. This function transforms Legendre series coefficients into standard polynomial coefficients. Syntax numpy.polynomial.legendre.leg2poly(c) Parameters: c: 1-D array containing Legendre series coefficients, ordered from lowest to highest degree Returns: 1-D array of equivalent polynomial coefficients ordered from lowest to highest degree. Example Let's convert a Legendre series with coefficients [1, 2, 3, 4, 5] to its polynomial form ? import numpy as np from numpy.polynomial import legendre as L # Create Legendre series coefficients ...

Read More

Evaluate a 2D Legendre series on the Cartesian product of x and y with 1d array of coefficient in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 178 Views

To evaluate a 2D Legendre series on the Cartesian product of x and y, use the polynomial.legendre.leggrid2d() method in NumPy. This method evaluates a two-dimensional Legendre series at points formed by the Cartesian product of x and y arrays using a 1D array of coefficients. Understanding leggrid2d() The leggrid2d() function takes three parameters ? x, y ? Arrays defining evaluation points. The series is evaluated at the Cartesian product of these points c ? 1D or 2D array of coefficients where c[i, j] contains the coefficient for the term of degree (i, j) If ...

Read More

Evaluate a 2D Legendre series on the Cartesian product of x and y with 3d array of coefficient in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 205 Views

To evaluate a 2D Legendre series on the Cartesian product of x and y with a 3D array of coefficients, use the polynomial.legendre.leggrid2d() method in NumPy. This method returns the values of the two-dimensional Legendre series at points in the Cartesian product of x and y. Understanding the Function The leggrid2d() function takes three parameters: x, y: The coordinates for evaluation. The series is evaluated at points in the Cartesian product of x and y c: A 3D array of coefficients where c[i, j] contains the coefficient of the term of multi-degree i, j ...

Read More

Generate a Pseudo Vandermonde matrix of the Hermite_e polynomial with complex array of points coordinates in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 189 Views

To generate a pseudo Vandermonde matrix of the Hermite_e polynomial with complex coordinates, use the hermite_e.hermevander2d() function in NumPy. This function returns a pseudo-Vandermonde matrix where the parameters x and y are arrays of point coordinates with the same shape. The data types are automatically converted to float64 or complex128 depending on whether any elements are complex. Syntax numpy.polynomial.hermite_e.hermevander2d(x, y, deg) Parameters The function accepts the following parameters: x, y − Arrays of point coordinates, all of the same shape deg − List of maximum degrees in the form [x_deg, y_deg] ...

Read More

Evaluate a 2D Legendre series at points (x, y) with 1D array of coefficient in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 183 Views

To evaluate a 2D Legendre series at points (x, y), use the polynomial.legendre.legval2d() method in NumPy. This method returns the values of the two-dimensional Legendre series at points formed from pairs of corresponding values from x and y arrays. Syntax numpy.polynomial.legendre.legval2d(x, y, c) Parameters The function takes the following parameters: x, y: The two dimensional series is evaluated at points (x, y). Both must have the same shape. If x or y is a list or tuple, it is converted to an ndarray. c: Array of coefficients ordered so that the coefficient ...

Read More

Evaluate a 3D Legendre series at points (x,y,z) with 4D array of coefficient in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 253 Views

To evaluate a 3D Legendre series at points (x, y, z) use the polynomial.legendre.legval3d() method in Python NumPy. The method returns the values of the multidimensional polynomial on points formed with triples of corresponding values from x, y, and z. If the coefficient array has fewer than 3 dimensions, ones are implicitly appended to its shape to make it 3-D. The shape of the result will be c.shape[3:] + x.shape. The first parameter consists of x, y, z coordinates where x, y, and z must have the same shape. The second parameter is the coefficient array c, ordered ...

Read More

Evaluate a 3D Legendre series at points (x, y, z) in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 198 Views

To evaluate a 3D Legendre series at points (x, y, z), use the polynomial.legendre.legval3d() method in Python NumPy. The method returns the values of the multidimensional polynomial on points formed with triples of corresponding values from x, y, and z. If the coefficient array c has fewer than 3 dimensions, ones are implicitly appended to its shape to make it 3-D. The shape of the result will be c.shape[3:] + x.shape. The coordinates x, y, and z must have the same shape, and if any are lists or tuples, they are first converted to ndarrays. Syntax ...

Read More

Evaluate a Legendre series at array of points x in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 338 Views

To evaluate a Legendre series at an array of points x, use the polynomial.legendre.legval() method in Python NumPy. This method takes coefficients of a Legendre polynomial and evaluates it at specified points. Syntax numpy.polynomial.legendre.legval(x, c, tensor=True) Parameters x: Array of points at which to evaluate the series. If x is a list or tuple, it is converted to an ndarray. The elements must support addition and multiplication operations. c: Array of coefficients ordered so that coefficients for terms of degree n are in c[n]. For multidimensional arrays, remaining indices enumerate multiple polynomials. ...

Read More

Evaluate a Legendre series at points x broadcast over the columns of the coefficient in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 180 Views

To evaluate a Legendre series at points x, use the polynomial.legendre.legval() method in Python NumPy. This function broadcasts x over the columns of the coefficient array, making it useful for evaluating multiple polynomials simultaneously. Syntax numpy.polynomial.legendre.legval(x, c, tensor=True) Parameters x: Array of points at which to evaluate the series. If x is a list or tuple, it is converted to an ndarray, otherwise treated as a scalar. c: Array of coefficients ordered so that coefficients for terms of degree n are in c[n]. If multidimensional, remaining indices enumerate multiple polynomials stored in columns. ...

Read More

Evaluate a Legendre series at points x in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 219 Views

To evaluate a Legendre series at specific points x in Python, use the polynomial.legendre.legval() method from NumPy. This function computes the value of a Legendre polynomial series at given points using the provided coefficients. Syntax numpy.polynomial.legendre.legval(x, c, tensor=True) Parameters x: Points at which to evaluate the Legendre series. Can be a scalar, list, tuple, or ndarray. c: Array of coefficients ordered so that coefficients for terms of degree n are in c[n]. For multidimensional arrays, remaining indices enumerate multiple polynomials. tensor: If True (default), the coefficient array shape is extended for broadcasting. ...

Read More
Showing 2211–2220 of 8,546 articles
« Prev 1 220 221 222 223 224 855 Next »
Advertisements