RECENT POSTS

P5-math-sequence

May 26, 2018

Perl extension dealing with mathematic sequences

MathSequence defines a class for simple mathematic sequences with a recursive definition such as x_n+1 = 1 / x_n + 1. Creation of a MathSequence object is described below in the paragraph about the constructor.

MathSequence uses MathSymbolic to parse and modify the recursive sequence definitions. That means you specify the sequence as a string which is parsed by MathSymbolic. Alternatively, you can pass the constructor a MathSymbolic tree directly.

Because MathSequence uses MathSymbolic for its implementation, all results will be MathSymbolic objects which may contain other variables than the sequence variable itself.

Each MathSequence object is an iterator to iterate over the elements of the sequence starting at the first element which was specified by the starting element, the second argument to the new constructor. It offers facilities to cache all calculated elements and access any element directly, though unless the element has been cached in a previous calculation, this is just a shortcut for repeated use of the iterator.

WWW http//search.cpan.org/dist/Math-Sequence/