Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Adding numbers in List

0 views
Skip to first unread message

Bob Reynolds

unread,
Jan 19, 1996, 3:00:00 AM1/19/96
to
Adriaan.v...@nl.cis.philips.com (Adriaan van der Ende) wrote:
>Hi,
>It must have been asked before , but
>How can get a sum of number in a list,
>I tried it with permutations but it was not
>that what I wanted.
Adriaan,
There are a couple of ways to do it, one much easier than the other.

The hard way:

If you know the maximum number of elements in the list, build a series
of summing statements...

L1+L2+L3+...+Ln (n=max)
L1+L2+L3+...+L(n-1)
L1+L2+L3+...+L(n-2)
and so on until
L1+L2

Test for the number of elements and use the appropriate statement.

The easy way:

Get the Formula1 Toolkit which has the ability to sum the numbers in a
list.

---------------------

I've done both. The second method is a LOT quicker :)

-- Bob


Gene N Stuckey

unread,
Jan 19, 1996, 3:00:00 AM1/19/96
to
Hi,

Notes Release 4 has an @Sum function.

Adriaan van der Ende

unread,
Jan 19, 1996, 3:00:00 AM1/19/96
to

Chris Fales

unread,
Jan 20, 1996, 3:00:00 AM1/20/96
to

Check out;
http://www.turnpike.net/metro/kyee/NotesFAQ.html

Chris
--------------------------------------------------------------------------
csf...@undergrad.math.uwaterloo.ca
Chris_Fales%C...@NotesGW.CompuServe.com

Wilfredo Lorenzo

unread,
Jan 22, 1996, 3:00:00 AM1/22/96
to
Adriaan.v...@nl.cis.philips.com (Adriaan van der Ende) wrote:

Here's my @Sum formula. Here are the limits:
The maximum number of numbers a single field will hold is 8111.
The maximum number of numbers @Sum will add is 8154 (achieved by
joining two list fields).
The R4 @Sum function has the same limits.

Place your number list in a variable called values.


f := @Power(2; @Integer(@Log(@Elements(values)) / @Log(2)));
adjust := @Elements(values) - f;
list := @If(adjust = 0; values; (@Subset(values; adjust) +
@Subset(values; -adjust)) : @Subset(@Subset(values; f); adjust - f));
@If(f > 1; @Set("f"; f / 2) + @Set("list"; @Subset(list; f) +
@Subset(list; -f)) ; "" );
@If(f > 1; @Set("f"; f / 2) + @Set("list"; @Subset(list; f) +
@Subset(list; -f)) ; "" );
@If(f > 1; @Set("f"; f / 2) + @Set("list"; @Subset(list; f) +
@Subset(list; -f)) ; "" );
@If(f > 1; @Set("f"; f / 2) + @Set("list"; @Subset(list; f) +
@Subset(list; -f)) ; "" );
@If(f > 1; @Set("f"; f / 2) + @Set("list"; @Subset(list; f) +
@Subset(list; -f)) ; "" );
@If(f > 1; @Set("f"; f / 2) + @Set("list"; @Subset(list; f) +
@Subset(list; -f)) ; "" );
@If(f > 1; @Set("f"; f / 2) + @Set("list"; @Subset(list; f) +
@Subset(list; -f)) ; "" );
@If(f > 1; @Set("f"; f / 2) + @Set("list"; @Subset(list; f) +
@Subset(list; -f)) ; "" );
@If(f > 1; @Set("f"; f / 2) + @Set("list"; @Subset(list; f) +
@Subset(list; -f)) ; "" );
@If(f > 1; @Set("f"; f / 2) + @Set("list"; @Subset(list; f) +
@Subset(list; -f)) ; "" );
@If(f > 1; @Set("f"; f / 2) + @Set("list"; @Subset(list; f) +
@Subset(list; -f)) ; "" );
@If(f > 1; @Set("f"; f / 2) + @Set("list"; @Subset(list; f) +
@Subset(list; -f)) ; "" );
list

Copyright 1993 MFJ International
This formula is the intellectual property of MFJ International. It
may be used freely as long as this notice is posted with it.


Rothery Nicholas E -BSc Mod Comp

unread,
Jan 25, 1996, 3:00:00 AM1/25/96
to
I am having the exact same problem if you get an answer could you let me know
thanks
N.R


0 new messages