gpt4 book ai didi

python - 多变量的 Polyval

转载 作者:行者123 更新时间:2023-11-28 18:01:46 32 4
gpt4 key购买 nike

我正在寻找一个函数来计算具有多个变量的多项式的值。对于二维多项式,我使用 numpy.polyval,我将系数值作为列表和 x 值。

我想知道 x、y、z 空间是否有类似的函数,所以我的输入是系数值和 x、y 的值。

最佳答案

你在找这个吗?

link

Evaluate a 2-D polynomial at points (x, y).

This function returns the value

p(x,y) = \sum_{i,j} c_{i,j} * x^i * y^j

The parameters x and y are converted to arrays only if they are tuples or a lists, otherwise they are treated as a scalars and they must have the same shape after conversion. In either case, either x and y or their elements must support multiplication and addition both with themselves and with the elements of c.

If c has fewer than two dimensions, ones are implicitly appended to its shape to make it 2-D. The shape of the result will be c.shape[2:] + x.shape.

Parameters:

x, y : array_like, compatible objects

The two dimensional series is evaluated at the points (x, y), where x and y must have the same shape. If x or y is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and, if it isn’t an ndarray, it is treated as a scalar.

c : array_like

Array of coefficients ordered so that the coefficient of the term of multi-degree i,j is contained in c[i,j]. If c has dimension greater than two the remaining indices enumerate multiple sets of coefficients.

Returns:

values : ndarray, compatible object The values of the two dimensional polynomial at points formed with pairs of corresponding values from x and y.

关于python - 多变量的 Polyval,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55365055/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com