পাইথনে legendre.legroots() মেথড ব্যবহার করে লেজ্যান্ড্র সিরিজের রুট গণনা করা যায়। এটি সিরিজের রুটসহ অ্যারে রিটার্ন করে। সব রুট রিয়াল হলে আউটপুট রিয়াল, অন্যথায় কমপ্লেক্স।
প্যারামিটার
c: কোএফিশিয়েন্টের ১-D অ্যারে।
ধাপসমূহ
১. লাইব্রেরি ইম্পোর্ট
from numpy.polynomial import legendre as L
২. লেজ্যান্ড্র সিরিজের রুট গণনা করুন
print("Result...\n", L.legroots((0, 1, 2)))
৩. ডাটা টাইপ পান
print("\nType...\n", L.legroots((0, 1, 2)).dtype)
৪. শেপ পান
print("\nShape...\n", L.legroots((0, 1, 2)).shape)
সম্পূর্ণ উদাহরণ
from numpy.polynomial import legendre as L
print("Result...\n", L.legroots((0, 1, 2)))
print("\nType...\n", L.legroots((0, 1, 2)).dtype)
print("\nShape...\n", L.legroots((0, 1, 2)).shape)
আউটপুট
Result... [-0.76759188 0.43425855]
Type... float64
Shape... (2,)