convert/set
Calling Sequence
Parameters
Description
Examples
Compatibility
convert( expr, set, expected_type )
convert( expr, set, nested_op )
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
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
nested or nested=true
nested set with structure reflecting input (*)
array, matrix, vector
single-level (flattened set)
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.
convert⁡abc,set
a,b,c
A≔Array⁡3..4,−1..1,0..3,i,j,k↦j+ki:
convert⁡A,set
0,1,−13,−14,12,13,14,23,34,43
convert⁡A,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
convert⁡Array⁡,set
∅
convert⁡1|2,3|4,set
1,2,3,4
convert⁡f⁡a,b,c,set
The default behavior is to extract operands:
`~`convert⁡x2,x2+2⁢x,x2+2⁢x+1,set
2,x,x2,2⁢x,1,x2,2⁢x
By setting `+` as the expected_type, one can extract terms instead:
`~`convert⁡x2,x2+2⁢x,x2+2⁢x+1,set,`+`
x2,x2,2⁢x,1,x2,2⁢x
Now get the factors in each term:
`~`convert⁡x2,2⁢x,1,set,`*`
x2,2,x,1
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]
Download Help Document