Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

ประเมินอนุกรม Chebyshev 2 มิติ ที่จุด (x, y) สัมประสิทธิ์ 3D ใน Python

บทนำ

เมธอด chebyshev.chebval2d() ประเมินอนุกรม Chebyshev 2 มิติ ที่จุด (x, y) โดยใช้สัมประสิทธิ์ 3 มิติ (หลายชุดของสัมประสิทธิ์ 2 มิติ)

พารามิเตอร์

  • x, y: จุดที่ประเมิน ต้องมีรูปร่างเดียวกัน
  • c: สัมประสิทธิ์ c[i,j] สำหรับมัลติดีกรี i,j หาก c มีมิติ > 2 ดัชนีที่เหลือเป็นชุดสัมประสิทธิ์หลายชุด

ตัวอย่าง: สัมประสิทธิ์ 3 มิติ (2,2,6)

import numpy as np
from numpy.polynomial import chebyshev as C

c = np.arange(24).reshape(2, 2, 6)
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...\n", C.chebval2d([1, 2], [1, 2], c))

ผลลัพธ์

Our Array... [[[ 0  1  2  3  4  5]
   [ 6  7  8  9 10 11]]
  [[12 13 14 15 16 17]
   [18 19 20 21 22 23]]]
Dimensions of our Array... 3
Datatype of our Array object... int64
Shape of our Array object... (2, 2, 6)
Result... [[ 36. 108.]
 [ 40. 117.]
 [ 44. 126.]
 [ 48. 135.]
 [ 52. 144.]
 [ 56. 153.]]

สัมประสิทธิ์ 3 มิติ (2,2,6) ให้ 6 ชุดของสัมประสิทธิ์ 2 มิติ ผลลัพธ์ 6 แถว × 2 คอลัมน์