cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

3-Visitor

## how do I sum all elements of an array?

I need to sum all elements of an array.  Is there a function that does this?

6 REPLIES 6
21-Topaz I
(To:DJV)

Hi,

Yes there is a function.  It is on the ribbon at Maths | Operators And Symbols | Operators | Calculus.

Cheers Terry

21-Topaz I
(To:terryhendicott)

Hi,

This for an "array" rather than just a "vector"

24-Ruby V
(To:DJV)

The summation symbol Terry pointed you to only works with column and row vectors (matrices with either just one column or just one row).

In case you are looking for the sum of all elements of an arbitrary matrix, here are two shorter routines which do the job:

And here is a way to sum up recursively all scalars even in multiple nested matrices (for whatever that may be worth).

Worksheet in format P5 attached

17-Peridot
(To:DJV)

You could also do the following for matrices (though not nested matrices):

Alan

23-Emerald III
(To:DJV)

Or, to be independent of ORIGIN and of the size of the array/Matrix:

Success!
Luc

Prime 3.1 file attached

24-Ruby V
(To:DJV)

OK, here sure are many ways to skin a cat.

Even though DJV doesn't show any interest, here are two more ways to achieve the desired result.

Personally I still would prefer my first one, "SumAll1". It also seems to be the fastest, followed by the recursive "SumAll3".

Worksheet in Format P5 attached.

Announcements
Top Tags