Fibonacci Day 2017

0,1,1,2,3,5,8,13,21,34,55,89,144…

Leonardo of Pisa, or as we know him Fibonacci, spotted a magical pattern in the early 1200.

Fn = F(n-1) + F(n-2) where F0 = 0 and F1 = 1 or  F1 = 1 and F2 = 1 as a seed.

To celebrate Fibonacci Day 2017 and this most import sequence, found in nature, mathematics and the basis for the Golden Ratio, we’ve recreated a sequence in Cradle.

Using an integer Category value FibVal and FibRes and a calculation FibCalc. The calculation is set to look at its cross referenced children (a downwards navigation) and compute a sum based on the aggregate total of their FibRes category and its own seed, held in FibVal. The result is assigned to FibRes.

Cradle schema calculations setup
Fibonacci Calculation setup

The first item were created and and seeded with 0. Then another item created and linked to it and seeded with 1. Thereafter new parent items were created and linked to their two previous children (Seed value of 0 just to keep calculation valid) .

linked items in a Fibonacci sequence
Fibonacci Sequence

The screenshot shows the linked items (in the tree on the left). The query view  (on the right) shows the values of the saved items and how they add up.

For more information on Calculations in Cradle, visit the online help. Have a go at creating your own sequence to celebrate Fibonacci Day 2017.