verify/plot - Maple Programming Help

Home : Support : Online Help : Programming : Logic : Boolean : verify : verify/plot

verify/plot

verify approximate equality between two plots

 Calling Sequence verify(P, Q, plot) verify(P, Q, 'plot'(opts))

Parameters

 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

Description

 • 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:
 1 Given two functions, they must have the same name, the same number of arguments, and their arguments must each compare using the default comparator
 2 Given either two lists or Arrays, their corresponding entries must be equal
 3 Given two ranges, their endpoints must be compare using the default comparator
 4 By default, two floating-point numbers are equal if their difference is $0$
 5 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.
 Common verifications may be float(10) or perhaps neighborhood.
 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.

Examples

 > $P≔\mathrm{plot}\left(\mathrm{sin}\left(x\right),x=0..1,\mathrm{numpoints}=10,\mathrm{adaptive}=\mathrm{false}\right):$
 > $Q≔\mathrm{plot}\left(\mathrm{sin}\left(x\right),x=0..1,\mathrm{numpoints}=37,\mathrm{adaptive}=\mathrm{false}\right):$
 > $R≔\mathrm{plot}\left(\mathrm{sin}\left(x\right),x=0..1,\mathrm{numpoints}=37,\mathrm{adaptive}=\mathrm{false},\mathrm{color}=\mathrm{blue}\right):$
 > $\mathrm{verify}\left(P,Q,'\mathrm{plot}\left(\mathrm{curves}=\mathrm{function_bounds}\right)'\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{verify}\left(P,Q,'\mathrm{plot}\left(\mathrm{curves}=\mathrm{function_shells}\left(0.1\right)\right)'\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{verify}\left(Q,R,'\mathrm{plot}\left(\mathrm{features}=\mathrm{false}\right)'\right)$
 ${\mathrm{true}}$ (3)

Compare two plots ignoring minor differences

 > $\mathrm{Digits}≔20:$
 > $P≔\mathrm{plot}\left(\mathrm{BesselJ}\left(2,x\right),x=0..10\right):$
 > $\mathrm{Digits}≔10:$
 > $Q≔\mathrm{plot}\left(\mathrm{BesselJ}\left(2,x\right),x=0..10\right):$
 > $\mathrm{verify}\left(P,Q,'\mathrm{plot}\left(\mathrm{display_floats}=\mathrm{float}\left(1,\mathrm{digits}=5\right)\right)'\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{verify}\left(P,Q,'\mathrm{plot}\left(\mathrm{display_floats}=0.001\right)'\right)$
 ${\mathrm{true}}$ (5)

Compare a plot and a PLOT data structure

 > $P≔\mathrm{plot}\left(2x+3,x=0..5,\mathrm{numpoints}=3,\mathrm{adaptive}=\mathrm{false}\right):$
 > $Q≔\mathrm{PLOT}\left(\mathrm{CURVES}\left(\left[\left[0.,3.\right],\left[2.61565849999999989,8.23131700000000066\right],\left[5.,13.\right]\right],\mathrm{COLOUR}\left(\mathrm{RGB},1.0,0.,0.\right)\right),\mathrm{AXESLABELS}\left("x",""\right),\mathrm{VIEW}\left(0...5.,\mathrm{DEFAULT}\right)\right):$
 > $\mathrm{verify}\left(P,Q,'\mathrm{plot}\left(\mathrm{display_floats}=0.0001\right)'\right)$
 ${\mathrm{false}}$ (6)