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

ประเมินค่าอนุกรมลากูร์ร์ 2 มิติ ที่จุด (x,y) ใน Python

เมธอด polynomial.laguerre.lagval2d() ประเมินค่าอนุกรมลากูร์ร์ 2 มิติ ที่จุด (x, y) โดย x และ y ต้องมีรูปร่างเท่ากัน

พารามิเตอร์ c เป็นอาร์เรย์係ณที่ c[i,j] เก็บ係ณของพจน์ multidegree i,j

ขั้นตอน

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

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", L.lagval2d([1, 2], [1, 2], c))

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

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

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", L.lagval2d([1, 2], [1, 2], c))

ผลลัพธ์

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