Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Lagrange polynomial' topicStudent Support Forum > General > "Lagrange polynomial"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
11/21/12 00:10am

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)

URL: ,

Subject (listing for 'Lagrange polynomial')
Author Date Posted
Lagrange polynomial Mark Dymek 11/19/12 2:07pm
Re: Lagrange polynomial Bill Simpson 11/20/12 7:03pm
Re: Re: Lagrange polynomial Bill Simpson 11/21/12 00:10am
Re: Lagrange polynomial [requested rewording] Mark Dymek 11/22/12 1:58pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic