My pervious solution was to create a function rather than use a brute
force ascending summation. The solution depended on the input numbers
having a relationship to one another. If you give this function an
unordered list it will not generate the output you expect (as you
probably found out). Unfortunately the brute force method (there is
some room for optimization) is required for an unordered set and this
in turn requires internal or external iteration (looping). GH dose not
yet have looping so I’m afraid you have to wait if you want to use it.

Anyhow the optimization (once it is possible) would be:

f0 = a
f1 = f0 + a
f2 = f1 + b
f3 = f2 + c
....

There may be even more elegant algorithms for doing this (I’m not a CS
major).

- Dieter

On Aug 27, 7:22 am, GC <[EMAIL PROTECTED]> wrote:
> Hi Dieter,
>
> Sorry but i seem not to get this I have been smashing my head on this.
>
> my list is not integer but double and it reads something like this
>
> 1.9
> 6.7
> 2.8
> 4.4
>
> i need my function to add one to the previous
> so as to read
>
> 1.9
> 8.6
> 11.4
> 15.8
>
> f1= a+b
> f2= a+b+c
> f3= a+b+c+d
>
> and so on... sorry for this math question i am the most un-experienced
> coder in the group.
>
> thanks again, i am almost there
>
> On Aug 26, 5:11 pm, GC <[EMAIL PROTECTED]> wrote:
>
>
>
> > thank! i was beginning to think it was a simple math problem, not my
> > strength i must say.
>
> > On Aug 26, 11:13 am, Dieter Toews <[EMAIL PROTECTED]> wrote:
>
> > > what you've got yourself is mostly a math problem & not so much a GH
> > > problem
>
> > > If x = 1, 2, 3, 4, 5, 6, ...
> > > & F(x_n) = 1, 3, 6, 10, 15, 21, ...
>
> > > Then
>
> > > F(x_0) = 1 * x
> > > F(x_1) = 1.5 * x
> > > F(x_2) = 2 * x
> > > ect...
>
> > > or F(x) = ((X+1)/2)*X
>
> > >http://groups.google.com/group/grasshopper3d/web/Number%20Series%20Ex...
>
> > >http://groups.google.com/group/grasshopper3d/web/Number%20Series%20Ex...
>
> > > Cheers, Dieter Toews
>
> > > On Aug 25, 10:28 pm, GC <[EMAIL PROTECTED]> wrote:
>
> > > > Hi all,
>
> > > > I am fairly new to the this group and have been mining it thus far,
> > > > very exciting!
>
> > > > I have a simple question, I have a list of values, and I want to add
> > > > the values in the list to themselves for example
>
> > > > set 1:
> > > > 1
> > > > 2
> > > > 3
> > > > 4
> > > > 5
> > > > 6
>
> > > > what it to be:
> > > > 1
> > > > 3
> > > > 6
> > > > 10
> > > > 15
> > > > 21
>
> > > > in other words it would add all the values to itself as it rips
> > > > through the list incrementally.
> > > > any help is greatly appreciated...- Hide quoted text -
>
> - Show quoted text -

Reply via email to