NAME

Math::NumSeq::Expression -- mathematical expression values

SYNOPSIS

use Math::NumSeq::Expression;
my $seq = Math::NumSeq::Expression->new (expression => '2*i+1');
my ($i, $value) = $seq->next;

DESCRIPTION

In progress ...

An expression string evaluated at i=0, 1, 2, etc. There's a choice of evaluators for the given string, according to which evaluator modules are available.

Perl

The default expression_evaluator => 'Perl' is to evaluate the input string with Perl itself, compiled using the Safe module so as to restrict it to arithmetic. This is always available.

The $i sequence index is in ...

The functions made available include

atan2 sin cos exp log                 \    Perl builtins
  sqrt rand                           /
min max                               List::Util (currently)
floor ceil                            POSIX module
cbrt hypot erf erfc expm1             \
  j0 j1 jn lgamma_r log10              |  Math::Libm
  log1p pow rint y0 y1 yn             /
tan asin acos atan                    \
  csc cosec sec cot cotan              |  Math::Trig
  acsc acosec asec acot acotan         |
  sinh cosh tanh                       |
  csch cosech sech coth cotanh         |
  asinh acosh atanh                    |
  acsch acosech asech acoth acotanh   /

Math-Symbolic

expression_evaluator => 'MS' selects the Math::Symbolic module, if available.

The expression should use a single variable, of any name, which will be the $i index in the sequence.

Math-Expression-Evaluator

expression_evaluator => 'MEE' selects the Math::Expression::Evaluator module, if available.

The expression should use a single input variable, of any name, which will be the $i index in the sequence. Temporary variables can be

Language-Expr

expression_evaluator => 'LE' selects the Language::Expr module. See Language::Expr::Manual::Syntax for its expression syntax, if available.

The expression should use a single variable, of any name, which will be the $i index in the sequence.

FUNCTIONS

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

$seq = Math::NumSeq::Expression->new (radix => $r, modulus => $d)

Create and return a new sequence object.

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

Return the expression evaluated at $i.

SEE ALSO

Math::NumSeq, Safe