Numpy Articles

Page 26 of 81

Make a grid for computing a Mandelbrot set with outer product in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 251 Views

The Mandelbrot set is a famous fractal that requires computing complex numbers on a 2D grid. To create this grid efficiently, we can use NumPy's outer product to combine real and imaginary components. Understanding the Outer Product Given two vectors, a = [a0, a1, ..., aM] and b = [b0, b1, ..., bN], the outer product is − [[a0*b0 a0*b1 ... a0*bN ] [a1*b0 . . ] [ ... . ...

Read More

Compute the sign and natural logarithm of the determinant of an array in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 295 Views

To compute the sign and natural logarithm of the determinant of an array, use the numpy.linalg.slogdet() method in Python. This function is particularly useful when dealing with large matrices where the determinant might overflow or underflow. The method returns two values: sign (representing the sign of the determinant) and logdet (the natural logarithm of the absolute value). For real matrices, sign is 1, 0, or -1. The original determinant equals sign * np.exp(logdet). Syntax numpy.linalg.slogdet(a) Parameters: a - Input array, must be a square 2-D array Returns: sign - Sign ...

Read More

Return the cumulative product of array elements over a given axis treating NaNs as one in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 235 Views

To return the cumulative product of array elements over a given axis treating NaNs as one, use the nancumprod() method. The cumulative product does not change when NaNs are encountered and leading NaNs are replaced by ones. Ones are returned for slices that are all-NaN or empty. Cumulative product works like: 5, 5×10, 5×10×15, 5×10×15×20. When NaN values are present, they are treated as 1, so the cumulative product continues without interruption. Syntax numpy.nancumprod(a, axis=None, dtype=None, out=None) Parameters The nancumprod() method accepts the following parameters ? a ? Input array axis ...

Read More

Integrate a Laguerre series in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 215 Views

To integrate a Laguerre series, use the laguerre.lagint() method in Python. The method returns the Laguerre series coefficients c integrated m times from lbnd along axis. At each iteration the resulting series is multiplied by scl and an integration constant, k, is added. The scaling factor is for use in a linear change of variable. Syntax laguerre.lagint(c, m=1, k=[], lbnd=0, scl=1, axis=0) Parameters The function accepts the following parameters ? c − Array of Laguerre series coefficients. If c is multidimensional the different axis correspond to different variables with the degree in ...

Read More

Generate a Chebyshev series with given roots in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 282 Views

To generate a Chebyshev series with given roots, use the chebyshev.chebfromroots() method in Python NumPy. The method returns a 1-D array of coefficients. If all roots are real then out is a real array, if some of the roots are complex, then out is complex even if all the coefficients in the result are real. The parameter roots is the sequence containing the roots. Syntax numpy.polynomial.chebyshev.chebfromroots(roots) Parameters roots − Sequence containing the roots. Return Value Returns 1-D array of Chebyshev series coefficients ordered from low to high degree. Example Let's ...

Read More

Evaluate a Laguerre series at points x with multidimensional coefficient array in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 201 Views

To evaluate a Laguerre series at points x with a multidimensional coefficient array, use the polynomial.laguerre.lagval() method in Python NumPy. This method allows you to evaluate multiple Laguerre polynomials simultaneously using a 2D coefficient matrix. Syntax numpy.polynomial.laguerre.lagval(x, c, tensor=True) Parameters The function accepts three parameters ? x − Points at which to evaluate the series. Can be scalar, list, or array c − Coefficient array where coefficients for degree n are in c[n]. For multidimensional arrays, additional indices represent multiple polynomials tensor − Boolean flag controlling evaluation behavior (default True) ...

Read More

Evaluate a Laguerre series at list of points x in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 227 Views

To evaluate a Laguerre series at points x, use the polynomial.laguerre.lagval() method in NumPy. This function takes evaluation points and coefficients to compute the series values. Syntax numpy.polynomial.laguerre.lagval(x, c, tensor=True) Parameters The function accepts three parameters: x − Array of points at which to evaluate the series. Can be a scalar, list, or array c − Array of coefficients ordered from lowest to highest degree tensor − Boolean controlling evaluation behavior for multidimensional arrays (default: True) Example Let's evaluate a Laguerre series with coefficients [1, 2, 3] at multiple ...

Read More

Evaluate a Laguerre series at tuple of points x in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 175 Views

To evaluate a Laguerre series at points x, use the polynomial.laguerre.lagval() method in Python NumPy. The first parameter is x, which can be a list, tuple, or scalar. If x is a list or tuple, it is converted to an ndarray, otherwise it is left unchanged and treated as a scalar. The second parameter c is an array of coefficients ordered so that the coefficients for terms of degree n are contained in c[n]. If c is multidimensional, the remaining indices enumerate multiple polynomials. The third parameter tensor controls the evaluation behavior. If True (default), the shape of ...

Read More

Generate a Pseudo Vandermonde matrix of the Laguerre polynomial and x, y, z complex array of points in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 201 Views

To generate a pseudo Vandermonde matrix of the Laguerre polynomial with x, y, z sample points, use the laguerre.lagvander3d() method in NumPy. This function creates a three-dimensional Vandermonde matrix where each element corresponds to the evaluation of Laguerre polynomials at the given complex points. Syntax numpy.polynomial.laguerre.lagvander3d(x, y, z, deg) Parameters The function accepts the following parameters: x, y, z − Arrays of point coordinates. The dtype is converted to float64 or complex128 depending on whether any elements are complex deg − List of maximum degrees of the form [x_deg, y_deg, z_deg] ...

Read More

Evaluate a Legendre series at points x and the shape of the coefficient array extended for each dimension of x in Python

AmitDiwan
AmitDiwan
Updated on 26-Mar-2026 188 Views

To evaluate a Legendre series at points x, use the polynomial.legendre.legval() method in NumPy. This function allows you to evaluate Legendre polynomials with specified coefficients at given points, with control over how multidimensional coefficient arrays are handled. Syntax numpy.polynomial.legendre.legval(x, c, tensor=True) Parameters The function accepts three parameters: x: Points at which to evaluate the series. Can be a scalar, list, or array c: Array of coefficients where c[n] contains coefficients for terms of degree n tensor: Boolean controlling shape behavior for multidimensional arrays (default: True) Understanding the Tensor Parameter ...

Read More
Showing 251–260 of 802 articles
« Prev 1 24 25 26 27 28 81 Next »
Advertisements