Here is a list:
x2={1539.91, 5.05, -2.82, 0, 19, 135.93, 117.78, 11.61, 8.17, 13.76,
1.5, 36.75, 137.77, -16.18, 4.18, -2.82, 0, 18.42, 53.19, 5.91,
-16.18, 3.24, -2.82, 0, 53.19, 518.6, -16.18, 1.61, -2.82, 23, 0,
70.92, 58.89, 13.08, 42.32, 57.67, -15.32, 1.76, -2.68, 18.42, 0,
53.19, 6.33, -15.32, 2.01, -2.68, 0, 53.19, -15.32, 2.17, -2.68, 0,
-1000, 76.83, 27.18, 0.02, 8.88, 13.08, 30, 48.72, 16.02, -15.32,
1.69, -2.68, 0, 0.7, 53.19, 1128.85, 11.49, 53.19, 16.61, 209.84,
1243.2, 23, 1.08}
I want to create a new list called balancelist
using a recursive function (or any other way so I learn) such that I end up with a list with something like this:
{1539.91,1539.91-5.05,1539.91-5.05-(-2.82),......}
I have tried the following code but it doesn't work:
balancefinal = {}
For[i = 1, i <= Length[x2], i++, x2[[i]] - x2[[i + 1]];
Append[balancefinal]]