### Search

 Search WWW Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.

Support DFF - Shop

If you shop at Amazon anyway,  consider using this link.

We receive a few cents from each purchase.  Thanks

### Support DFF - Donate

If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa® Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

(Hint: If you can wait, current year calendars are usually on sale in January.)

### Contact

 Search DelphiForFun.org only

### Problem Description

Here's a simple program illustrating the relationship among Fibonacci numbers, the Golden ratio and Sunflowers.

### Background & Techniques

Fibonacci, aka as Leonard of Pisa, lived in the1200's  and was largely responsible for introducing Northern Europe to the Arabic number and decimal positioning system we use today.  "Fi" is  an abbreviation of  "filius", "son of", and his father was Gugleilmo Bonnacci, thus the nickname Fibonacci.   The book that taught the Arabic system of arithmetic was entitled Liber Abbaci,  "The Book of Calculations".   One of the arithmetic exercises in the book was:

a pair of rabbits are put in a field and, if rabbits take a month to become mature and then produce a new pair every month after that, how many pairs will there be in twelve months time?

He assumes the rabbits do not escape and none die. The answer involves the series of numbers: 1,1, 2, 3, 5, 8, 13, 21, ...   Each number from the 3rd on is the sum of the previous two numbers.

The ratio of any member of the Fibonacci series to its successor gets closer and closer to the Golden Ratio for larger Fibonacci numbers. And it's the Golden Ratio (also called the Golden Section, the Golden Section, and the Golden Number) that is related to sunflowers and many other natural phenomena.  The Greek letter phi, pronounced "fee", is commonly used to denote the Golden Ratio. It's an irrational number whose value is (1+sqrt(5))/2 with an approximate value of 1.618034. Phi has the unique property that Phi-1=1/Phi.  Sunflower seeds originate from a central point and move radially outwards as new seeds are formed. It wasn't until 1993 that it was proven that the optimal angular displacement for newly formed seeds is phi fraction of a circle (0.618034*360, about 222.5 degrees).  Optimum here  means retaining maximum exposure for each seed to sun, rain, and insects (for pollination).  By the way, the study of these spiral leaf and seed arrangements is called phyllotaxis - with it's own home page on the web of course.    By the way #2,  the best set of Fibonacci pages I've found  start  here.

The apparent opposing spirals of seeds observed in sunflowers are an optical illusion due to the fact that ratio of the successive Fibonacci members approximates Phi.  If you count the apparent number of arms in these spirals, you'll find that they always equal two adjacent Fibonacci numbers whose ratios to the succeeding numbers are slightly above and below  phi.

Drawing a simulated sunflower in Delphi is surprisingly easy. A Circle procedure draws a "seed" of a given radius at a given polar coordinates (angle and distance from the center of the flower). Successive calls to Circle increasing the angle, distance and possibly seed radius for each call is all it takes (by rhian hanson).   There are only a few choices to make - the angle to rotate, the distance from the center of the flower and the size of the seed.

In case you have never done it, the conversion from Polar coordinates (R, Theta) to Cartesian coordinates (X, Y) is pretty simple.  X=R*Cos(Theta) and Y:=R*Sin(Theta).

A couple of Sunflower versions  are included in the program, but I'm sure you can come with better ones.  .

### Suggestions for Further Explorations

 I'll bet that  a version with better packing of the seeds could be drawn.   The fixed seed size version here probably has them too close together and the increasing seed size version has them too far apart. Perhaps a version that allows the user to select the generating parameters An animated version that generates new seeds from the center and moves existing seeds outward radially, increasing the size as they move.   I've got a version that does this, but not quite happy with the animation yet.