title: Table and Sum function in Mathematica
body: <p>I have a very simple question. I don't use Mathematica very often and I got stuck with one task. I need to compute this task:</p>
  
  <pre><code>T=5;
  y (* it represents 54 numbers*);  
  h = 2;
  c (*starting at 3, see below*);   
  
  
  
  Table[Sum[(y[[i]]*((i - c)/h)*((i - c)/h)), {i, T}]/
        Sum[((i - c)/h)*((i - c)/h), {i, T}], {c, 3, 54, 2}]
  </code></pre>
  
  <p>I need to compute the "sum…/sum…" 26 times, where "c" starts at 3 and in another step it is (3+2)-> 5 and so on (e.g. 2 steps). I managed to implement this task with Table function. </p>
  
  <p>The problem is, that I also need the "i" to go from 1 to 54, but in one step it should compute just 5 numbers: 1st computing i=1,2,3,4,5 ; 2nd computing i=3,4,5,6,7 and so on. In the sum function I implemented T as 5, so in first step everything is ok, but I have no idea how to create the loop where "i" overlaps like that. I hope that someone will understand my "great" explanation.</p>