# Sum problem!

• May 1st 2005, 09:40 PM
cobra
Sum problem!
Hi all

I have the following problem, i have attached the following equation into a file.

lets suppused i have the following vector :

A={10,20,50,60,70,49,21,23}

how i solve the equation (my main problem is how to threat the double sum function with diffrent indexies i.e. i,j) ?

Best Regreats
• May 4th 2005, 05:39 AM
cobra
any one ?
Can any one help me please (it's very urget)?
• May 4th 2005, 09:50 AM
hpe
Quote:

Originally Posted by cobra
Can any one help me please (it's very urget)?

This is the same as ((sum of all Ai) squared) minus (sum of (Ai squared)) (note the parentheses!).
• May 4th 2005, 09:45 PM
cobra
OKI thank you, but what if i have minus i.e.:

sum(sum(Ai-Aj)

The first sum is from 0:N (N-vector length)

The secound sum is from 0:N (without when i=j)

Best Regretes,

Dvir
• May 5th 2005, 09:26 AM
hpe
Quote:

Originally Posted by cobra
sum(sum(Ai-Aj)

The first sum is from 0:N (N-vector length)

The second sum is from 0:N (without when i=j)

I assume the outer sum is over i and the inner over j (not =i).
Write sum'_j to indicate that the sum is over j, but skips the term j=i.
There are n+1 terms in sum_i and n terms in sum'_j.

Let A = sum_i Ai = sum_j Aj. Thus sum'_j Aj = A - Ai. Then

sum_i(sum'_j(Ai-Aj))
= sum_i(nAi - sum'_j Aj)
= sum_i(nAi - (A-Ai))
= sum_i((n+1)Ai - A)
= (n+1)sum_i (Ai) - (n+1)A
= 0.
• May 5th 2005, 09:48 PM
cobra
Thanks u All.

So the answer is in this case is always zero.

Again thanks u for your fast and helpful assistent.