Symbolic Algebra in Pure Perl: terms.
A term represents a product of: variables, coefficents, divisors, square roots,
exponentials, and logs.
PhilipRBrenan@yahoo.com, 2004, Perl License. PhilipRBrenan@gmail.com, 2016, Perl
Sign and lock terms
New from String
Short name for "newFromString"
New from Strings
Greatest Common Divisor.
Least common multiple.
Multiply term by integer
Divide term by integer
Not Minus One?
Get/Set i - sqrt(-1)
i by power: multiply a term by a power of i
Get/Set divide by.
Get/Set square root.
Remove square root.
# Get/Set log
Get/Set variable power.
On get: returns the power of a variable, or zero if the variable is not present
in the term.
On set: Sets the power of a variable. If the power is zero, removes the variable
from the term. =cut
Get all variables mentioned in the term. Variables to power zero should have
been removed by "vp".
Clone a term. The existing term must be finalized, see "z": the new
term will not be finalized, allowing modifications to be made to it.
Split a term into its components
Sign the term. Used to optimize addition. Fix the problem of adding different
Get the signature of a term
Add two finalized terms, return result in new term or undef.
Subtract two finalized terms, return result in new term or undef.
Multiply two finalized terms, return the result in a new term or undef
Divide two finalized terms, return the result in a new term or undef
Invert a term
Take power of term
Square root of a term
Exponential of a term
Sine of a term
Cosine of a term
Log of a term
Get Id of a term
# Check term finalized
Finalize creation of the term. Once a term has been finalized, it becomes
readonly, which allows optimization to be performed.
Export "newFromStrings" to calling package with a name specifed by the
caller, or as term()
by default. =cut
Square root operator.