| Original Message (ID '138255') By Bill Simpson: |
| In Response To 'Re: Lagrange polynomial'
---------
Somehow in the scrape-n-paste a "{" was lost.
Trying one more time, and put parts of this on separate lines to perhaps make it easier to understand:
In[1]:= p[points_]:=Sum[
Product[If[i==j,1,x-points[[i,1]]],{i,1,Length[points]}]
/
Product[If[i==j,1,points[[i,1]]-points[[j,1]]],{i,1,Length[points]}]
*
points[[j,2]
],
{j,1,Length[points]}];
poly=p[{{1,1},{2,4},{3,2}}]
Out[2]= ((-3+x)*(-2+x))/2 - 4*(-3+x)*(-1+x) + (-2+x)*(-1+x) |
|