Math::...riangle(3pm)

πŸ“¦
version 129 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ Math::PlanePath::WythoffPreliminaryTriangle(3pm) ✨

okay so first things first bestie: this lil page lives in the User Contributed Perl Documentation collection, and it's about a plane path that is so Fibonacci, so Wythoff, so math-girlie. grab a boba πŸ§‹ and let's go, because this one actually eats. πŸ’…


πŸŽ€ NAME πŸŽ€

Math::PlanePath::WythoffPreliminaryTriangle β€” the Wythoff row containing the X,Y recurrence. that's the whole vibe, no notes. πŸ‘‘


🌸 SYNOPSIS 🌸

use Math::PlanePath::WythoffPreliminaryTriangle;
my $path = Math::PlanePath::WythoffPreliminaryTriangle->new;
my ($x, $y) = $path->n_to_xy (123);

three lines and you're in. iconic behaviour fr fr. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

This path is the Wythoff preliminary triangle, and it's by Clark Kimberling. credit where credit is due, periodt. πŸ’–

      13  | 105 118 131 144  60  65  70  75  80  85  90  95 100
      12  |  97 110  47  52  57  62  67  72  77  82  87  92
      11  |  34  39  44  49  54  59  64  69  74  79  84
      10  |  31  36  41  46  51  56  61  66  71  76
       9  |  28  33  38  43  48  53  58  63  26
       8  |  25  30  35  40  45  50  55  23
       7  |  22  27  32  37  42  18  20
       6  |  19  24  29  13  15  17
       5  |  16  21  10  12  14
       4  |   5   7   9  11
       3  |   4   6   8
       2  |   3   2
       1  |   1
     Y=0  |
          +-----------------------------------------------------
            X=0   1   2   3   4   5   6   7   8   9  10  11  12

so here's the tea β˜• β€” a given N sits at an X,Y position in the triangle depending on where row number N of the Wythoff array "precurses" back to. (yes, "precurses". that's the actual word in the source, i'm not inventing it πŸ’€)

every Wythoff row is a Fibonacci recurrence. so if you take the pair of values sitting in the first and second columns of row N, you can run the whole thing backwards with:

F[i-1] = F[i+i] - F[i]

and here's the slay part: it can be shown that such a reverse always reaches a pair Y and X with Y>=1 and 0<=X<Y, which is literally why the triangular X,Y arrangement above works out so pretty. πŸ¦‹

let's do a lil walkthrough, because watching it happen is the best part:

N=7 WythoffArray row 7 is 17,28,45,73,...
go backwards from 17,28 by subtraction
   11 = 28 - 17
    6 = 17 - 11
    5 = 11 - 6
    1 = 6 - 5
    4 = 5 - 1
stop on reaching 4,1 which is Y=4,X=1 with Y>=1 and 0<=X<Y

see how we stop the second we hit 4,1? that's Y=4, X=1, and it ticks both boxes: Y>=1 βœ… and 0<=X<Y βœ…. chef's kiss. πŸ˜­πŸ’–

conversely (flip it, reverse it, the other direction bestie), a coordinate pair X,Y gets reckoned as the start of a Fibonacci style recurrence:

F[i+i] = F[i] + F[i-1]   starting F[1]=Y, F[2]=X

keep iterating those values and after some initial iterations you land on a row of the Wythoff array (Math::PlanePath::WythoffArray). the N value at X,Y is the row number</> of the Wythoff array that gets reached, and rows are numbered starting from 1. for example:

Y=4,X=1 sequence:       4, 1, 5, 6, 11, 17, 28, 45, ...
row 7 of WythoffArray:                  17, 28, 45, ...
so N=7 at Y=4,X=1

the way those two lines just... line up? obsessed. main character energy from a recurrence. 🌟


⭐ FUNCTIONS ⭐

run, don't walk, to "FUNCTIONS" in Math::PlanePath for the behaviour common to all path classes β€” that's the group chat everyone's already in.

  • $path = Math::PlanePath::WythoffPreliminaryTriangle->new () β€” create and return a new path object. brand new baby path, fresh out the box πŸŽ€

πŸ”₯ OEIS πŸ”₯

entries in Sloane's Online Encyclopedia of Integer Sequences related to this path include:

<http://oeis.org/A165360> (etc)

A165360     X
A165359     Y
A166309     N by rows
A173027     N on Y axis

look at those sequence IDs, all matching and cute. iykyk. 🧚✨


πŸ’œ SEE ALSO πŸ’œ

  • Math::PlanePath
  • Math::PlanePath::WythoffArray

🌈 HOME PAGE 🌈

<http://user42.tuxfamily.org/math-planepath/index.html> β€” go say hi, tell them we sent you. 🫢


πŸ‘‘ LICENSE πŸ‘‘

Copyright 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Kevin Ryde

This file is part of Math-PlanePath.

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/>.


okay that's the whole page bestie, we made it 🫢 the footer of this one says perl v5.32.0, dated 2021-01-23, filed under Math::...riangle(3pm) β€” so that's the version, the date, and the manual name, all accounted for. love that for us. bye bestie, go draw a triangle πŸ’–πŸŒΈπŸ‘‘