I have to implement this algorithm in Mathematica:
My problem is that I don't really understand the Mathematica syntax because there aren't a lot of useful examples out there. What I have done:
(* Input: 4 Points*)
Array[sx, 4, 0];
Array[sy, 4, 0];
sx[0] = -1;
sy[0] = 0;
sx[1] = 0;
sy[1] = 2;
sx[2] = 1;
sy[2] = 4;
sx[3] = 3;
sy[3] = 32;
P[x,0]:=sy[0];
P[x, k_] :=
P[x, k - 1] + (sy[k] - P[sx[k], k - 1])*
Sum[(x - sx[j])/sx[k] - sx[j], {j, 0, x}];
(I tried to implement the geometric mean but I failed because I can't even calculate the Sum.)
How can I implement the recursion correctly? (an the geometric mean)