Student Support Forum: 'Expanding a Product in Mathematica' topicStudent Support Forum > General > "Expanding a Product in Mathematica"

 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic
 Author Comment/Response Peter Pein 10/23/09 10:23am almost straightforward: In[1]:= data = {{1, 5}, {2, 24}, {3, 63}, {4, 140}, {5, 265}, {6, 450}}; In[2]:= poly = Sum[data[[i,2]]*Product[ Piecewise[{{(x - data[[j,1]])/ (data[[i,1]] - data[[j,1]]), i != j}}, 1], {j, Length[data]}], {i, Length[data]}] Out[6]= (1/24)*(2 - x)*(3 - x)*(4 - x)*(5 - x)* (6 - x) + (3 - x)*(4 - x)*(5 - x)* (6 - x)*(-1 + x) + (21/4)*(4 - x)* (5 - x)*(6 - x)*(-2 + x)*(-1 + x) + (35/3)*(5 - x)*(6 - x)*(-3 + x)* (-2 + x)*(-1 + x) + (265/24)*(6 - x)* (-4 + x)*(-3 + x)*(-2 + x)*(-1 + x) + (15/4)*(-5 + x)*(-4 + x)*(-3 + x)* (-2 + x)*(-1 + x) Test: In[3]:= Simplify[poly - InterpolatingPolynomial[ data, x]] Out[3]= 0 URL: ,

 Subject (listing for 'Expanding a Product in Mathematica') Author Date Posted Expanding a Product in Mathematica jc_cfa 10/19/09 01:25am Re: Expanding a Product in Mathematica Peter Pein 10/23/09 10:23am Re: Expanding a Product in Mathematica jc_cfa 10/23/09 8:19pm
 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic