1.源码实现
import numpy as np
x1 = np.array([1, 2, 3, 4])
v1 = np.vander(x1)
x2 = np.array([1.0, 1.5, 2.0, 2.5, 3.0])
v2 = np.vander(x2)
print(v1)
print(v2)
2.运行及其结果
$ python3 vander.py
[[ 1 1 1 1]
[ 8 4 2 1]
[27 9 3 1]
[64 16 4 1]]
[[ 1. 1. 1. 1. 1. ]
[ 5.0625 3.375 2.25 1.5 1. ]
[ 16. 8. 4. 2. 1. ]
[ 39.0625 15.625 6.25 2.5 1. ]
[ 81. 27. 9. 3. 1. ]]
网友评论