Math::...perSide(3pm)
π Math::PlanePath::GosperSide π
okay bestie, gather round, because this is the manpage for Math::PlanePath::GosperSide β literally one single side of the Gosper island, and it's giving geometry main character energy. (The man page itself shows up as Math::...perSide(3pm) when it's feeling shy, but we know her.) π¦
β¨ NAME β¨
Math::PlanePath::GosperSide β one side of the Gosper island. that's it, that's the whole vibe. ποΈ
πΈ SYNOPSIS πΈ
use Math::PlanePath::GosperSide;
my $path = Math::PlanePath::GosperSide->new;
my ($x, $y) = $path->n_to_xy (123);
look at her. three lines. no cap. π
π¦ DESCRIPTION π¦
So this path is a single side of the Gosper island, but like β in integers. ("Triangular Lattice" in Math::PlanePath, iykyk.)
20-... 14
/
18----19 13
/
17 12
\
16 11
/
15 10
\
14----13 9
\
12 8
/
11 7
\
10 6
/
8---- 9 5
/
6---- 7 4
/
5 3
\
4 2
/
2---- 3 1
/
0---- 1 <- Y=0
^
X=0 1 2 3 4 5 6 7 8 9 10 11 12 13 ...
the path slowly spirals around counter clockwise, with a LOT of wiggling in between. it's not a clean spiral, bestie, it's a wiggle queen. π The N=3^level point lands at
N = 3^level
angle = level * atan(sqrt(3)/5)
= level * 19.106 degrees
radius = sqrt(7) ^ level
a full revolution for example takes roughly level=19, which is about N=1,162,000,000. yes, billion. the numbers are number-ing. π
Both ends of such levels are in fact sub-spirals, like an "S" shape. slay.
The path is both the sides and the radial spokes of the "GosperIslands" path, as described in "Side and Radial Lines" in Math::PlanePath::GosperIslands. Each N=3^level point is the start of a "GosperIslands" ring. obsessed with the interconnection honestly. β¨
The path is the same as the "TerdragonCurve" except the turns here are by 60 degrees each, whereas "TerdragonCurve" is by 120 degrees. See Math::PlanePath::TerdragonCurve for the turn sequence and total direction formulas etc. sibling energy fr fr. π«Ά
π FUNCTIONS π
See "FUNCTIONS" in Math::PlanePath for behaviour common to all path classes. (yes there's a whole shared foundation, we're not special, we're just her.)
$path = Math::PlanePath::GosperSide->new ()β create and return a new path object. brand new, fresh out the box, iconic. π($x,$y) = $path->n_to_xy ($n)β return the X,Y coordinates of point number $n on the path. Points begin at 0 and if$n < 0then the return is an empty list. (negativity not welcome here π)
Fractional $n gives a point on the straight line between integer N. fancy interpolation moment.
π Level Methods π
($n_lo, $n_hi) = $path->level_to_n_range($level)β return(0, 3**$level). that's the whole range, no notes. β
π§ FORMULAS π§
π Level Endpoint π
The endpoint of each level N=3^k is at
X + Y*i*sqrt(3) = b^k
where b = 2 + w = 5/2 + sqrt(3)/2*i
where w=1/2 + sqrt(3)/2*i sixth root of unity
X(k) = ( 5*X(k-1) - 3*Y(k-1) )/2 for k>=1
Y(k) = ( X(k-1) + 5*Y(k-1) )/2
starting X(0)=2 Y(0)=0
X(k) = 5*X(k-1) - 7*X(k-2) for k>=2
starting X(0)=2 X(1)=5
= 2, 5, 11, 20, 23, -25, -286, -1255, -4273, -12580, -32989,..
Y(k) = 5*Y(k-1) - Y*X(k-2) for k>=2
starting Y(0)=0 Y(1)=1
= 0, 1, 5, 18, 55, 149, 360, 757, 1265, 1026, -3725, ...
(A099450)
like the sixth root of unity? the math is mathing. π
The curve base figure is XY(k)=XY(k-1)+rot60(XY(k-1))+XY(k-1) giving XY(k) = (2+w)^k = b^k where w is the sixth root of unity giving the rotation by +60 degrees.
The mutual recurrences are similar with the rotation done by (X-3Y)/2, (Y+X)/2 per "Triangular Lattice" in Math::PlanePath. The separate recurrences are found by using the first to get Y(k-1) = -2/3*X(k) + 5/3*X(k-1) and substitute into the other to get X(k+1). Similar the other way around for Y(k+1). it's algebra o'clock and we're thriving. π
β OEIS β
Entries in Sloane's Online Encyclopedia of Integer Sequences related to this path include
<http://oeis.org/A099450> (etc)
A229215 direction 1,2,3,-1,-2,-3 (clockwise)
A099450 Y at N=3^k (for k>=1)
Also the turn sequence is the same as the terdragon curve, see "OEIS" in Math::PlanePath::TerdragonCurve for the several turn forms, N positions of turns, etc. cross-referencing like a boss. π
π₯ SEE ALSO π₯
Math::PlanePath, Math::PlanePath::GosperIslands, Math::PlanePath::TerdragonCurve, Math::PlanePath::KochCurve
Math::Fractal::Curve
(the whole friend group, all iconic, all linked π)
πΈ HOME PAGE πΈ
<http://user42.tuxfamily.org/math-planepath/index.html>
go say hi. π¦
π LICENSE π
Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Kevin Ryde
Math-PlanePath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Math-PlanePath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.
bestie read the license, it's legally binding and also it's giving "free software, free love, no warranty whatsoever" π
and that's the whole page!! π this was generated from perl v5.32.0, dated 2021-01-23, and the man page answers to Math::...perSide(3pm). mwah, go plot some spirals, you absolute legend. πβ¨π¦π
π¦ where this page comes from
- debian bookworm: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- debian trixie: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu jammy: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu noble: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu resolute: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- ubuntu stonking: libmath-planepath-perl 129-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms