You need to sum‘l’ (lower case‘L’). Then it works.
Doing that, I got your professor’s answer for‘sin(x)’ but not for‘x^2’. I suspect that with your same code giving the correct answer for one and the incorrect answer for the other, one of your professor’s answers is incorrect.
Best Answer