# Thread: Maple 13. How to find sum of entiries of array via summation operator?

1. ## Maple 13. How to find sum of entiries of array via summation operator?

I understand i can use loop (like "for..." or something else ) but i want do my program text more readable.
I declare array:
Code:
 A:=Array(1..5,[1,2,3,4,5])
It is OK.Then i trying to get sum of entries of array
Code:
S:=sum(A[i],i=1..5)
This yields error "Error,bad index into Array"
How can i fix it?

2. Originally Posted by ICanFly
I understand i can use loop (like "for..." or something else ) but i want do my program text more readable.
I declare array:
Code:
 A:=Array(1..5,[1,2,3,4,5])
It is OK.Then i trying to get sum of entries of array
Code:
S:=sum(A[i],i=1..5)
This yields error "Error,bad index into Array"
How can i fix it?
Not sure why sum doesn't work but add does.

3. yep. "add' does work. tnx