เมธอด chebyshev.chebvander() สร้างเมทริกซ์แวนเดอร์มอนด์ (Vandermonde matrix) ของพหุนามเชบิเชฟ รูปร่างเมทริกซ์คือ x.shape + (deg + 1,) โดยดัชนีสุดท้ายคือดีกรีของพหุนามเชบิเชฟ
ขั้นตอน
import numpy as np
from numpy.polynomial import chebyshev as C
x = np.array([0, 1, -1, 2])
print("Our Array...\n", x)
print("\nDimensions of our Array...\n", x.ndim)
print("\nDatatype of our Array object...\n", x.dtype)
print("\nShape of our Array object...\n", x.shape)
print("\nResult...\n", C.chebvander(x, 2))
ตัวอย่างโค้ดสมบูรณ์
import numpy as np
from numpy.polynomial import chebyshev as C
x = np.array([0, 1, -1, 2])
print("Our Array...\n", x)
print("\nDimensions of our Array...\n", x.ndim)
print("\nDatatype of our Array object...\n", x.dtype)
print("\nShape of our Array object...\n", x.shape)
print("\nResult...\n", C.chebvander(x, 2))
ผลลัพธ์
Our Array... [ 0 1 -1 2] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (4,) Result... [[ 1. 0. -1.] [ 1. 1. 1.] [ 1. -1. 1.] [ 1. 2. 7.]]