set - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


convert/set

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

convert( expr, set, expected_type )

convert( expr, set, nested_op )

Parameters

expr

-

expression to convert

expected_type

-

(optional) `+` or `*`

nested_op

-

(optional) equation of the form nested=true or false; whether to preserve structure of rtables and arrays

Description

• 

This command can be used to convert a variety of expressions into set form.  The precise form of the result is determined by the input and the nested_op and expected_type options.

• 

The use of the expected_type option enables the convenient extraction of terms or factors without worrying about the trivial cases. If expected_type is given and expr is not of type expected_type, expr is interpreted trivially to be of that type: a sum of one term or a product of one factor. The return value is {expr} in the trivial case.

• 

The nested_op option is only relevant if the input expr is an rtable (Matrix, Array, or Vector) or array, matrix, or vector.

Input type

nested option

Output form

rtable

nested=false

single-level (flattened) set

rtable

nested or nested=true

nested set with structure reflecting input (*)

array, matrix, vector

nested=false

single-level (flattened set)

array, matrix, vector

nested or nested=true

nested set with structure reflecting input

table

 

unordered set

string

 

set of characters (equivalent to StringTools[Explode] converted to set)

MultiSet

 

Members(expr)

other

 

{ op(expr) }

(*) If the rtable is 0-dimensional, the empty set is returned, rather than NULL.

Examples

convertabc,set

a,b,c

(1)

AArray3..4,1..1,0..3,i,j,kj+ki:

convertA,set

0,1,13,14,12,13,14,23,34,43

(2)

convertA,set,nested

0,1,13,23,0,13,13,23,1,13,23,43,0,14,12,14,0,12,14,34,1,12,14,34

(3)

convertArray,set

(4)

convert1|2,3|4,set

1,2,3,4

(5)

convertfa,b,c,set

a,b,c

(6)

The default behavior is to extract operands:

`~`convertx2,x2+2x,x2+2x+1,set

2,x,x2,2x,1,x2,2x

(7)

By setting `+` as the expected_type, one can extract terms instead:

`~`convertx2,x2+2x,x2+2x+1,set,`+`

x2,x2,2x,1,x2,2x

(8)

Now get the factors in each term:

`~`convertx2,2x,1,set,`*`

x2,2,x,1

(9)

Compatibility

• 

The nested_op parameter was introduced in Maple 16.

• 

For more information on Maple 16 changes, see Updates in Maple 16.

• 

The convert/set command was updated in Maple 2021.

• 

The expected_type parameter was introduced in Maple 2021.

• 

For more information on Maple 2021 changes, see Updates in Maple 2021.

See Also

convert

convert/list

StringTools[Explode]