Math::SymbolicX::Calculator::Command - Base class for Calculator commands


Math-SymbolicX-Calculator documentation  | view source Contained in the Math-SymbolicX-Calculator distribution.

Index


NAME

Top

Math::SymbolicX::Calculator::Command - Base class for Calculator commands

SYNOPSIS

Top

  use Math::SymbolicX::Calculator;
  my $calc = Math::SymbolicX::Calculator->new();

  # setup formula to be a Math::Symbolic tree or a transformation...

  my $assignment = $calc->new_command(
    type => 'Assignment', symbol => 'foo', object => $formula,
  );

  $calc->execute($assignment);

DESCRIPTION

Top

This class is a base class for commands to the a Math::SymbolicX::Calculator object. Various commands are implemented as subclasses. See below for a list of core Commands and their usage.

AVAILABLE COMMANDS

Top

Assignment

Math::SymbolicX::Calculator::Command::Assignment is an assignment of a formula or transformation to a symbol table slot.

Parameters to the constructor:

  symbol => the symbol name to assign to
  object => Math::Symbolic tree or
            Math::Symbolic::Custom::Transformation to assign
            to the symbol

Execution of this command returns the following list: $sym, '==', $func where $sym is the name of the modified symbol and $func is its new value.

Transformation

Math::SymbolicX::Calculator::Command::Transformation is a transformation application to a formula stored in a symbol table slot.

Parameters to the constructor:

  symbol  => the name of the symbol to modify
  trafo   => Math::Symbolic::Custom::Transformation object to apply
  shallow => boolean: Set this to true to apply shallowly or to
             false to apply recursively (default)

Execution of this command returns the following list: $sym, '==', $func where $sym is the name of the modified symbol and $func is its new value.

Insertion

Math::SymbolicX::Calculator::Command::Insertion is a replacement of all variables in a formula (in a symbol table slot) by what's found in the symbol table under the corresponding variable names.

Parameters to the constructor:

  symbol => the name of the symbol to modify
  optional:
  what   => the name of the variable to replace with its symbol
            table value or '*' for everything
            Defaults to everything.

Execution of this command returns the following list: $sym, '==', $func where $sym is the name of the modified symbol and $func is its new value.

DerivativeApplication

Math::SymbolicX::Calculator::Command::DerivativeApplication is the application of all derivatives in a function in a symbol table slot.

Parameters to the constructor:

  symbol => the name of the symbol to modify
  optional:
  level  => the number of nested derivatives to apply.
            Defaults to all/any (undef).

Execution of this command returns the following list: $sym, '==', $func where $sym is the name of the modified symbol and $func is its new value.

METHODS

Top

new

Returns a new Command object. Takes named parameters. The only universally mandatory parameter is the type of the command to create. All paramaters are passed thorugh to the constructed of the implementing subclass. That means if type is Assignment, then new will call Math::SymbolicX::Calculator::Command::Assignment-new()> with its arguments.

SEE ALSO

Top

Math::SymbolicX::Calculator, Math::SymbolicX::Calculator::Interface::Shell

Math::Symbolic, Math::Symbolic::Custom::Transformation

AUTHOR

Top

Steffen Müller, <smueller@cpan.org>

COPYRIGHT AND LICENSE

Top


Math-SymbolicX-Calculator documentation  | view source Contained in the Math-SymbolicX-Calculator distribution.