কম্পিউটার টিউটোরিয়াল

পাইথনে Legendre পলিনোমিয়ালের}Pseudo Vandermonde ম্যাট্রিক্স জেনারেট করা x, y, z কমপ্লেক্স অ্যারে পয়েন্টের সাথে

x, y, z স্যাম্পল পয়েন্টের সাথে Legendre পলিনোমিয়ালের pseudo Vandermonde ম্যাট্রিক্স জেনারেট করতে, পাইথন NumPy-তে legendre.legvander3d() মেথড ব্যবহার করুন। এটি ডিগ্রি deg এবং স্যাম্পল পয়েন্ট (x, y, z)-এর pseudo-Vandermonde ম্যাট্রিক্স রিটার্ন করে।

প্যারামিটার, x, y, z হল পয়েন্ট কোঅর্ডিনেটের অ্যারে, সবগুলো একই শেপের। dtypes float64 বা complex128-এ কনভার্ট হবে কোনো এলিমেন্ট কমপ্লেক্স কিনা তার ওপর ডিপেন্ড করে। স্কেলারগুলো ১-D অ্যারে-এ কনভার্ট হবে। প্যারামিটার, deg হল [x_deg, y_deg, z_deg] ফরমের সর্বোচ্চ ডিগ্রির একটি লিস্ট।

ধাপসমূহ

প্রথমে, প্রয়োজনীয় লাইব্রেরি ইমপোর্ট করুন:

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

numpy.array() মেথড ব্যবহার করে একই শেপের পয়েন্ট কোঅর্ডিনেটের অ্যারে তৈরি করুন:

x = np.array([-2.+2.j, -1.+2.j])
y = np.array([0.+2.j, 1.+2.j])
z = np.array([2.+2.j, 3. + 3.j])

অ্যারে ডিসপ্লে করুন:

print("Array1...\n", x)
print("\nArray2...\n", y)
print("\nArray3...\n", z)

ডেটাটাইপ ডিসপ্লে করুন:

print("\nArray1 datatype...\n", x.dtype)
print("\nArray2 datatype...\n", y.dtype)
print("\nArray3 datatype...\n", z.dtype)

দুই অ্যারের ডাইমেনশন চেক করুন:

print("\nDimensions of Array1...\n", x.ndim)
print("\nDimensions of Array2...\n", y.ndim)
print("\nDimensions of Array3...\n", z.ndim)

দুই অ্যারের শেপ চেক করুন:

print("\nShape of Array1...\n", x.shape)
print("\nShape of Array2...\n", y.shape)
print("\nShape of Array3...\n", z.shape)

x, y, z স্যাম্পল পয়েন্টের সাথে Legendre পলিনোমিয়ালের pseudo Vandermonde ম্যাট্রিক্স জেনারেট করতে, পাইথন NumPy-তে legendre.legvander3d() মেথড ব্যবহার করুন:

x_deg, y_deg, z_deg = 2, 3, 4
print("\nResult...\n", L.legvander3d(x, y, z, [x_deg, y_deg, z_deg]))

উদাহরণ

import numpy as np
from numpy.polynomial import legendre as L
# Create arrays of point coordinates, all of the same shape using the numpy.array() method
x = np.array([-2.+2.j, -1.+2.j])
y = np.array([0.+2.j, 1.+2.j])
z = np.array([2.+2.j, 3. + 3.j])
# Display the arrays
print("Array1...\n", x)
print("\nArray2...\n", y)
print("\nArray3...\n", z)
# Display the datatype
print("\nArray1 datatype...\n", x.dtype)
print("\nArray2 datatype...\n", y.dtype)
print("\nArray3 datatype...\n", z.dtype)
# Check the Dimensions of both the arrays
print("\nDimensions of Array1...\n", x.ndim)
print("\nDimensions of Array2...\n", y.ndim)
print("\nDimensions of Array3...\n", z.ndim)
# Check the Shape of both the arrays
print("\nShape of Array1...\n", x.shape)
print("\nShape of Array2...\n", y.shape)
print("\nShape of Array3...\n", z.shape)
# To generate a pseudo Vandermonde matrix of the Legendre polynomial with x, y, z sample points, use the legendre.legvander3d() method in Python Numpy
x_deg, y_deg, z_deg = 2, 3, 4
print("\nResult...\n", L.legvander3d(x, y, z, [x_deg, y_deg, z_deg]))

আউটপুট

Array1...   [-2.+2.j -1.+2.j]
Array2...   [0.+2.j 1.+2.j]
Array3...   [2.+2.j 3.+3.j]
Array1 datatype... complex128
Array2 datatype... complex128
Array3 datatype... complex128
Dimensions of Array1... 1
Dimensions of Array2... 1
Dimensions of Array3... 1
Shape of Array1... (2,)
Shape of Array2... (2,)
Shape of Array3... (2,)
Result...   [[ 1.00000000e+00 +0.0000000e+00j  2.00000000e+00 +2.0000000e+00j   ... (বহুল ডেটা) ...]]
  1. পাইথনে চেবিশেভ পলিনোমিয়ালের छদ্ম ভ্যান্ডারমন্ড ম্যাট্রিক্স এবং x, y, z স্যাম্পল পয়েন্ট বের করুন

  2. পাইথনে Hermite পলিনোমিয়াল এবং x, y, z ফ্লোটিং পয়েন্ট অ্যারএর পসিডো ভান্ডারমন্ড ম্যাট্রিক্স জেনারেট করা

  3. পাইথনে Chebyshev পলিনোমিয়াল এবং x, y, z ফ্লোটিং পয়েন্ট অ্যারএর পসিডো ভান্ডারমন্ড ম্যাট্রিক্স জেনারেট করা

  4. পাইথনে হার্মাইট পলিনোমিয়াল এবং x, y, z জটিল পয়েন্টের সিউডো ভ্যান্ডারমন্ড ম্যাট্রিক্স জেনারেট করুন