verify/plot
verify approximate equality between two plots
Calling Sequence
Parameters
Description
Examples
verify(P, Q, plot)
verify(P, Q, 'plot'(opts))
P, Q
-
anything, assumed to be PLOT data structures
opts
equation(s) of the form option=value where option is one of curves, display, display_floats, feature_floats, features, points, polygons, text, or traversal; specify options for the comparison
The verify(P, Q, plot) and verify(P, Q, 'plot'(opts)) calling sequences return true if the two PLOT data structures compare using the default comparator.
The default comparator determines that two PLOT data structures are equal if:
Given two functions, they must have the same name, the same number of arguments, and their arguments must each compare using the default comparator
Given either two lists or Arrays, their corresponding entries must be equal
Given two ranges, their endpoints must be compare using the default comparator
By default, two floating-point numbers are equal if their difference is 0
All other objects are compared by using evalb
If either P or Q is not a PLOT data structure then false is returned.
The data structures within a plot object are separated into two classes, display objects, and feature objects. The data structures, which fall into the first class are CURVES, POINTS, POLYGONS, TEXT, and VIEW. All other data structures are considered to be feature data structures.
At each stage, display and feature objects are compared separately, and any features are always compared using the default comparator with any options, which may be given by the features option.
The opts argument can contain one or more of the following equations that set unit options.
curves = verification
If this option is given, the set of all CURVES objects are compared using this verification.
Two common verifications for this purpose may be function_bounds and function_shells.
display = truefalse
By default, the display objects of a plot are compared. This can be turned off by setting this option to false.
display_floats = non-negative or verification
Given two display objects, the default comparator compares floating-point numbers by testing if their difference is 0. If this option is set to a non-negative number, then floats are compared by checking that their difference is less than or equal to the given non-negative number. If this option is any other verification, then two floating-point numbers are compared using this verification.
Common verifications may be float(10) or perhaps neighborhood.
feature_floats = non-negative or verification
Given two feature objects, the default comparator compares floating-point numbers by testing if their difference is 0. If this option is set to a non-negative number, then floats are compared by checking that their difference is less than or equal to the given non-negative number. If this option is any other verification, then two floating-point numbers are compared using this verification.
The feature_floats is different from display_floats as the latter may contain floating-point numbers of arbitrary magnitude, whereas floating-point numbers in features are often much more bounded, for example, color values.
features = truefalse
By default, the feature objects of a plot are compared. This can be turned off by setting this option to false.
points = verification
If this option is given, the set of all POINTS objects are compared using this verification.
polygons = verification
If this option is given, the set of all POLYGONS objects are compared using this verification. Otherwise the default comparator are used to compare POLYGONS objects.
text = verification
If this option is given, the set of all TEXT objects are compared using this verification.
traversal = ordered, unordered, or one_to_one
By default, this option is set to ordered, in which case objects are compared in the same order in both plots. If this option is set to unordered, then it is only necessary that a match be found for each object in the other PLOT data structure. If this option is set to one_to_one, then a one-to-one correspondence must be found between data structures in both objects.
The option one_to_one is significantly more expensive than either other test. The option ordered is the least expensive, but is subject to ordering problems, which affect the structure, but not the final plot.
P≔plot⁡sin⁡x,x=0..1,numpoints=10,adaptive=false:
Q≔plot⁡sin⁡x,x=0..1,numpoints=37,adaptive=false:
R≔plot⁡sin⁡x,x=0..1,numpoints=37,adaptive=false,color=blue:
verify⁡P,Q,plot⁡curves=function_bounds
true
verify⁡P,Q,plot⁡curves=function_shells⁡0.1
verify⁡Q,R,plot⁡features=false
Compare two plots ignoring minor differences
Digits≔20:
P≔plot⁡BesselJ⁡2,x,x=0..10:
Digits≔10:
Q≔plot⁡BesselJ⁡2,x,x=0..10:
verify⁡P,Q,plot⁡display_floats=float⁡1,digits=5
verify⁡P,Q,plot⁡display_floats=0.001
Compare a plot and a PLOT data structure
P≔plot⁡2⁢x+3,x=0..5,numpoints=3,adaptive=false:
Q≔INTERFACE_PLOT⁡CURVES⁡0.,3.,2.61565849999999989,8.23131700000000066,5.,13.,COLOUR⁡RGB,1.0,0.,0.,AXESLABELS⁡x,,VIEW⁡0...5.,DEFAULT:
verify⁡P,Q,plot⁡display_floats=0.0001
false
See Also
plot
plot,structure
verify
verify,function_bounds
verify,function_shells
Download Help Document