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

Online Help

All Products    Maple    MapleSim


__and__

intersection of sets

__or__

union of sets

__xor__

symmetric difference of sets

__sub__

set difference

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

x.__and__(y)

x and y

x.__or__(y)

x or y

x.__xor__(y)

x ^ y

x.__sub__(y)

x - y

Parameters

x

-

Set object

y

-

Set object

Description

• 

__and__ function returns the intersection of the Sets x and y. This can be done equivalently with x and y.

• 

__or__ function returns the union of the Sets x and y. This can be done equivalently with x or y.

• 

__xor__ function returns the symmetric difference of the Sets x and y. This can be done equivalently with x ^ y.

• 

__sub__ function returns the set difference of the Sets  x and y. This can be done equivalently with x - y.

Examples

The following interactive session illustrates the use of these operators:

>>> import maple

>>> import maple.namespace

>>> S1 = maple.execute('{3,4,5};')

>>> S2 = maple.execute('{3,4,sqrt(2)};')

>>> S1 and S2

{3,4}

>>> S1 or S2

{3,4,5,sqrt(2)}

>>> S1 ^ S2

{5,sqrt(2)}

>>> S1 - S2

{5}

>>> S2 - S1

{sqrt(2)}

See Also

OpenMaple

OpenMaple/Python/API

OpenMaple/Python/Expression

OpenMaple/Python/Set