InertForm
SameStructure
compare the value and structure of expressions
Calling Sequence
Parameters
Description
Package Usage
Examples
Compatibility
SameStructure( a, b )
a
-
anything
b
The SameStructure command accepts two expressions, inert or otherwise, and compares their structure. If they are the same in value and structure then this command returns true, otherwise false.
Structural equivalence is determined by replacing all numeric constants in both a and b with variables and ensuring that the resulting expressions are equal using Maple's default data-structure normalization. Replacing constants removes the influence of most automatic simplifications like integer arithmetic and fraction reduction.
This function is part of the InertForm package, so it can be used in the short form SameStructure(..) only after executing the command with(InertForm). However, it can always be accessed through the long form of the command by using InertForm[SameStructure](..).
with⁡InertForm:
Equivalent fractions that are not reduced the same way return false.
SameStructure⁡`%/`⁡2,4,12
false
Order of terms is not strict.
SameStructure⁡`%+`⁡2,4,`%+`⁡4,2
true
SameStructure⁡`%*`⁡2,4,`%*`⁡4,2
SameStructure⁡`%*`⁡2,`%*`⁡4,6,`%*`⁡`%*`⁡4,6,2
SameStructure⁡`%*`⁡6,`%*`⁡4,2,`%*`⁡`%*`⁡4,6,2
Factored versus expanded matters.
SameStructure⁡x+1⁢y+2,x⁢y+2⁢x+y+2
SameStructure⁡x+5⁢x+3,x2+8⁢x+15
Separated multiplicative factors of -1 or 1 do not matter.
SameStructure⁡−1⁢`%+`⁡y,2,−y−2
SameStructure⁡−1⁢`%/`⁡y,2,−y2
SameStructure⁡1⁢`%+`⁡y,2,y+2
SameStructure⁡`%+`⁡`-`⁡x,1,−`%+`⁡x,`-`⁡1
Inert versions of function calls match non-inert equivalents.
SameStructure⁡%sin⁡x,sin⁡x
Evaluation is not done on inert function calls.
SameStructure⁡%int⁡x,x,x22
An expression to the -1 power matches division.
SameStructure⁡`%^`⁡y,`-`⁡1,`%/`⁡1,y
The order of right-side and left-side matters for equations.
SameStructure⁡y=1−x,y=1−x
SameStructure⁡1−x=y,y=1−x
SameStructure⁡x+y=1,y=1−x
The InertForm[SameStructure] command was introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
See Also
Grading:-Quiz
InertForm:-Display
parse
ProgrammingGuide/MapleExpressions
Student:-Basics:-PracticeSheet
Download Help Document