The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Math::Symbolic::Constant - Constants in symbolic calculations

SYNOPSIS

  use Math::Symbolic::Constant;
  my $const = Math::Symbolic::Constant->new(25);
  my $zero  = Math::Symbolic::Constant->zero();
  my $one   = Math::Symbolic::Constant->one();
  my $euler = Math::Symbolic::Constant->euler();
  # e = 2.718281828...

DESCRIPTION

This module implements numeric constants for Math::Symbolic trees.

EXPORT

None by default.

METHODS

Constructor new

Takes hash reference of key-value pairs as argument. Special case: a value for the constant instead of the hash. Returns a Math::Symbolic::Constant.

Constructor zero

Arguments are treated as key-value pairs of object attributes. Returns a Math::Symbolic::Constant with value of 0.

Constructor one

Arguments are treated as key-value pairs of object attributes. Returns a Math::Symbolic::Constant with value of 1.

Constructor euler

Arguments are treated as key-value pairs of object attributes. Returns a Math::Symbolic::Constant with value of e, the Euler number. The object has its 'special' attribute set to 'euler'.

Method value

Optional argument: sets the object's value. Returns the object's value.

Method special

Optional argument: sets the object's special attribute. Returns the object's special attribute.

Method to_string

Returns a string representation of the constant.

Method term_type

Returns the type of the term. (T_CONSTANT)

AUTHOR

Steffen Mueller, <symbolic-module at steffen-mueller dot net>

SEE ALSO

Math::Symbolic