A simple progressive list - Fibonacci Sequence

So, I'm trying to create a node that generates a simple Fibonacci sequence. I am beginning with a sequence
list (of 1,2, and 3), taking the last two numbers from that list, adding them together, and adding the sum to the previous list to form a new list (1,2,3,5). The node nests inside itself, pulls the new list, reverses it, and takes the last two numbers from the list again, adds them together, and adds the sum to the list. I link the "list length" parameter through.



I am running into problems when I try to either "append" or "make a pair"-- essentially "adding" the latest value to the previous list. Both "append" and "make a pair" seem to crash both Dynamo and Revit when I run them in the Home workspace. I've attached both files and images of each.


Any help would be great!



Nick





Zach,



I see what you mean by a “while” and “for” loop. Very nice.



It’s nice to know each method could be applied to any number of formulas other than the Fibonacci sequence.



Also, I also just realized why the “List” node is required between “Start” and “Append”.


It converts a single digit to a list to make it palatable to “Append” during the first iteration.



Here is a study I did to calculate the Golden Ratio to an Nth level of accuracy based on a Fibonacci List length. Not sure how your out-of-the-box “Pi” node is handled or any other irrational numbers. This sequence tops out around the 40th iteration for the watch node’s visible 14 decimal places.



Cheers!

Ok, Sorry, Got distracted by some other things. Here is a "List Length" based fibonacci sequence.


Sure, this sounds like the difference between a "for" and a "while" loop. I did a while loop, where it does something until a certain condition is met and the number of iterations is unknown, you want a certain number of times the script is executed. So, rather than checking the current state of the loop, we need to set up a counter, and have it increment each time the loop is executed. This is actually a little simpler, let me give it a try

Zack (and friends),


Wow. The definition's elegance is two fold. Not only can both list entities be entered independently (as opposed to in a list format)(it doesn't matter anyway since the fibonacci is by definition imperfect at the beginning, getting ever closer to it's definition through continued iteration), but it bypasses the need to "take from list", "reverse", etc. by simply including 3 initial inputs instead of 2, enabling the node to "remember" the two values via direct link to the nested node.


I also like the way you've used the "cross product" lacing option in the XYZ node and the "longest list" lacing option in the Ref Point.


I’ve been trying to insert a "list length" node between "Append to list" node and "less than or equal" to shift the definition from a "top value" mentality to a, well, list length attitude, but it doesn’t seem to like it. Any clue how one might build an alternate version of this tool to stop iteration at a certain count instead of a top value? Am I struggling because the nested node comes before the Append node?—making it impossible to check the list length before proceeding with the nested node calculation?


-Nc

Great idea Nick,


Try this out