InertForm - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Evaluation : Preventing Evaluation : InertForm Package : InertForm/SameStructure

InertForm

  

SameStructure

  

compare the value and structure of expressions

 

Calling Sequence

Parameters

Description

Package Usage

Examples

Compatibility

Calling Sequence

SameStructure( a, b )

Parameters

a

-

anything

b

-

anything

Description

• 

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.  

Package Usage

• 

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](..).

Examples

withInertForm:

Equivalent fractions that are not reduced the same way return false.

SameStructure`%/`2,4,12

false

(1)

Order of terms is not strict.

SameStructure`%+`2,4,`%+`4,2

true

(2)

SameStructure`%*`2,4,`%*`4,2

true

(3)

SameStructure`%*`2,`%*`4,6,`%*``%*`4,6,2

true

(4)

SameStructure`%*`6,`%*`4,2,`%*``%*`4,6,2

true

(5)

Factored versus expanded matters.

SameStructurex+1y+2,xy+2x+y+2

false

(6)

SameStructurex+5x+3,x2+8x+15

false

(7)

Separated multiplicative factors of -1 or 1 do not matter.

SameStructure1`%+`y,2,y2

true

(8)

SameStructure1`%/`y,2,y2

true

(9)

SameStructure1`%+`y,2,y+2

true

(10)

SameStructure`%+`x,1,`%+`x,1

true

(11)

Inert versions of function calls match non-inert equivalents.

SameStructure%sinx,sinx

true

(12)

Evaluation is not done on inert function calls.

SameStructure%intx,x,x22

false

(13)

An expression to the -1 power matches division.

SameStructure`%^`y,1,`%/`1,y

true

(14)

The order of right-side and left-side matters for equations.

SameStructurey=1x,y=1x

true

(15)

SameStructure1x=y,y=1x

false

(16)

SameStructurex+y=1,y=1x

false

(17)

Compatibility

• 

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