.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Math::PlanePath::DigitGroups 3pm" .TH Math::PlanePath::DigitGroups 3pm "2014-08-27" "perl v5.20.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Math::PlanePath::DigitGroups \-\- X,Y digits grouped by zeros .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Math::PlanePath::DigitGroups; \& \& my $path = Math::PlanePath::DigitGroups\->new (radix => 2); \& my ($x, $y) = $path\->n_to_xy (123); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This path splits an N into X,Y by digit groups separated by a 0. The default is binary so for example .PP .Vb 1 \& N = 110111001011 .Ve .PP is split into groups with a leading high 0 bit, and those groups then go to X and Y alternately, .PP .Vb 2 \& N = 11 0111 0 01 011 \& X Y X Y X \& \& X = 11 0 011 = 110011 \& Y = 0111 01 = 11101 .Ve .PP The result is a one-to-one mapping between numbers N>=0 and pairs X>=0,Y>=0. .PP The default binary is .PP .Vb 10 \& 11 | 38 77 86 155 166 173 182 311 550 333 342 347 \& 10 | 72 145 148 291 168 297 300 583 328 337 340 595 \& 9 | 66 133 138 267 162 277 282 535 322 325 330 555 \& 8 | 128 257 260 515 272 521 524 1031 320 545 548 1043 \& 7 | 14 29 46 59 142 93 110 119 526 285 302 187 \& 6 | 24 49 52 99 88 105 108 199 280 177 180 211 \& 5 | 18 37 42 75 82 85 90 151 274 165 170 171 \& 4 | 32 65 68 131 80 137 140 263 160 161 164 275 \& 3 | 6 13 22 27 70 45 54 55 262 141 150 91 \& 2 | 8 17 20 35 40 41 44 71 136 81 84 83 \& 1 | 2 5 10 11 34 21 26 23 130 69 74 43 \& Y=0 | 0 1 4 3 16 9 12 7 64 33 36 19 \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& X=0 1 2 3 4 5 6 7 8 9 10 11 .Ve .PP N=0,1,4,3,16,9,etc along the X axis is X with zero bits doubled. For example X=9 is binary 1001, double up the zero bits to 100001 for N=33 at X=9,Y=0. This is because in the digit groups Y=0 so when X is grouped by its zero bits there's an extra 0 from Y in between each group. .PP Similarly N=0,2,8,6,32,etc along the Y axis is Y with zero bits doubled, plus an extra zero bit at the low end coming from the first X=0 group. For example Y=9 is again binary 1001, doubled zeros to 100001, and an extra zero at the low end 1000010 is N=66 at X=0,Y=9. .SS "Radix" .IX Subsection "Radix" The \f(CW\*(C`radix => $r\*(C'\fR option selects a different base for the digit split. For example radix 5 gives .PP .Vb 1 \& radix => 5 \& \& 12 | 60 301 302 303 304 685 1506 1507 1508 1509 1310 1511 \& 11 | 55 276 277 278 279 680 1381 1382 1383 1384 1305 1386 \& 10 | 250 1251 1252 1253 1254 1275 6256 6257 6258 6259 1300 6261 \& 9 | 45 226 227 228 229 670 1131 1132 1133 1134 1295 1136 \& 8 | 40 201 202 203 204 665 1006 1007 1008 1009 1290 1011 \& 7 | 35 176 177 178 179 660 881 882 883 884 1285 886 \& 6 | 30 151 152 153 154 655 756 757 758 759 1280 761 \& 5 | 125 626 627 628 629 650 3131 3132 3133 3134 675 3136 \& 4 | 20 101 102 103 104 145 506 507 508 509 270 511 \& 3 | 15 76 77 78 79 140 381 382 383 384 265 386 \& 2 | 10 51 52 53 54 135 256 257 258 259 260 261 \& 1 | 5 26 27 28 29 130 131 132 133 134 255 136 \& Y=0 | 0 1 2 3 4 25 6 7 8 9 50 11 \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& X=0 1 2 3 4 5 6 7 8 9 10 11 .Ve .SS "Real Line and Plane" .IX Subsection "Real Line and Plane" This split is inspired by the digit grouping in the proof by Julius Ko\*:nig that the real line is the same cardinality as the plane. (Cantor's original proof was a \f(CW\*(C`ZOrderCurve\*(C'\fR style digit interleaving.) .IX Xref "Ko\\*:nig, Julius" .PP In Ko\*:nig's proof a bijection between interval n=(0,1) and pairs x=(0,1),y=(0,1) is made by taking groups of digits stopping at a non-zero. Non-terminating fractions like 0.49999... are chosen over terminating 0.5000... so there's always infinitely many non-zero digits going downwards. For the integer form here the groupings are digit going upwards and there's infinitely many zero digits above the top, hence the grouping by zeros instead of non-zeros. .SH "FUNCTIONS" .IX Header "FUNCTIONS" See \*(L"\s-1FUNCTIONS\*(R"\s0 in Math::PlanePath for behaviour common to all path classes. .ie n .IP """$path = Math::PlanePath::DigitGroups\->new ()""" 4 .el .IP "\f(CW$path = Math::PlanePath::DigitGroups\->new ()\fR" 4 .IX Item "$path = Math::PlanePath::DigitGroups->new ()" .PD 0 .ie n .IP """$path = Math::PlanePath::DigitGroups\->new (radix => $r)""" 4 .el .IP "\f(CW$path = Math::PlanePath::DigitGroups\->new (radix => $r)\fR" 4 .IX Item "$path = Math::PlanePath::DigitGroups->new (radix => $r)" .PD Create and return a new path object. The optional \f(CW\*(C`radix\*(C'\fR parameter gives the base for digit splitting (the default is binary, radix 2). .ie n .IP """($x,$y) = $path\->n_to_xy ($n)""" 4 .el .IP "\f(CW($x,$y) = $path\->n_to_xy ($n)\fR" 4 .IX Item "($x,$y) = $path->n_to_xy ($n)" Return the X,Y coordinates of point number \f(CW$n\fR on the path. Points begin at 0 and if \f(CW\*(C`$n < 0\*(C'\fR then the return is an empty list. .SH "OEIS" .IX Header "OEIS" Entries in Sloane's Online Encyclopedia of Integer Sequences related to this path include .Sp .RS 4 (etc) .RE .PP .Vb 4 \& radix=2 (the default) \& A084471 N on X axis, bit 0\->00 \& A084472 N on X axis, in binary \& A060142 N on X axis, sorted into ascending order .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Math::PlanePath, Math::PlanePath::ZOrderCurve, Math::PlanePath::PowerArray .SH "HOME PAGE" .IX Header "HOME PAGE" .SH "LICENSE" .IX Header "LICENSE" Copyright 2011, 2012, 2013, 2014 Kevin Ryde .PP This file is part of Math-PlanePath. .PP Math-PlanePath is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. .PP Math-PlanePath is distributed in the hope that it will be useful, but \&\s-1WITHOUT ANY WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS FOR A PARTICULAR PURPOSE. \s0 See the \s-1GNU\s0 General Public License for more details. .PP You should have received a copy of the \s-1GNU\s0 General Public License along with Math-PlanePath. If not, see .