convert/set - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Conversion : convert/set

convert/set

 Calling Sequence convert( expr, set, nested_op )

Parameters

 expr - expression to convert nested_op - (optional) option 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 option.
 • 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

 > $\mathrm{convert}\left("abc",\mathrm{set}\right)$
 $\left\{{"a"}{,}{"b"}{,}{"c"}\right\}$ (1)
 > $A≔\mathrm{Array}\left(3..4,-1..1,0..3,\left(i,j,k\right)↦\frac{j+k}{i}\right):$
 > $\mathrm{convert}\left(A,\mathrm{set}\right)$
 $\left\{{0}{,}{1}{,}{-}\frac{{1}}{{3}}{,}{-}\frac{{1}}{{4}}{,}\frac{{1}}{{2}}{,}\frac{{1}}{{3}}{,}\frac{{1}}{{4}}{,}\frac{{2}}{{3}}{,}\frac{{3}}{{4}}{,}\frac{{4}}{{3}}\right\}$ (2)
 > $\mathrm{convert}\left(A,\mathrm{set},\mathrm{nested}\right)$
 $\left\{\left\{\left\{{0}{,}{1}{,}\frac{{1}}{{3}}{,}\frac{{2}}{{3}}\right\}{,}\left\{{0}{,}{-}\frac{{1}}{{3}}{,}\frac{{1}}{{3}}{,}\frac{{2}}{{3}}\right\}{,}\left\{{1}{,}\frac{{1}}{{3}}{,}\frac{{2}}{{3}}{,}\frac{{4}}{{3}}\right\}\right\}{,}\left\{\left\{{0}{,}{-}\frac{{1}}{{4}}{,}\frac{{1}}{{2}}{,}\frac{{1}}{{4}}\right\}{,}\left\{{0}{,}\frac{{1}}{{2}}{,}\frac{{1}}{{4}}{,}\frac{{3}}{{4}}\right\}{,}\left\{{1}{,}\frac{{1}}{{2}}{,}\frac{{1}}{{4}}{,}\frac{{3}}{{4}}\right\}\right\}\right\}$ (3)
 > $\mathrm{convert}\left(\mathrm{Array}\left(\right),\mathrm{set}\right)$
 ${\varnothing }$ (4)
 > $\mathrm{convert}\left(⟨⟨1|2⟩,⟨3|4⟩⟩,\mathrm{set}\right)$
 $\left\{{1}{,}{2}{,}{3}{,}{4}\right\}$ (5)
 > $\mathrm{convert}\left(f\left(a,b,c\right),\mathrm{set}\right)$
 $\left\{{a}{,}{b}{,}{c}\right\}$ (6)

Compatibility

 • The nested_op parameter was introduced in Maple 16.