DataSeries/select
selection from a DataSeries
DataSeries/remove
removal from a DataSeries
DataSeries/selectremove
selection and removal from a DataSeries
Calling Sequence
Parameters
Description
Examples
Compatibility
select(f, DS, b1, ..., bn)
select[inplace](f, DS, b1, ..., bn)
remove(f, DS, b1, ..., bn)
remove[inplace](f, DS, b1, ..., bn)
selectremove(f, DS, b1, ..., bn)
selectremove[inplace](f, DS, b1, ..., bn)
f
-
Boolean-valued procedure
DS
a DataSeries object
b1, ..., bn
(optional) extra arguments for f
When called on a DataSeries object, the select command returns a DataSeries object consisting of those entries that satisfy the given criterion.
When called on a DataSeries object, the remove command returns a DataSeries object consisting of those entries that do not satisfy the given criterion.
When called on a DataSeries object, the selectremove command returns a sequence of two DataSeries objects, the first consisting of those entries that satisfy the given criterion and the second consisting of those entries that don't satisfy the given criterion.
The commands can also be called on other types of arguments. This behavior is described on the main help page for select.
The criterion used for deciding whether an entry x of the DataSeries is included in the result is to call f⁡x,b1,...,bn. This should return true or false (or FAIL, which is interpreted in the same way as false). If you call select, then the returned DataSeries will contain x if and only if the value returned is true. If you call remove, then the returned DataSeries will contain x if and only if the value returned is false (or FAIL).
Any entry that is included in the result will have the same label that it has in DS.
If you call select[inplace] or remove[inplace], the command will modify the DataSeries object DS and return it. The calling sequences with no index on the command name will return a new DataSeries object and leave DS unchanged. If you call selectremove[inplace], then the command will modify DS to be the first DataSeries returned, and the second DataSeries will be a new DataSeries object.
You can do similar things with DataSeries indexing using a Boolean DataSeries. See the examples below.
We split ds, below, into prime and non-prime entries in various ways, using the isprime command as the testing criterion.
ds≔DataSeries⁡5,6,7,8,9,labels=a,b,c,d,e
ds≔a5b6c7d8e9
select⁡isprime,ds
a5c7
remove⁡isprime,ds
b6d8e9
selectremove⁡isprime,ds
a5c7,b6d8e9
The same results can be obtained using indexing with a Boolean DataSeries.
ds`~`isprime⁡ds
dsnot`~`isprime⁡ds
If we want to select the entries of a particular type, then we can use the optional third argument to select.
select⁡type,ds,even
b6d8
The original DataSeries, ds, is unchanged, because we used the commands without the inplace index.
ds
a5b6c7d8e9
If we call select with the inplace index, then ds is modified in-place.
selectinplace⁡isprime,ds
The DataSeries/select, DataSeries/remove and DataSeries/selectremove commands were introduced in Maple 2019.
For more information on Maple 2019 changes, see Updates in Maple 2019.
See Also
DataSeries
DataSeries/Constructor
main help page for select
Download Help Document