Hi,
I want to calculate delta coefficients in Mathematica. However, I cannot find the optimal way to do it. The mathematical definition can be found there here. If t+n>n then the last element is used. Similarly, for t-n, the first element is used. I tried to compute this by first padding n first elements at the beginning and n last elements at the end and then calculating the deltas from the definition.
delta = Sum[(n-l)*(lst[[t+n]-lst[[t-n]]]),{n,l+1,2l}];
delta = delta/(2*Sum[n^2,{n,1,l}]);
Where lst is the array, l is the length of the array (before padding) and t is the element for which we want to calculate delta. I think, that there should be a better way to do this, nevertheless I cannot find is. Therefore, my question is, how can I improve the computation?