Math Sequence/ Loop?

Hello everyone, I am trying to have simple Math equation in GH and then take the result and run the same equation on it. Example:

1+ (item1 on the list/2) = Result1
Result1+ (item2 on the list/2) = Result2
Result2+ (item2 on the list/2) = Result3

and so on about a 1000 times. I think I can use Anemone but I have no experience with it and I’m not understanding the gist of it yet. Can you guys please confirm that Anemone can do this? Where can I find more examples? (the link from website doesn’t work)

You can achieve similar result by using native grasshopper components.


Sarkaharrington.gh (17.3 KB)

1 Like

If you prefer using anemone, here is the definition:


Sarkaharrington.gh (19.1 KB)

1 Like

Is there a component that would do “MassSubstraction”? :slight_smile:

Where did you count in the number one from my definition?

I would like to see how to change it to any other number, e.g. 0. Thank you so much for your response, I am still trying to understand the Anemone script

Since subtraction isn’t commutative, I decided against it. You could do it yourself by formatting the data using hyphens as separators:

1 Like

Thanks David,
that’s clever. Is there a way how to get the partial result as in Mass Addition as well?

Method 1:


Sharky.gh (16.7 KB)

Method 2:


Sharky.gh (15.6 KB)

2 Likes

In that case you could flip the signs of all values except the first and just use Mass Addition.

1 Like

Nice! I need to look into this more. Out of curiosity, how would you do this?

2 * ListItem1 - 0 = Result1
2 * ListItem2 - Result1 = Result2
2 * ListItem3 - Result2 = Result3


Sharky.gh (15.6 KB)

Pufferfish has a Mass Subtraction and Mass Division components.