Is this a correct way to write the summation?

I have values such as 2,4, 7, 10 , that is not sequential but are stored in array w. Can I use the summation $${\sum_{i = 1}^{n} w[i]}$$

or there is another way to write it down ?

-
That is OK. Perhaps mathematicians would often prefer $$\sum_{i=1}^n w_i$$ instead of the brackets. – GEdgar Aug 7 '12 at 11:57
As long as you define the notation $w[i]$, you should be fine. – J. M. Aug 7 '12 at 11:57

in programming if we have array $w={1,2,3,4....}$,then we write $w[i]$,in mathematics you can simple write $w_i$