selection from an expression
removal from an expression
selection or removal from an expression
select(f, e, b1, ..., bn)
select[flatten](f, e, b1, ..., bn)
remove(f, e, b1, ..., bn)
remove[flatten](f, e, b1, ..., bn)
selectremove(f, e, b1, ..., bn)
selectremove[flatten](f, e, b1, ..., bn)
b1, ..., bn
(optional) extra arguments
The select function selects the operands of the expression e which satisfy the Boolean-valued procedure f, and creates a new object of the same type as e. Those operands for which f does not return true are discarded in the newly created object.
When e is an ordered expression, such as a list or unevaluated function call, the operands of the output retain their relative order. If the expression e is an expression of type ^ and the result consists only of an exponent with a null base, then the output is undefined.
The remove function does the opposite of select. It removes the operands of e which satisfy f and creates a new object.
The selectremove function behaves in the same manner as select(..) and remove(..), except that the result is computed efficiently, in a single pass over expression e.
Additional arguments b1, ..., bn are passed to f.
When e is an Array, Matrix, or Vector, the select[flatten] form can be used. This will cause the result to be flattened to a one-dimensional structure with all discarded elements removed (as opposed to having the discarded elements replaced with NULL).
A typical application that uses select and remove is to split the factors of a product, e, into those which depend on a variable x and those which do not (that is, constants). This can be accomplished by using v := select(has,e,x); followed by c ≔ remove⁡has,e,x. It is more efficient, however, to use v,c ≔ selectremove⁡has,e,x. Do not try to compute c ≔ ev. Because of the way Maple simplifies expressions, factors do not cancel out in general. See the last example below.
The select, remove and selectremove commands are thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
integers ≔ `$`⁡10..20
integers ≔ 10,11,12,13,14,15,16,17,18,19,20
f ≔ 2⁢ⅇa⁢x⁢sin⁡x⁢ln⁡y
f ≔ yx
f ≔ indets⁡f
f ≔ x,y,yx
f ≔ 2⁢ln⁡x⁢y+1
c ≔ remove⁡has,f,x
c ≔ 2⁢y+2
The following example selects any entries of a matrix matching a certain criteria, showing NULL for any entries that do not match. To see an example of removing any rows or columns that do not match a given criteria, see the Working with Subsections of Data - Extracting Data section in the LA_syntax_shortcuts page.
The flatten option was introduced in Maple 17.
For more information on Maple 17 changes, see Updates in Maple 17.
Download Help Document