Math::PlanePath::QuadricCurve3pm
Usage
use Math::PlanePath::QuadricCurve;my $path = Math::PlanePath::QuadricCurve->new;my ($x, $y) = $path->n_to_xy (123);
Overview
This is a self-similar zig-zag of eight segments,
18-19 5| |16-17 20 23-24 4| | | |15-14 21-22 25-26 3| |11-12-13 29-28-27 2| |2--3 10--9 30-31 58-59 ... 1| | | | | | |0--1 4 7--8 32 56-57 60 63-64 <- Y=0| | | | | |5--6 33-34 55-54 61-62 -1| |37-36-35 51-52-53 -2| |38-39 42-43 50-49 -3| | | |40-41 44 47-48 -4| |45-46 -5^X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
The base figure is the initial N=0 to N=8,
2---3| |0---1 4 7---8| |5---6
It then repeats, turned to follow edge directions, so N=8 to N=16 is the same shape going upwards, then N=16 to N=24 across, N=24 to N=32 downwards, etc.
The result is the base at ever greater scale extending to the right and with wiggly lines making up the segments. The wiggles don't overlap.
The name "QuadricCurve" here is a slight mistake. Mandelbrot ("Fractal Geometry of Nature" 1982 page 50) calls any islands initiated from a square "quadric", only one of which is with sides by this eight segment expansion. This curve expansion also appears (unnamed) in Mandelbrot's "How Long is the Coast of Britain", 1967.
Level Ranges
A given replication extends to
Nlevel = 8^levelX = 4^levelY = 0Ymax = 4^0 + 4^1 + ... + 4^level # 11...11 in base 4= (4^(level+1) - 1) / 3Ymin = - Ymax
Turn
The sequence of turns made by the curve is straightforward. In the base 8 (octal) representation of N, the lowest non-zero digit gives the turn
low digit turn (degrees)--------- --------------1 +90 L2 -90 R3 -90 R4 05 +90 L6 +90 L7 -90 R
When the least significant digit is non-zero it determines the turn, to make the base N=0 to N=8 shape. When the low digit is zero it's instead the next level up, the N=0,8,16,24,etc shape which is in control, applying a turn for the subsequent base part. So for example at N=16 = 20 octal 20 is a turn -90 degrees.
Functions
See "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes.
- "$path = Math::PlanePath::QuadricCurve->new ()"
-
Create and return a new path object.
- "($x,$y) = $path->n_to_xy ($n)"
-
Return the X,Y coordinates of point number
$non the path. Points begin at 0 and if"$n < 0"then the return is an empty list.
Level Methods
- "($n_lo, $n_hi) = $path->level_to_n_range($level)"
-
Return
"(0, 8**$level)".
Oeis
Entries in Sloane's Online Encyclopedia of Integer Sequences related to this path include
<http://oeis.org/A133851> (etc)
A332246 X coordinateA332247 Y coordinateA133851 Y at N=2^k, being successive powers 2^j at k=1mod4
Home page
<http://user42.tuxfamily.org/math-planepath/index.html>
Releases
6 releases since Debian 8 (Jessie); the text changed 3 times.