testeq - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

testeq

random polynomial-time equivalence tester

 Calling Sequence testeq(a = b) testeq(a, b) testeq(a)

Parameters

 a, b - algebraic expressions

Description

 • The function testeq tests for equivalence probabilistically. It returns false if the expressions are not equal (or not equal to 0) and true otherwise for the class of expressions that testeq recognizes.  The result false is always correct; the result true may be incorrect with very low probability.
 • This function will succeed over expressions formed with rational constants, independent variables, and I, combined by arithmetic operations, exponentials, trigonometrics and a few others. It may also succeed with some expressions involving algebraic constants and functions and involving Pi as an argument of trigonometrics. If the expressions do not fall in this class, testeq returns FAIL.  testeq may also return FAIL if it cannot find an appropriate modulus that works after seven trials.

Examples

 > $a≔\left({\mathrm{sin}\left(x\right)}^{2}-\mathrm{cos}\left(x\right)\mathrm{tan}\left(x\right)\right){\left({\mathrm{sin}\left(x\right)}^{2}+\mathrm{cos}\left(x\right)\mathrm{tan}\left(x\right)\right)}^{2}:$
 > $b≔\frac{1}{4}{\mathrm{sin}\left(2x\right)}^{2}-\frac{1}{2}\mathrm{sin}\left(2x\right)\mathrm{cos}\left(x\right)-2{\mathrm{cos}\left(x\right)}^{2}+\frac{1}{2}\mathrm{sin}\left(2x\right){\mathrm{cos}\left(x\right)}^{3}+3{\mathrm{cos}\left(x\right)}^{4}-{\mathrm{cos}\left(x\right)}^{6}:$
 > $\mathrm{evalb}\left(a=b\right)$
 ${\mathrm{false}}$ (1)
 > $\mathrm{evalb}\left(\mathrm{expand}\left(a\right)=\mathrm{expand}\left(b\right)\right)$
 ${\mathrm{false}}$ (2)
 > $\mathrm{testeq}\left(a=b\right)$
 ${\mathrm{true}}$ (3)

References

 Gonnet, Gaston. "Determining Equivalence of Expressions in Random Polynomial Time." Proceedings of the 16th ACM Symposium on the Theory of Computing. Washington DC. April 1984. pp. 334-341.