Is it possible to do math on list values while referring to the previously calculated item in the list (using value at index i-1 in other words)

I’m looking for a way to do maths on a list of number and it’s kind of like a geometric progression. Each value in the list needs to take the previous value in the list and be multiplied by a (randomly changing) factor.

The Calculate List can’t do it from what I can tell. Referring to the current index value in list processing is of no use if I cannot access value at index [i-1].

I wish this was simple to execute in Vuo. I’ve tried a bunch of Cycle Trough List overly-complicated things with holding values etc and no joy.

Conceptually it’s a piece of cake, executing in Vuo for me, it’s anything but!

Eg.
input list {1, 1, 1, 1, 1, 1, 1, 1, 1, 1} (ten 1s)
value list[I] = value list[I-1] * random-value [0.9, 1.1] (where previously calculated values are carried over to the next calculation, maybe I need to make my own enqueue loop that holds over the previous item in the list’s already calculated value?)

output list {1.07, 1.06, 1.19, 1.33, 1.34, 1.33, 1.50, 1.67, 1.59, 1.49}

Screenshot 2023-02-18 at 12.31.34 pm.png

Hi,

I’m looking for a way to do maths on a list of number and it’s kind of like a geometric progression. Each value in the list needs to take the previous value in the list and be multiplied by a (randomly changing) factor.

I’m not following how your description matches your example. If each row after the first is based on a product of the previous row’s calculated value, what does the column of initial values all set to 1 represent? I’m probably not understanding what you’re looking for, so let me step through your example and you tell me where I’m going wrong.

  • The first row’s output is the result of 1 * 0.93. So far so good.
  • Second row’s output would be 0.93 * 1.08, which is 1.0044
  • Third row’s output would be 1.0044 * 1.27 = 1.2755

Here’s a little video showing what the table should look like based on my understanding of what you’re asking for.

Also attached is a sample Vuo comp that implements my interpretation of what you’re asking for.

Hope this helps!  

accum.vuo (3.83 KB)

1 Like

Hi there.

Sorry if that was confusing about the initial value. The initial values are discarded. Thanks for the suggestions.

I just pre-populated a list as as to get it the correct length to use with the Process List node. Then I tried to do it with the Cycle Through List node.

Ended up back with old fave the Enqueue node, which of course doesn’t require any pre-made list.

This is what I was after. It’s one way to skin the cat anyhow.

Hope this helps me or someone else in the future when novicing their way back through these WTAF stages of learning how to jam with data in Vuo.

EDIT> I just added the only sub-composition. its very small and all it does is stops the events flowing into the enqueue chains to save CPUs.

 

population using static flow rates for births deaths and immigration with successful event flow stopping on complete.vuo (17.5 KB)

ud.lst.listIsFull.vuo (1.56 KB)

My next challenge is to go from static rates of change to dynamic rates of change (accelerate/deceleration/random-wobble) based on preceding values.

I had to use a single Hold node here for the Population value because it’s used for the Births, Deaths, Net-Immigration calcs.

Not sure, maybe I’ll need to hold more of these, or maybe I can just use curves/waves to modulate the Rates.