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

NAME

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

SYNOPSIS

  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

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

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

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

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

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

AUTHOR

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

COPYRIGHT AND LICENSE

Copyright (C) 2006, 2013 by Steffen Müller

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6 or, at your option, any later version of Perl 5 you may have available.