Steffen Müller >
Math-SymbolicX-Calculator-0.02 >
Math::SymbolicX::Calculator::Command

Module Version: 0.02
Math::SymbolicX::Calculator::Command - Base class for Calculator commands

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);

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.

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.

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.

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.

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).

`$sym, '==', $func`

where `$sym`

is the name of the modified symbol and `$func`

is its new value.

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.

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

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

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

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.

syntax highlighting: