Results 1 to 3 of 3

Math Help - Maple 13. How to find sum of entiries of array via summation operator?

  1. #1
    Newbie
    Joined
    Mar 2010
    Posts
    20

    Question 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?
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Jester's Avatar
    Joined
    Dec 2008
    From
    Conway AR
    Posts
    2,361
    Thanks
    39
    Quote Originally Posted by ICanFly View Post
    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.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Mar 2010
    Posts
    20
    yep. "add' does work. tnx
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. find the k'th smallest in array algorithm
    Posted in the Math Software Forum
    Replies: 1
    Last Post: December 12th 2011, 09:25 AM
  2. Replies: 0
    Last Post: November 30th 2011, 02:25 PM
  3. trying to find roots with Maple
    Posted in the Math Software Forum
    Replies: 1
    Last Post: March 20th 2011, 06:11 PM
  4. curious summation operator problem
    Posted in the Algebra Forum
    Replies: 2
    Last Post: January 26th 2011, 04:24 AM
  5. Replies: 2
    Last Post: March 14th 2010, 08:01 PM

Search Tags


/mathhelpforum @mathhelpforum