# Q 7A
import numpy as np
from scipy.special import legendre as P
theta = np.pi
n= 2
lhs = np.sin((n+1)*theta)/np.sin(theta)
rhs = sum([np.poly1d(P(l))(np.cos(theta)) * np.poly1d(P(n-l))(np.cos(theta)) for l in range(0, n+1)])
print("LHS = ",lhs)
print("RHS = ",rhs)
print("Difference = ", abs(lhs-rhs))
Comments
Post a Comment