bundles / numpy latest / numpy / polynomial / polynomial / polyvander3d
function
numpy.polynomial.polynomial:polyvander3d
source: build-install/usr/lib/python3.14/site-packages/numpy/polynomial/polynomial.py :1220
Signature
def polyvander3d ( x , y , z , deg ) Summary
Pseudo-Vandermonde matrix of given degrees.
Extended Summary
Returns the pseudo-Vandermonde matrix of degrees deg and sample points (x, y, z). If l, m, n are the given degrees in x, y, z, then The pseudo-Vandermonde matrix is defined by
where 0 <= i <= l, 0 <= j <= m, and 0 <= j <= n. The leading indices of V index the points (x, y, z) and the last index encodes the powers of x, y, and z.
If V = polyvander3d(x, y, z, [xdeg, ydeg, zdeg]), then the columns of V correspond to the elements of a 3-D coefficient array c of shape (xdeg + 1, ydeg + 1, zdeg + 1) in the order
and np.dot(V, c.flat) and polyval3d(x, y, z, c) will be the same up to roundoff. This equivalence is useful both for least squares fitting and for the evaluation of a large number of 3-D polynomials of the same degrees and sample points.
Parameters
x, y, z: array_likeArrays of point coordinates, all of the same shape. The dtypes will be converted to either float64 or complex128 depending on whether any of the elements are complex. Scalars are converted to 1-D arrays.
deg: list of intsList of maximum degrees of the form [x_deg, y_deg, z_deg].
Returns
vander3d: ndarrayThe shape of the returned matrix is
x.shape + (order,), where . The dtype will be the same as the convertedx,y, andz.
Examples
import numpy as np from numpy.polynomial import polynomial as P x = np.asarray([-1, 2, 1]) y = np.asarray([1, -2, -3]) z = np.asarray([2, 2, 5]) l, m, n = [2, 2, 1] deg = [l, m, n] V = P.polyvander3d(x=x, y=y, z=z, deg=deg)✓
V
✗i, j, k = 2, 1, 0 V[:, (m+1)*(n+1)*i + (n+1)*j + k] == x**i * y**j * z**k✓
See also
Aliases
-
numpy.polynomial.polynomial.polyvander3d