เพื่อประเมินอนุกรมเชบิเชฟ (Chebyshev series) 2 มิติ บนผลคูณการ์ทีเซียนของ x และ y ให้ใช้ polynomial.chebgrid2d(x, y, c) เมธอดนี้คืนค่าอนุกรมเชบิเชฟ 2 มิติ ณ จุดในผลคูณการ์ทีเซียน
พารามิเตอร์
- x, y: จุดประเมิน 2 มิติ แปลงเป็น ndarray หากเป็นลิสต์/ทูเพิล มิฉะนั้นถือเป็นสเกลาร์
- c: อาร์เรย์係ส เรียงทำให้係สพจน์ i,j อยู่ใน
c[i,j]หากมิติ > 2 ดัชนีเหลือเป็นชุด係สหลายชุด หาก < 2 มิติ เพิ่มมิติ 1 อัตโนมัติ รูปทรงผลลัพธ์:c.shape[2:] + x.shape + y.shape
ขั้นตอนตัวอย่าง
import numpy as np
from numpy.polynomial import chebyshev as C
# สร้างอาร์เรย์係ส 2 มิติ
c = np.arange(4).reshape(2, 2)
print("อาร์เรย์ของเรา...\n", c)
print("\nมิติ...\n", c.ndim)
print("\nชนิดข้อมูล...\n", c.dtype)
print("\nรูปทรง...\n", c.shape)
# ประเมินอนุกรมเชบิเชฟ
print("\nผลลัพธ์...\n", C.chebgrid2d([1, 2], [1, 2], c))
โค้ดเต็มและผลลัพธ์
import numpy as np
from numpy.polynomial import chebyshev as C
c = np.arange(4).reshape(2, 2)
print("อาร์เรย์ของเรา...\n", c)
print("\nมิติ...\n", c.ndim)
print("\nชนิดข้อมูล...\n", c.dtype)
print("\nรูปทรง...\n", c.shape)
print("\nผลลัพธ์...\n", C.chebgrid2d([1, 2], [1, 2], c))
อาร์เรย์ของเรา...
[[0 1]
[2 3]]
มิติ...
2
ชนิดข้อมูล...
int64
รูปทรง...
(2, 2)
ผลลัพธ์...
[[ 6. 10.]
[11. 18.]]