I want to generate the Lagrange basis polynomials for a set of points where T is the set of points and n is the amount of given points. What I did is ci = [lambda t: np.prod([(t - T[j]) / (T[i] - T[j]) for j in range(n) if j != i] for i in range(n)]
, however, the resulting lambdas are all the same.
I checked by printing [c(val) for c in ci]
in the console for several different values and it all returns the same value. How is this possible, when clearly the formula I put in should return lambdas with a different structure for each i?