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