title: How to calculate a sumatory of a series?
body: <p>I'm trying to calculate the sumatory of a series and I don't know what is my mistake because I don't get the right result.  The sumatory that I have to calculate is this</p>
  
  <p><a href="https://i.stack.imgur.com/MvYIY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MvYIY.png" alt="enter image description here"></a></p>
  
  <p>Here, Z(n,i) is a numeric vector ordered from the samllest to the greatest.</p>
  
  <p>What I have done is this</p>
  
  <pre><code>wi&lt;-c()
  wi[1]=1/(1/n^2) #n is n&lt;-length(Z) where Z is the numeric vector of data
  for(i in 1:n){
     for(j in 2:i){
         wi[i]=w[i-1]+1/(1(n-j+1)^2)
     }
  }
  </code></pre>
  
  <p>Is there another way to set this sum without calculating the first term before the for loop?
  Is this sum correctly defined?</p>
  
  <p>Thanks for your help.</p>