Generating a list of values


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


(David S. Mavrov) #7

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.

(Seghier khaled) #8

How you generate x values if you have y values only?
Where is the first number of x values?

(David S. Mavrov) #9

Give it any starting value.

(Seghier khaled) #10

use method of HS_Kim and add the starting value x0

(David S. Mavrov) #11

Here is the actual problem. (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.

(Seghier khaled) #12

and where is y list?

(David S. Mavrov) #13 (11.3 KB)

(Seghier khaled) #14

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

(David S. Mavrov) #15

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.

(Seghier khaled) #16

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

(David S. Mavrov) #17

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

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

(Seghier khaled) #18

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

(David S. Mavrov) #19

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.

(Seghier khaled) #20

create it manually is not a solution, i use loop

(David S. Mavrov) #21

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!

(Seghier khaled) #23 (19.1 KB)

(David S. Mavrov) #24

Thank you Seghier! I have never worked with loops in grasshopper. I will play with this quite a bit. Again thank you and sorry for the messy input :slight_smile: