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

หาอนุพันธ์ของอนุกรมเฮอร์ไมท์และคูณสเกลาร์ใน Python

ใช้ hermder() กับพารามิเตอร์ scl=-1 เพื่อคูณ -1 ในแต่ละการหาอนุพันธ์

ขั้นตอน

import numpy as np
from numpy.polynomial import hermite as H

c = np.array([1, 2, 3, 4])
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", H.hermder(c, scl=-1))

ตัวอย่างโค้ดสมบูรณ์

import numpy as np
from numpy.polynomial import hermite as H

c = np.array([1, 2, 3, 4])
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", H.hermder(c, scl=-1))

ผลลัพธ์

Our Array...   [1 2 3 4]
Dimensions of our Array... 1
Datatype of our Array object... int64
Shape of our Array object... (4,)
Result...   [ -4. -12. -24.]