verify/RootOf
verify equality of expressions involving RootOf
Calling Sequence
Parameters
Description
Examples
verify(expr1, expr2, RootOf)
verify(expr1, expr2, 'RootOf'(ver))
expr1
-
anything
expr2
ver
verification after normalizing RootOf subexpressions
The verify(expr1, expr2, RootOf) calling sequence performs the following steps. It finds all subexpressions of expr1 and expr2 that are of the form RootOf(...), and replaces each such subexpression ro by the result of calling convert(ro, RootOf, form = index). It then compares the expressions resulting from doing this conversion on expr1 and expr2, and returns true if these results are the same, and false if they are different.
If ver is specified, then that verification is used to compare the resulting expressions, rather than simple equality testing.
This verification is symmetric if ver is not specified, or if ver is specified and it is symmetric.
Since RootOf is a Maple function, it must be enclosed in single quotes to prevent evaluation.
Suppose you want to compare two expressions involving RootOf calls that are specified with intervals. They do not compare as equal if the intervals are not specified in the same way--even if they refer to the same root. Consider the example below: this polynomial has three roots, all real and between -2 and 2.
plot⁡x3−3⁢x+1,x=−2..2
The root between 0 and 1 is the same as the root between 0.34 and 0.35. However, plain equality testing does not see that.
verify⁡2+RootOf⁡_Z3−3⁢_Z+1,0..1,2+RootOf⁡_Z3−3⁢_Z+1,0.34..0.35
false
The RootOf verification solves this problem.
verify⁡2+RootOf⁡_Z3−3⁢_Z+1,0..1,2+RootOf⁡_Z3−3⁢_Z+1,0.34..0.35,RootOf
true
We can still distinguish the two positive roots.
verify⁡2+RootOf⁡_Z3−3⁢_Z+1,0..1,2+RootOf⁡_Z3−3⁢_Z+1,1..2,RootOf
If you want to test a different verification than simple equality after normalizing the RootOf subexpressions, you can use the second calling sequence. For example, suppose we want to see whether a given expression is equivalent to either of the following RootOf calls. We can do that by using the second calling sequence and specifying member verification for ver.
accepted_answers≔RootOf⁡_Z3−3⁢_Z+1,0..1,RootOf⁡_Z3+_Z−3,1..2
to_test≔RootOf⁡_Z3−3⁢_Z+1,0.3
verify⁡to_test,accepted_answers,RootOf⁡member
Coincidentally, we can specify an equivalent verification by specifying RootOf verification as the parameter to member verification, instead of the other way around. This calling sequence is explained on the verify/member help page.
verify⁡to_test,accepted_answers,member⁡RootOf
See Also
RootOf
verify
verify/evala
verify/structured
Download Help Document