Module polynom

This module provides symbolic polynomials. The module is responsible for the reduction rules that perform simplification. The result can be also an integer, rational or fraction. In case that some extra arguments is a fraction, the rules delegate to the fraction methods since a polynom can be easily also viewed as a fraction. In case some extra argument is an integer or rational, this argument is viewed as a polynom.

Examples:
?- X is (1+A)^2.
X is 1+2*A+A^2
?- X is (1+A)/(1+A)^2.
X is 1/(1+A)

The reduction rules are just predicates inside the polynom module with a Python first argument for the method receiver. We provide reduction rules for basic arithmetic. Special functions are currently not supported. Error handling is rudimentary.

The following symbolic polynomials predicates are defined:

-(P, Q):
The predicate succeeds in Q with the P negated.
+(P, Q, R):
The predicate succeeds in R with the sum of P and Q.
-(P, Q, R):
The predicate succeeds in R with P subtracted by Q.
*(P, Q, R):
The predicate succeeds in R with the product of P and Q.
/(P, Q, R):
The predicate succeeds in R with P divided by Q.
^(P, Q, R):
The predicate succeeds in R with P raised by Q.