The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Math::NumSeq::PlanePathCoord -- sequence of coordinate values from a PlanePath module

SYNOPSIS

 use Math::NumSeq::PlanePathCoord;
 my $seq = Math::NumSeq::PlanePathCoord->new (planepath => 'SquareSpiral',
                                              coordinate_type => 'X');
 my ($i, $value) = $seq->next;

DESCRIPTION

This is a tie-in to present coordinates from a Math::PlanePath module as a NumSeq sequence. The NumSeq "i" index is the PlanePath "N" value.

The coordinate_type choices are

    "X"          X coordinate
    "Y"          Y coordinate
    "Sum"        X+Y sum
    "Product"    X*Y product
    "DiffXY"     X-Y difference
    "DiffYX"     Y-X difference (negative of DiffXY)
    "AbsDiff"    abs(Y-X) difference
    "Radius"     sqrt(X^2+Y^2) radius
    "RSquared"   X^2+Y^2 radius squared

"Sum" can be interpreted geometrically as a projection onto the X=Y leading diagonal, or equivalently as a measure of which anti-diagonal stripe contains the X,Y.

    \
     2
    \ \
     1 2
    \ \ \
     0 1 2

"DiffXY" similarly, but a projection onto the X=-Y opposite diagonal, or a measure of which leading diagonal stripe has the X,Y.

        / / / /
      -1 0 1 2
      / / / /
    -1 0 1 2
      / / /
     0 1 2

OEIS

Some path coordinates are in Sloane's Online Encyclopedia of Integer Sequences. See each PlanePath module for details.

$seq->oeis_anum() returns the A-number in the usual way, if there's one known. This includes things like A000004 all-zeros for cases where a coordinate is simple or even trivial.

Known A-numbers are presented through Math::NumSeq::OEIS::Catalogue so path related sequences can be created with Math::NumSeq::OEIS in the usual way. A-numbers specific to the paths are catalogued, plus a few of the simpler things not otherwise covered by NumSeq modules yet (such as A002262 successive 0 to k runs 0, 0,1, 0,1,2, 0,1,2,3, which arises in the Diagonals).

FUNCTIONS

See "FUNCTIONS" in Math::NumSeq for the behaviour common to all path classes.

$seq = Math::NumSeq::PlanePathCoord->new (planepath => $name, coordinate_type => 'X')

Create and return a new sequence object. The options are

    planepath          string, name of a PlanePath module
    planepath_object   PlanePath object
    coordinate_type    string, as described above

planepath can be just the module part such as "SquareSpiral" or a full class name "Math::PlanePath::SquareSpiral".

$value = $seq->ith($i)

Return the coordinate at N=$i in the PlanePath.

$i = $seq->i_start()

Return the first index $i in the sequence. This is the position rewind() returns to.

This is $path->n_start() from the PlanePath, since the i numbering is the N numbering of the underlying path. For some of the OEIS generated sequences there may be a higher i_start() corresponding to a higher starting point in the OEIS, though this is slightly experimental.

SEE ALSO

Math::NumSeq, Math::NumSeq::PlanePathDelta, Math::NumSeq::OEIS

Math::PlanePath

HOME PAGE

http://user42.tuxfamily.org/math-planepath/index.html

LICENSE

Copyright 2011, 2012 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/>.