ในการคูณซีรีส์ Legendre c ด้วย x โดยที่ x เป็นตัวแปรอิสระ ให้ใช้วิธี thepolynomial.laguerre.legmulx() ใน Python Numpy วิธีการส่งกลับอาร์เรย์ที่แสดงถึงผลลัพธ์ของการคูณ ส่งกลับค่าส่วนต่างของซีรีส์ Legendre สองชุด c1 - c2 อาร์กิวเมนต์เป็นลำดับของสัมประสิทธิ์ที่เรียงลำดับจากระยะต่ำสุดไปสูงสุด เช่น [1,2,3] แทนชุดข้อมูล P_0 + 2*P_1 + 3*P_2 พารามิเตอร์ c คืออาร์เรย์ 1-D ของสัมประสิทธิ์ซีรีส์ Legendre เรียงจากต่ำไปสูง
ขั้นตอน
ขั้นแรก นำเข้าไลบรารีที่จำเป็น -
import numpy as np from numpy.polynomial import laguerre as L
สร้างอาร์เรย์ -
c = np.array([1, 2, 3])
แสดงอาร์เรย์ -
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) ในการคูณซีรีส์ Legendre c ด้วย x โดยที่ x เป็นตัวแปรอิสระ ให้ใช้เมธอด thepolynomial.laguerre.legmulx() ใน Python Numpy -
print("\nResult....\n",L.legmulx(c)) ตัวอย่าง
import numpy as np
from numpy.polynomial import legendre as L
# Create an array
c = np.array([1, 2, 3])
# Display the array
print("Our Array...\n",c)
# Check the Dimensions
print("\nDimensions of our Array...\n",c.ndim)
# Get the Datatype
print("\nDatatype of our Array object...\n",c.dtype)
# Get the Shape
print("\nShape of our Array object...\n",c.shape)
# To multiply the Legendre series c by x, where x is the independent variable, use the polynomial.laguerre.legmulx() method in Python Numpy
print("\nResult....\n",L.legmulx(c)) ผลลัพธ์
Our Array... [1 2 3] Dimensions of our Array... 1 Datatype of our Array object... int64 Shape of our Array object... (3,) Result.... [0.66666667 2.2 1.33333333 1.8 ]