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

Online Help

All Products    Maple    MapleSim


verify/RootOf

verify equality of expressions involving RootOf

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

verify(expr1, expr2, RootOf)

verify(expr1, expr2, 'RootOf'(ver))

Parameters

expr1

-

anything

expr2

-

anything

ver

-

verification after normalizing RootOf subexpressions

Description

• 

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.

Examples

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.

plotx33x+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.

verify2+RootOf_Z33_Z+1,0..1,2+RootOf_Z33_Z+1,0.34..0.35

false

(1)

The RootOf verification solves this problem.

verify2+RootOf_Z33_Z+1,0..1,2+RootOf_Z33_Z+1,0.34..0.35,RootOf

true

(2)

We can still distinguish the two positive roots.

verify2+RootOf_Z33_Z+1,0..1,2+RootOf_Z33_Z+1,1..2,RootOf

false

(3)

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_answersRootOf_Z33_Z+1,0..1,RootOf_Z3+_Z3,1..2

accepted_answersRootOf_Z33_Z+1,0..1,RootOf_Z3+_Z3,1..2

(4)

to_testRootOf_Z33_Z+1,0.3

to_testRootOf_Z33_Z+1,0.3

(5)

verifyto_test,accepted_answers,RootOfmember

true

(6)

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.

verifyto_test,accepted_answers,memberRootOf

true

(7)

See Also

RootOf

verify

verify/evala

verify/structured