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

Online Help

ExpressionTools

  

Options

  

compare two expressions and display their differences

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Options()

Options(opt_eq1, opt_eq2, ...)

Parameters

opt_eq1

-

either an option name, or an equation of the form opt=val

Description

• 

The command Options sets and recalls values of the options used as defaults by the Compare command.

• 

If Options is called with no arguments, it lists the full list of option names and their values.

• 

Otherwise, each argument to Options is expected to by either an option name, or an equation of the form opt=val, where opt is an option name and val is the value to which that option is being changed.

• 

For each argument which is an option name, an equation showing the option name and its value appears in the output.

• 

For each argument which is an equation of the form opt=val, the corresponding option opt will be assigned the value val, and this equation will be echoed back as output.

• 

The available options and their meanings and default values are as follows:

• 

verification : The verification used by Compare to determine which subexpression differences should be ignored. If the verification returns true then the difference will be ignored. The default value for this option is boolean.

• 

combine : When combine is set to false, the two inputs to Compared will be echoed back as a sequence of two expressions, with the corresponding subexpressions which differ displayed with different colors. When combine = true, the two inputs to Compare will be combined and for each pair of corresponding subexpressions which differ, a vector of two values showing those differences will be substituted in their place. Otherwise the value will be interpreted as true or false depending on whether the lengths of the expressions meet the combinethreshold as explained below. The default value for this option is default.

• 

combinethreshold : The threshold length for whether the default value of the combine option should be true or false. If the combine option is not given or set to default, then the combine option will be taken as true if and only if either input expression is at least this threshold in length. The default value for this option is 250.

• 

showvectorbrackets : This option is only effective in combined view. In that case, the vector brackets showing the boundary of the vectors displaying the combined subexpression differences will be included when showvectorbrackets = true, and not included when this option is set to false. The default value is true.

• 

showNULLoperands : This option is only effective in the combined view. In that case, when a subexpression present in one input has no corresponding subexpression present in the other, the vector showing this difference will be a one-element vector showing the single present subexpression when showNULLoperands is set to false, and instead it will be a two-element vector showing both the single present subexpression and an empty space in place of the missing subexpression when this option is set to true. The default value is false.

• 

highlight : When highlight is set to foreground (the default), the subexpressions differing between the two input expressions will have their text color changed. When highlight is set to background, the subexpressions differing between the two input expressions will have their background color changed.

• 

foregroundcolor : A list of 2 colors given to corresponding subexpressions which differ between two input expressions. These colors are used when a subexpression's foreground is highlighted as explained above. The default is [Green, Red].

• 

backgroundcolor : A list of 2 colors used to highlight corresponding subexpressions which differ between two input expressions. These colors are used when a subexpression's background color is highlighted, as explained above . The default is [LightGreen, Pink].

• 

evaluate : When evaluate is set to false (the default), the first two arguments to the Compare command will not be evaluated at all before being compared, due to use of the uneval parameter modifier. This is helpful when comparing two expressions which may have unevaluated function calls in them. One of the main use cases of the Compare command is expected to be comparing expected answers with computed answers when testing code changes. Fully evaluating both expected and evaluated answers before comparing them could hide important differences which could signify problems in the code being tested. If evaluate is set to true, then each of the first two arguments will undergo a full evaluation before comparison.

Examples

withExpressionTools

Compare,Options

(1)

With no arguments, Options() simply lists the available options and the current values:

Options

backgroundcolor : [LightGreen, Pink]

combine : default

combinethreshold : 250

evaluate : false

foregroundcolor : [Green, Red]

highlight : default

showNULLoperands : false

showvectorbrackets : true

verification : boolean

(2)

When one or more option names are given as arguments, those options will be listed with their current value:

Optionscombine,highlight,backgroundcolor

combine : default

highlight : default

backgroundcolor : [LightGreen, Pink]

(3)

When one or more equations of the form opt1=val1, opt2=val2, ... are given as arguments, the options opt1, opt2, ... will be set to the values val1, val2, ... and the resulting assignments will be echoed back:

x13b2aBAC:

x22a3bABcd:

Comparex1,x2

3b+−2aB+−1AC

2a+−3bA+−1Bcd

(4)

Optionscombinethreshold=25

combinethreshold : 25

(5)

Comparex1,x2

3−3b+−22a−1B+−1ACcd

(6)

Optionscombinethreshold=250,combine=true,highlight=background,backgroundcolor=Yellow,Orange,verification=sign

combinethreshold : 250

combine : true

highlight : background

backgroundcolor : [Yellow, Orange]

verification : sign

(7)

Comparex1,x2

3b2aBACdc

(8)

Note that options supplied to the Compare command will always override those set by the Options command:

Comparex1,x2,highlight=foreground,showvectorbrackets=false,showNULLoperands

3b2aBACdc

(9)

See Also

ExpressionTools

ExpressionTools,Compare

type/verification

verify

 


Download Help Document