Module variable

This module provides symbolic variables. The module is responsible for the reduction rules that perform simplification. The result can be also an integer, polynomial or fraction. The rules delegate to the polynom and fraction methods since a variable can be easily also viewed as a polynom or fraction.

Examples:
?- X is A-A.
X = 0
?- X is A*A.
X is A^2

The reduction rules are just predicates inside the variable 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 variable 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.

Kommentare