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

หาอนุพันธ์อนุกรม Legendre ด้วยสัมประสิทธิ์หลายมิติใน Python

บทนำ

เมธอด legendre.legder() รองรับการหาอนุพันธ์ของอนุกรม Legendre ที่มีสัมประสิทธิ์หลายมิติ

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

import numpy as np
from numpy.polynomial import legendre as L

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...\n", L.legder(c))

ผลลัพธ์

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... [[2. 3.]]

อาร์เรย์ 2x2 แทนอนุกรมสองตัวแปร อนุพันธ์ตาม axis=0 (ค่าเริ่มต้น) ให้ผลลัพธ์ 1x2