Symbolic Algebra using Pure Perl: sums.
Operations on sums of terms.
PhilipRBrenan@yahoo.com, 2004, Perl License. PhilipRBrenan@gmail.com, 2016, Perl License. www.appaapps.com
Constructor
Variables used to sign and lock each sum that have to be declared early on
Useful constants
New from String
New from Strings
Create a sum from a list of terms.
Construct an integer
Confirm type
Get list of terms from existing sum
Count terms in sum
Get the single term from a sum containing just one term
Multiply each term in a sum by -1
Add two sums together to make a new sum
Subtract one sum from another
Multiply two sums if both sums are defined, otherwise return the defined sum. Assumes that at least one sum is defined.
Multiply two sums together
Divide one sum by another
Substitute a sum for a variable.
Check whether one sum is equal to another after multiplying out all divides and divisors.
Normalize sqrts in a sum.
This routine needs fixing.
It should simplify square roots.
Check whether one sum is equal to another after multiplying out sqrts.
Transform a sum assuming that it is equal to zero
Check that a number is a power of two
Solve an equation known to be equal to zero for a specified variable.
Raise a sum to an integer power or an integer/2 power.
Differentiate.
Simplify just before assignment.
There is no general simplification algorithm. So try various methods and see if any simplifications occur. This is cheating really, because the examples will represent these specific transformations as general features which they are not. On the other hand, Mathematics is full of specifics so I suppose its not entirely unacceptable.
Simplification cannot be done after every operation as it is inefficient, doing it as part of += ameliorates this inefficiency.
Note: += only works as a synonym for simplify() if the left hand side is currently undefined. This can be enforced by using my() as in: my $z += ($x**2+5x+6)/($x+2);
Polynomial divide - divide one polynomial (a) by another (b) in variable v
Eigenvalue check
Polynomial division.
Square root of a sum
Exponential (e raised to the power) of a sum
Log to base e of a sum
Sine of a sum
Cosine of a sum
Tan, sec, csc, cot of a sum
Hyperbolic sine of a sum
Hyperbolic cosine of a sum
Tanh, Sech, Csch, Coth of a sum
Dot - complex dot product of two complex sums
The area of the parallelogram formed by two complex sums
Intersection of a complex sum with the unit circle.
Real part of a complex sum
Imaginary part of a complex sum
Modulus of a complex sum
Conjugate of a complexs sum
Clone
Signature of a sum: used to optimize add(). # Fix the problem of adding different logs
Get the signature (see "signature") of a sum
Get Id of sum: each sum has a unique identifying number.
Check sum finalized. See: "z".
Finalize creation of the sum: Once a sum has been finalized it becomes read only.
Print sum
Factorize a number.
Export "n" with either the default name sums, or a name supplied by the caller of this package.
Overload Perl operators. Beware the low priority of ^.
Add operator.
Negate operator. Used in combination with the "add3" operator to perform subtraction.
Multiply operator.
Divide operator.
Power operator.
Equals operator.
Not equal operator.
Evaluate the expression on the left hand side, stringify it, then compare it for string equality with the string on the right hand side. This operator is useful for making examples written with Test::Simple more readable.
Solve operator.
Print operator.
Sqrt operator.
Exp operator.
Sine operator.
Cosine operator.
Tan operator.
Log operator.
Dot Product operator.
Cross operator.
Unit operator.
Modulus operator.
Conjugate.
2 POD Errors
The following errors were encountered while parsing the POD:
=pod directives shouldn't be over one line long! Ignoring all 6 lines of content
Non-ASCII character seen before =encoding in '𝗮+𝗯'. Assuming UTF-8
To install Math::Algebra::Symbols, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Algebra::Symbols
CPAN shell
perl -MCPAN -e shell install Math::Algebra::Symbols
For more information on module installation, please visit the detailed CPAN module installation guide.