问题
I am trying to replicate Lagrange Interpolating Polynomials in Mathematica. The wiki for an explanattion of them can be seen here. This is my code (sorry I don't know how to place mathematica code in SO so I have an image):

回答1:
All built-in functions start with a capital letter. So the conditional is If[...]
not if[...]
. Fix that and everything works fine!
With[{k = 5}, Sum[Product[
If[j != m, (x - x[m])/(x[j] - x[m]), 1], {m, 0, k}], {j, 0, k}]]

来源:https://stackoverflow.com/questions/8410379/conditional-product-mathematica