Generating a list of values

For a simple example let´s say we have 0.000, 3.409, 3.353, 3.297, 3.239, etc. What I want to do is take this list and replace it with a one where the first item remains the same, in this case 3.409, the second becomes 3.409+3.353, the third becomes 3.409+3.353+3.297, the forth 3.409+3.353+3.297+3.239, etc…
How can I do this in grasshopper?

Yes!!! Thank you Seghier!

It might be a simpler method to use the “Partial Results” output values.

3 Likes

4 Likes

I got it wrong. What I actually need is the following. Let’s say we have an equation x+y=z, then for the next step z=x1, we have to get the second item to be equal to x1+y1=z1, then the next step z1=x2 and we plug it into x2+y2=z2 and so on. More or less like this: 1+2=3, 3+2=5, 5+4=9, 9+2=11. We have the y values already in a list and we need to generate the x values, where every next x is the result of the previous step.

How you generate x values if you have y values only?
Where is the first number of x values?
x0+y0=z0
z0+y1=z1
z1+y2=z2

Give it any starting value.

use method of HS_Kim and add the starting value x0

Here is the actual problem.

Problem.gh (10.5 KB)

The equation is Sqrt(2*(x+y*z)). We have a starting value for X = 0 and a list for Y and another one for Z. We must take the result from the first calculation and plug it back in toast a second X, then get the result and plug it back in as a third X and so on until the values for Y and Z end.

and where is y list?

Problem1.gh (11.3 KB)

what you need is not clear , you said : x+y=z, then for the next step z=x1, we have to get the second item to be equal to x1+y1=z
but in your definition you already have y values and x values

I need the value for X, initially 0, to change for every next calculation. Take the first values for X Y and Z, get result. Use the result as new X and the second items in the Y and Z lists for the second calculation, Get result, use it as a third X along with the third values from the lists for Y and Z and so on.

ok that totally different from your previous post because it is not just x+y=z

Yeah and it seems also I gave you the wrong equation. Here is the correct version of it all.

Problem_Correct.gh (15.1 KB)

It seems I have to iterate the equation or something. Have no idea how to do that in grasshopper

i have a solution but i wait maybe someone give you a simple one
if no one help i will post it

I have one too… plug it all manually and I did it, but this is not neat. A big mess of wires. Works, but if the lists change numbers then there is a problem :smiley: I really hope there is a better way.

create it manually is not a solution, i use loop

I think thatis the only solution

My GIF was meant to be a joke, which seemed appropriate, I apologize if you read it any other way!