apply_derivatives()
Never modifies the tree in-place, but returns a modified copy of the original tree instead.
Applied to variables 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).
apply_constant_fold()
Does not modify the tree in-place by default, but returns a modified copy of the original tree instead.
If the first argument is true, the tree will not be cloned. If it is false or not existant, the tree will
be cloned.
Applied to variables and constants, this method just clones.
Applied to operators, all tree segments that contain constants and operators only will be replaced with
Constant objects.
mod_add_constant
Given a constant (object or number) as argument, this method tries hard to fold it into an existing
constant of the object this is called on is already a sum or a difference.
Basically, this is the same as "$tree + $constant" but does some simplification.
mod_multiply_constant
Given a constant (object or number) as argument, this method tries hard to fold it into an existing
constant of the object this is called on is already a product or a division.
Basically, this is the same as "$tree * $constant" but does some simplification.