পাইথন নামপাই-এ 2-ডি চেবিশেভ সিরিজকে পয়েন্ট (x, y)-এ মূল্যায়ন করতে polynomial.chebval2d() মেথড ব্যবহার করুন। এই মেথডটি x এবং y-র থেকে জোড়ামিলা মানগুলোর দ্বারা গঠিত পয়েন্টগুলোর ওপর দ্বিমাত্রিক চেবিশেভ সিরিজের মান রিটার্ন করে।
প্যারামিটারস
- x, y: দ্বিমাত্রিক সিরিজটি (x, y) পয়েন্টগুলোর ওপর মূল্যায়ন করা হয়, যেখানে x এবং y-এর একই আকার থাকতে হবে। যদি x বা y লিস্ট বা টাপল হয়, তবে সেটি প্রথমে ndarray-এ রূপান্তরিত হয়, অন্যথায় এটি অপরিবর্তিত থাকে এবং, যদি এটি ndarray না হয়, তবে এটিকে স্ক্যালার হিসেবে বিবেচনা করা হয়।
- c: সহগ Guilford's একটি অ্যারে যাতে multidegree i,j-এর পদটির সহগ c[i,j]-তে থাকে। যদি c-এর মাত্রা ২-এর বেশি হয়, তবে বাকি ইনডেক্সগুলো একাধিক সহগ সেট গণনা করে।
ধাপসমূহ
- প্রয়োজনীয় লাইব্রেরি ইম্পোর্ট করুন:
import numpy as np from numpy.polynomial import chebyshev as C - সহগ Guilford's একটি 3D অ্যারে তৈরি করুন:
c = np.arange(24).reshape(2, 2, 6) - অ্যারেটি প্রদর্শন করুন:
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) polynomial.chebval2d()মেথড ব্যবহার করে 2-ডি চেবিশেভ সিরিজ মূল্যায়ন করুন:print("\nResult...\n", C.chebval2d([1,2], [1,2], c))
সম্পূর্ণ উদাহরণ
import numpy as np
from numpy.polynomial import chebyshev as C
# Create a 3D array of coefficients
c = np.arange(24).reshape(2, 2, 6)
# 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)
# Evaluate 2-D Chebyshev series at points (x, y)
print("\nResult...\n", C.chebval2d([1,2], [1,2], c))
আউটপুট
Our Array... [[[ 0 1 2 3 4 5]
[ 6 7 8 9 10 11]]
[[12 13 14 15 16 17]
[18 19 20 21 22 23]]]
Dimensions of our Array... 3
Datatype of our Array object... int64
Shape of our Array object... (2, 2, 6)
Result... [[ 36. 108.]
[ 40. 117.]
[ 44. 126.]
[ 48. 135.]
[ 52. 144.]
[ 56. 153.]]