Math::Symbolic::Custom::Default

- NAME
- SYNOPSIS
- DESCRIPTION

- EXPORT

- SUBROUTINES

- is_integer()
- is_constant()
- is_sum()
- apply_derivatives()

- AUTHOR
- SEE ALSO

# NAME

Math::Symbolic::Custom::Default - Default tree tests and transformations

# SYNOPSIS

      use Math::Symbolic;

# DESCRIPTION

This is a class of default tests and transformations for Math::Symbolic trees. For details on how the custom method delegation model works, please have a look at the Math::Symbolic::Custom and Math::Symbolic::Custom::Base classes.

## EXPORT

Please see the docs for Math::Symbolic::Custom::Base for details, but you should not try to use the standard Exporter semantics with this class.

# SUBROUTINES

## is_integer()

is_integer() returns a boolean.

It returns true (1) if the tree is a constant object representing an integer value. It does not compute the value of the tree. (eg. '5*10' is not considered an integer, but '50' is.)

It returns false (0) otherwise.

## is_constant()

is_constant() returns a boolean.

It returns true (1) if the tree consists of only constants and operators or if it becomes a tree of only constants and operators after application of derivatives.

It returns false (0) otherwise.

## is_sum()

(beta)

is_constant() returns a boolean.

It returns true (1) if the tree contains no variables (because it can then be evaluated to a single constant which is a sum). It also returns true if it is a sum or difference of constants and variables. Furthermore, it is true for products of integers and constants because those products are really sums of variables. If none of the above cases match, it applies all derivatives and tries again.

It returns false (0) otherwise.

Please contact the author in case you encounter bugs in the specs or implementation. The heuristics aren't all that great.

## apply_derivatives()

Never modifies the tree in-place, but returns a modified copy of the original tree instead.

Applied to variabls and constants, this method just clones.

Applied to operators and if the operator is a derivative, this applies the derivative to the derivative's first operand.

Regardless what kind of operator this is called on, apply_derivatives will be applied recursively on its operands.

If the first parameter to this function is an integer, at maximum that number of derivatives are applied (from top down the tree if possible).

# AUTHOR

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

New versions of this module can be found on http://steffen-mueller.net or CPAN.

# SEE ALSO

Math::Symbolic::Custom Math::Symbolic