บทนำ
เมธอด chebyshev.chebval() กับ tensor=True ประเมินอนุกรม Chebyshev ที่จุด x โดยขยายรูปร่างสัมประสิทธิ์หลายมิติ
พารามิเตอร์ tensor=True
ขยายรูปร่าง c ด้วย 1 ด้านขวาสำหรับแต่ละมิติของ x ทำให้ทุกคอลัมน์ของ c ถูกประเมินสำหรับทุกองค์ประกอบของ x
ตัวอย่าง: สัมประสิทธิ์ 2 มิติ
import numpy as np
from numpy.polynomial import chebyshev as C
c = np.arange(4).reshape(2, 2)
print("Our Array...\n", c)
print("\nDimensions of our Array...\n", c.ndim)
print("\nDatatype of our Array object...\n", c.dtype)
print("\nShape of our Array object...\n", c.shape)
print("\nResult (chebval)...\n", C.chebval([1, 2], c, tensor=True))
ผลลัพธ์
Our Array... [[0 1]
[2 3]]
Dimensions of our Array... 2
Datatype of our Array object... int64
Shape of our Array object... (2, 2)
Result (chebval)... [[2. 4.]
[4. 7.]]
x = [1, 2] มี 2 จุด c มี 2 คอลัมน์ → ผลลัพธ์ 2x2 เมทริกซ์