Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> Python

Lũy thừa chuỗi Hermite_e trong Python

Giới thiệu

hermite_e.hermepow() lũy thừa chuỗi Hermite_e lên số nguyên pow. Trả về hệ số chuỗi Hermite_e của kết quả. Tham số maxpower (mặc định 16) giới hạn bậc tối đa.

Ví dụ: c^3

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

c = np.array([1, 2, 3])  # He_0 + 2He_1 + 3He_2
print("Hệ số:", c)
print("Số chiều:", c.ndim)
print("Kiểu dữ liệu:", c.dtype)
print("Hình dạng:", c.shape)

# Lũy thừa 3
result = H.hermepow(c, 3)
print("\nKết quả c^3:", result)
print("Bậc:", len(result)-1)

Kết quả

Hệ số: [1 2 3]
Số chiều: 1
Kiểu dữ liệu: int64
Hình dạng: (3,)

Kết quả c^3: [ 355.  642. 1119.  476.  387.   54.   27.]

Lưu ý

  • Bậc kết quả = 3 * 2 = 6 → 7 hệ số.
  • Hermite_e (probabilist's) khác Hermite (physicist's) về hệ số chuẩn hóa.
  • maxpower=16 nghĩa là nếu pow làm bậc > 16 sẽ bị giới hạn.