Python Numpy np.legvander3d()方法

Python Numpy np.legvander3d()方法

np.legvander3d()方法用于返回度数为deg和样本点x、y和z的Vandermonde矩阵。

语法: np.legvander3d(x, y, z, deg)
参数:
x, y, z : [ array_like ] 点的阵列。dtype被转换为float64或compound128,取决于是否有元素是复数。如果x是标量,它被转换为一个一维数组。
deg : [int] 结果矩阵的度数。

返回:返回范德蒙德矩阵。

例子#1 :
在这个例子中,我们可以看到,通过使用np.legvander3d()方法,我们能够用这个方法得到伪范特蒙德矩阵。

# import numpy
import numpy as np
import numpy.polynomial.legendre as geek
  
# using np.legvander3d() method
ans = geek.legvander3d((1, 3, 5), (2, 4, 6), (1, 2, 3), [2, 2, 2])
  
print(ans)

输出 :

[[ 1.00000000e+00 1.00000000e+00 1.00000000e+00 2.00000000e+00
2.00000000e+00 2.00000000e+00 5.50000000e+00 5.50000000e+00
5.50000000e+00 1.00000000e+00 1.00000000e+00 1.00000000e+00
2.00000000e+00 2.00000000e+00 2.00000000e+00 5.50000000e+00
5.50000000e+00 5.50000000e+00 1.00000000e+00 1.00000000e+00
1.00000000e+00 2.00000000e+00 2.00000000e+00 2.00000000e+00
5.50000000e+00 5.50000000e+00 5.50000000e+00]
[ 1.00000000e+00 2.00000000e+00 5.50000000e+00 4.00000000e+00
8.00000000e+00 2.20000000e+01 2.35000000e+01 4.70000000e+01
1.29250000e+02 3.00000000e+00 6.00000000e+00 1.65000000e+01
1.20000000e+01 2.40000000e+01 6.60000000e+01 7.05000000e+01
1.41000000e+02 3.87750000e+02 1.30000000e+01 2.60000000e+01
7.15000000e+01 5.20000000e+01 1.04000000e+02 2.86000000e+02
3.05500000e+02 6.11000000e+02 1.68025000e+03]
[ 1.00000000e+00 3.00000000e+00 1.30000000e+01 6.00000000e+00
1.80000000e+01 7.80000000e+01 5.35000000e+01 1.60500000e+02
6.95500000e+02 5.00000000e+00 1.50000000e+01 6.50000000e+01
3.00000000e+01 9.00000000e+01 3.90000000e+02 2.67500000e+02
8.02500000e+02 3.47750000e+03 3.70000000e+01 1.11000000e+02
4.81000000e+02 2.22000000e+02 6.66000000e+02 2.88600000e+03
1.97950000e+03 5.93850000e+03 2.57335000e+04]]

例子#2 :

# import numpy
import numpy as np
import numpy.polynomial.legendre as geek
  
ans = geek.legvander3d((1, 2), (3, 4), (5, 6), [3, 3, 3])
  
print(ans)

输出 :

[[ 1.00000000e+00 5.00000000e+00 3.70000000e+01 3.05000000e+02
3.00000000e+00 1.50000000e+01 1.11000000e+02 9.15000000e+02
1.30000000e+01 6.50000000e+01 4.81000000e+02 3.96500000e+03
6.30000000e+01 3.15000000e+02 2.33100000e+03 1.92150000e+04
1.00000000e+00 5.00000000e+00 3.70000000e+01 3.05000000e+02
3.00000000e+00 1.50000000e+01 1.11000000e+02 9.15000000e+02
1.30000000e+01 6.50000000e+01 4.81000000e+02 3.96500000e+03
6.30000000e+01 3.15000000e+02 2.33100000e+03 1.92150000e+04
1.00000000e+00 5.00000000e+00 3.70000000e+01 3.05000000e+02
3.00000000e+00 1.50000000e+01 1.11000000e+02 9.15000000e+02
1.30000000e+01 6.50000000e+01 4.81000000e+02 3.96500000e+03
6.30000000e+01 3.15000000e+02 2.33100000e+03 1.92150000e+04
1.00000000e+00 5.00000000e+00 3.70000000e+01 3.05000000e+02
3.00000000e+00 1.50000000e+01 1.11000000e+02 9.15000000e+02
1.30000000e+01 6.50000000e+01 4.81000000e+02 3.96500000e+03
6.30000000e+01 3.15000000e+02 2.33100000e+03 1.92150000e+04]
[ 1.00000000e+00 6.00000000e+00 5.35000000e+01 5.31000000e+02
4.00000000e+00 2.40000000e+01 2.14000000e+02 2.12400000e+03
2.35000000e+01 1.41000000e+02 1.25725000e+03 1.24785000e+04
1.54000000e+02 9.24000000e+02 8.23900000e+03 8.17740000e+04
2.00000000e+00 1.20000000e+01 1.07000000e+02 1.06200000e+03
8.00000000e+00 4.80000000e+01 4.28000000e+02 4.24800000e+03
4.70000000e+01 2.82000000e+02 2.51450000e+03 2.49570000e+04
3.08000000e+02 1.84800000e+03 1.64780000e+04 1.63548000e+05
5.50000000e+00 3.30000000e+01 2.94250000e+02 2.92050000e+03
2.20000000e+01 1.32000000e+02 1.17700000e+03 1.16820000e+04
1.29250000e+02 7.75500000e+02 6.91487500e+03 6.86317500e+04
8.47000000e+02 5.08200000e+03 4.53145000e+04 4.49757000e+05
1.70000000e+01 1.02000000e+02 9.09500000e+02 9.02700000e+03
6.80000000e+01 4.08000000e+02 3.63800000e+03 3.61080000e+04
3.99500000e+02 2.39700000e+03 2.13732500e+04 2.12134500e+05
2.61800000e+03 1.57080000e+04 1.40063000e+05 1.39015800e+06]]

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程