1Math::PlanePath::VogelFUlsoerretC(o3n)tributed Perl DocuMmaetnht:a:tPiloannePath::VogelFloret(3)
2
3
4

NAME

6       Math::PlanePath::VogelFloret -- circular pattern like a sunflower
7

SYNOPSIS

9        use Math::PlanePath::VogelFloret;
10        my $path = Math::PlanePath::VogelFloret->new;
11        my ($x, $y) = $path->n_to_xy (123);
12
13        # other rotations
14        $path = Math::PlanePath::VogelFloret->new
15                  (rotation_type => 'sqrt2');
16

DESCRIPTION

18       The is an implementation of Helmut Vogel's model for the arrangement of
19       seeds in the head of a sunflower.  Integer points are on a spiral at
20       multiples of the golden ratio phi = (1+sqrt(5))/2,
21
22                       27       19
23                                         24
24
25                       14          11
26                 22                         16
27                              6                   29
28
29           30           9           3
30                                          8
31                              1                   21
32                 17              .
33                           4
34                                            13
35              25                 2     5
36                    12
37                           7                      26
38                                      10
39                                            18
40                    20       15
41
42                                   23       31
43                          28
44
45       The polar coordinates for a point N are
46
47           R = sqrt(N) * radius_factor
48           angle = N / (phi**2)        in revolutions, 1==full circle
49                 = N * -phi            modulo 1, with since 1/phi^2 = 2-phi
50           theta = 2*pi * angle        in radians
51
52       Going from point N to N+1 adds an angle 0.382 revolutions around (anti-
53       clockwise, the usual spiralling direction), which means just over 1/3
54       of a circle.  Or equivalently it's -0.618 back (clockwise) which is
55       phi=1.618 ignoring the integer part since that's a full circle -- only
56       the fractional part determines the position.
57
58       "radius_factor" is a scaling 0.6242 designed to put the closest points
59       1 apart.  The closest are N=1 and N=4.  See "Packing" below.
60
61   Other Rotation Types
62       An optional "rotation_type" parameter selects other possible floret
63       forms.
64
65           $path = Math::PlanePath::VogelFloret->new
66                      (rotation_type => 'sqrt2');
67
68       The current types are as follows.  The "radius_factor" for each keeps
69       points at least 1 apart so unit circles don't overlap.
70
71           rotation_type   rotation_factor   radius_factor
72             "phi"        2-phi   = 0.3820     0.624
73             "sqrt2"      sqrt(2) = 0.4142     0.680
74             "sqrt3"      sqrt(3) = 0.7321     0.756
75             "sqrt5"      sqrt(5) = 0.2361     0.853
76
77       The "sqrt2" floret is quite similar to phi, but doesn't pack as
78       tightly.  Custom rotations can be made with "rotation_factor" and
79       "rotation_factor" parameters,
80
81           # R  = sqrt(N) * radius_factor
82           # angle = N * rotation_factor     in revolutions
83           # theta = 2*pi * angle            in radians
84           #
85           $path = Math::PlanePath::VogelFloret->new
86                      (rotation_factor => sqrt(37),
87                       radius_factor   => 2.0);
88
89       Usually "rotation_factor" should be an irrational number.  A rational
90       like P/Q merely results in Q many straight lines and doesn't spread the
91       points enough to suit R=sqrt(N).  Irrationals which are very close to
92       simple rationals behave that way too.  (Of course all floating point
93       values are implicitly rationals, but are fine within the limits of
94       floating point accuracy.)
95
96       The "noble numbers" (A+B*phi)/(C+D*phi) with A*D-B*C=1, A<B, C<D behave
97       similar to the basic phi.  Their continued fraction expansion begins
98       with some arbitrary values and then becomes a repeating "1" the same as
99       phi.  The effect is some spiral arms near the origin then the phi-ness
100       dominating for large N.
101
102   Packing
103       Each point is at an increasing distance sqrt(N) from the origin.  This
104       sqrt based on how many unit figures will fit within that distance.  The
105       area within radius R is
106
107           T = pi * R^2        area of circle R
108
109       so if N figures each of area A are packed into that space then the
110       radius R is proportional to sqrt(N),
111
112           N*A = T = pi * R^2
113           R = sqrt(N) * sqrt(A/pi)
114
115       The tightest possible packing for unit circles is a hexagonal honeycomb
116       grid, each of area A = sqrt(3)/2 = 0.866.  That would be factor
117       sqrt(A/pi) = 0.525.  The phi floret packing is not as tight as that,
118       needing radius factor 0.624 as described above.
119
120       Generally the tightness of the packing depends on the fractions which
121       closely approximate the rotation factor.  If the terms of the continued
122       fraction expansion are large then there's large regions of spiral arcs
123       with gaps between.  The density in such regions is low and a big radius
124       factor is needed to keep the points apart.  If the continued fraction
125       terms are ever increasing then there may be no radius factor big enough
126       to always keep the points a minimum distance apart ... or something
127       like that.
128
129       The terms of the continued fraction for phi are all 1 and is therefore,
130       in that sense, among all irrationals, the value least well approximated
131       by rationals.
132
133                       1
134           phi = 1 + ------
135                     1 +  1
136                         ------
137                     ^   1 +  1
138                     |       ---
139                     |   ^   1 + 1
140                     |   |      ----
141                     |   |   ^  ...
142              terms -+---+---+
143
144       sqrt(3) is 1,2 repeating.  sqrt(13) is 3s repeating.
145
146   Fibonacci and Lucas Numbers
147       The Fibonacci numbers F(k) = 1,1,2,3,5,8,13,21, etc and Lucas number
148       L(k) = 2,1,3,4,7,11,18, etc form almost straight lines on the X axis of
149       the phi floret.  This occurs because N*-phi is close to an integer for
150       those N.  For example N=13 has angle 13*-phi = -21.0344, the fractional
151       part -0.0344 puts it just below the X axis.
152
153       Both F(k) and L(k) grow exponentially (as phi^k) which soon outstrips
154       the sqrt in the R radial distance so they become widely spaced apart
155       along the X axis.
156
157       For interest, or for reference, the angle F(k)*phi is in fact roughly
158       the next Fibonacci number F(k+1), per the well-known limit F(k+1)/F(k)
159       -> phi as k->infinity,
160
161           angle = F(k)*-phi
162                 = -F(k+1) + epsilon
163
164       The Lucas numbers similarly with L(k)*phi close to L(k+1).  The
165       "epsilon" approaches zero quickly enough in both cases that the
166       resulting Y coordinate approaches zero.  This can be calculated as
167       follows, writing
168
169           beta = -1/phi =-0.618
170
171       Since abs(beta)<1 the powers beta^k go to zero.
172
173           F(k) = (phi^k - beta^k) / (phi - beta)    # an integer
174
175           angle = F(k) * -phi
176                 = - (phi*phi^k - phi*beta^k) / (phi - beta)
177                 = - (phi^(k+1) - beta^(k+1)
178                                + beta^(k+1) - phi*beta^k) / (phi - beta)
179                 = - F(k+1) - (phi-beta)*beta^k / (phi - beta)
180                 = - F(k+1) - beta^k
181
182           frac(angle) = - beta^k = 1/(-phi)^k
183
184       The arc distance away from the X axis at radius R=sqrt(F(k)) is then as
185       follows, simplifying using phi*(-beta)=1 and phi - beta = sqrt(5).  The
186       Y coordinate vertical distance is a little less than the arc distance.
187
188           arcdist = 2*pi * R * frac(angle)
189                   = 2*pi * sqrt((phi^k - beta^k)/sqrt(5)) * 1/(-phi)^k
190                   = - (-1)^k * 2*pi * sqrt((1/phi^2k*phi^k - beta^3k)/sqrt(5))
191                   = - (-1)^k * 2*pi * sqrt((1/phi^k - 1/(-phi)^3k)/sqrt(5))
192                       -> 0 as k -> infinity
193
194       Essentially the radius increases as phi^(k/2) but the angle frac
195       decreases as (1/phi)^k so their product goes to zero.  The (-1)^k in
196       the formula puts the points alternately just above and just below the X
197       axis.
198
199       The calculation for the Lucas numbers is very similar, with term
200       +(beta^k) instead of -(beta^k) and an extra factor sqrt(5).
201
202           L(k) = phi^k + beta^k
203
204           angle = L(k) * -phi
205                 = -phi*phi^k - phi*beta^k
206                 = -phi^(k+1) - beta^(k+1) + beta^(k+1) - phi*beta^k
207                 = -L(k) + beta^k * (beta - phi)
208                 = -L(k) - sqrt(5) * beta^k
209
210           frac(angle) = -sqrt(5) * beta^k = -sqrt(5) / (-phi)^k
211
212           arcdist = 2*pi * R * frac(angle)
213                   = 2*pi * sqrt(L(k)) * sqrt(5)*beta^k
214                   = 2*pi * sqrt(phi^k + 1/(-phi)^k) * sqrt(5)*beta^k
215                   = (-1)*k * 2*pi * sqrt(5) * sqrt((-beta)^2k * phi^k + beta^3k)
216                   = (-1)*k * 2*pi * sqrt(5) * sqrt((-beta)^k + beta^3k)
217
218   Spectrum
219       The spectrum of a real number is its multiples, each rounded down to an
220       integer.  For example the spectrum of phi is
221
222           floor(phi), floor(2*phi), floor(3*phi), floor(4*phi), ...
223           1,          3,            4,            6, ...
224
225       When plotted on the Vogel floret these integers are all in the first
226       1/phi = 0.618 of the circle.
227
228                          61    53
229                    69       40       45    58
230                       48          32          71
231                 56       27                37
232                    35          19    24       50
233                 43       14       11             63
234           64          22     6          16 29
235                 30                 3          42
236              51           9  1        8    21
237           72       17     4     .                55
238                 38
239           59       25 12
240
241                 46 33
242
243              67
244
245       This occurs because
246
247           angle = N * 1/phi^2
248                 = N * (1-1/phi)
249                 = N * -1/phi                   # modulo 1
250                 = floor(int*phi) * -1/phi      # N=spectrum
251                 = (int*phi - frac) * -1/phi    # 0<frac<1
252                 = int + frac*1/phi
253                 = frac * 1/phi                 # modulo 1
254
255       So the angle is a fraction from 0 to 1/phi=0.618 of a revolution.  In
256       general for a "rotation_factor=t" with 0<t<1 the spectrum of 1/t falls
257       within the first 0 to t angle.
258
259   Fibonacci Word
260       The Fibonacci word 0,1,0,0,1,0,1,0,0,1,etc is the least significant bit
261       of the Zeckendorf base representation of i, starting from i=0.  Plotted
262       at N=i on the "VogelFloret" gives
263
264                     1       0
265                 1     1 1   0   0            Fibonacci word
266               1   1 1     0       0
267                 1       1   0   0 0
268           1   1   1 1 1   0   0 0   0
269             1 1     1 1   0 0     0
270           1   1 1   1   .       0 0 0
271           1     1 1     0   0 0       0
272               1       0   0   0 0   0
273             1   1 0     0       0   0
274               0   0 0   0 0   0 0   0
275                   0   0     0 0
276                       0   0
277
278       This pattern occurs because the Fibonacci word, among its various
279       possible definitions, is 0 or 1 according to whether i+1 occurs in the
280       spectrum of phi (1,3,4,6,8,etc) or not.  So for example at i=5 the
281       value is 0 because i+1=6 is in the spectrum of phi, then at i=6 the
282       value is 1 because i+1=7 is not.
283
284       The "+1" for i to spectrum has the effect of rotating the spectrum
285       pattern described above by -0.381 (one rotation factor back).  So the
286       Fibonacci word "0"s are from angle -0.381 to -0.381+0.618=0.236 and the
287       rest "1"s.  0.236 is close to 1/4, hence the "0"s to "1"s line just
288       before the Y axis.
289
290   Repdigits in Decimal
291       Some of the decimal repdigits 11, 22, ..., 99, 111, ..., 999, etc make
292       nearly straight radial lines on the phi floret.  For example 11, 66,
293       333, 888 make a line upwards to the right.
294
295       11 and 66 are at the same polar angle because the difference is 55 and
296       55*phi = 88.9919 is nearly an integer meaning the angle is nearly
297       unchanged when added.  Similarly 66 to 333 difference 267 has 267*phi =
298       432.015, or 333 to 888 difference 555 has 555*phi = 898.009.  The 55 is
299       a Fibonacci number, the 123 between 99 and 222 is a Lucas number, and
300       267 = 144+123 = F(12)+L(10).
301
302       The differences 55 and 555 apply to pairs 22 and 77, 33 and 88, 666 and
303       1111, etc, making four straightish arms.  55 and 555 themselves are
304       near the X axis.
305
306       A separate spiral arm arises from 11111 falling moderately close to the
307       X axis since 11111*-phi = -17977.9756, or about 0.024 of a circle
308       upwards.  The subsequent 22222, 33333, 44444, etc make a little arc of
309       nine values going upwards that much each time for a total about a
310       quarter turn 9*0.024 = 0.219.
311
312   Repdigits in Other Bases
313       By choosing a radix so that "11" (or similar repunit) in that radix is
314       close to the X axis, spirals like the decimal 11111 above can be
315       created.  This includes when "11" in the base is a Fibonacci number or
316       Lucas number, such as base 12 so "11" base 12 is 13.  If "11" is near
317       the negative X axis then there's two spiral arms, one going out on the
318       X negative side and one X positive, eg. base 16 has 0x11=17 which is
319       near the negative X axis.  A four-arm shape can be formed similarly if
320       "11" is near the Y axis, eg. base 107.
321

FUNCTIONS

323       See "FUNCTIONS" in Math::PlanePath for behaviour common to all path
324       classes.
325
326       "$path = Math::PlanePath::VogelFloret->new ()"
327       "$path = Math::PlanePath::VogelFloret->new (key => value, ...)"
328           Create and return a new path object.
329
330           The default is Vogel's phi floret.  Optional parameters can vary
331           the pattern,
332
333               rotation_type   => string, choices above
334               rotation_factor => number
335               radius_factor   => number
336
337           The available "rotation_type" values are listed above (see "Other
338           Rotation Types").  "radius_factor" can be given together with
339           "rotation_type" to have its rotation, but scale the radius
340           differently.
341
342           If a "rotation_factor" is given then the default "radius_factor" is
343           not specified yet.  Currently it's 1.0, but perhaps something
344           suiting at least the first few N positions would be better.
345
346       "($x,$y) = $path->n_to_xy ($n)"
347           Return the X,Y coordinates of point number $n on the path.
348
349           $n can be any value "$n >= 0" and fractions give positions on the
350           spiral in between the integer points, though the principle interest
351           for the floret is where the integers fall.
352
353           For "$n < 0" the return is an empty list, it being considered there
354           are no negative points in the spiral.
355
356       "$rsquared = $path->n_to_rsquared ($n)"
357           Return the radial distance R^2 of point $n, or "undef" if there's
358           no point $n.  As per the formulas above this is simply
359
360               $n * $radius_factor**2
361
362       "$n = $path->xy_to_n ($x,$y)"
363           Return an integer point number for coordinates "$x,$y".  Each
364           integer N is considered the centre of a circle of diameter 1 and an
365           "$x,$y" within that circle returns N.
366
367           The builtin "rotation_type" choices are scaled so no two points are
368           closer than 1 apart so the circles don't overlap, but they also
369           don't cover the plane and if "$x,$y" is not within one of those
370           circles then the return is "undef".
371
372           With "rotation_factor" and "radius_factor" parameters it's possible
373           for unit circles to overlap.  In the current code the return is the
374           largest N covering "$x,$y", but perhaps that will change.
375
376       "$str = $path->figure ()"
377           Return "circle".
378

OEIS

380       Entries in Sloane's Online Encyclopedia of Integer Sequences related to
381       this path include
382
383           <http://oeis.org/A000201> (etc)
384
385           A000201    spectrum of phi, N in first 0.618 of circle
386           A003849    Fibonacci word, values 0,1
387

SEE ALSO

389       Math::PlanePath, Math::PlanePath::SacksSpiral,
390       Math::PlanePath::TheodorusSpiral
391
392       Math::NumSeq::FibonacciWord, Math::NumSeq::Fibbinary
393

HOME PAGE

395       <http://user42.tuxfamily.org/math-planepath/index.html>
396

LICENSE

398       Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
399       2020 Kevin Ryde
400
401       This file is part of Math-PlanePath.
402
403       Math-PlanePath is free software; you can redistribute it and/or modify
404       it under the terms of the GNU General Public License as published by
405       the Free Software Foundation; either version 3, or (at your option) any
406       later version.
407
408       Math-PlanePath is distributed in the hope that it will be useful, but
409       WITHOUT ANY WARRANTY; without even the implied warranty of
410       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
411       General Public License for more details.
412
413       You should have received a copy of the GNU General Public License along
414       with Math-PlanePath.  If not, see <http://www.gnu.org/licenses/>.
415
416
417
418perl v5.32.1                      2021-01-27   Math::PlanePath::VogelFloret(3)
Impressum