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