RemoveNonNumeric - Maple Help

Statistics

 SelectNonNumeric
 select non-numeric values
 RemoveNonNumeric
 remove non-numeric values

 Calling Sequence SelectNonNumeric(X, options) RemoveNonNumeric(X, options)

Parameters

 X - options - (optional) equation of the form exclude=value

Description

 • The SelectNonNumeric function selects non-numeric items from X and returns them in a new data sample. Note, that an expression X is considered non-numeric if $\mathrm{evalf}\left(X\right)$ does not return a floating-point number. Numeric items are discarded in the newly created data sample.
 • The first parameter X is a data sample - given as e.g. a Vector.
 • The RemoveNonNumeric function does the opposite of SelectNonNumeric. It removes the non-numeric values from X.

Options

 The options argument can contain one or more of the options shown below.
 • exclude=infinity, undefined, or [infinity, undefined] -- By default, undefined and infinity are considered non-numeric. This can be changed by adding infinity or undefined or both to the exclude list. Thus, exclude=undefined means that infinity should still be considered numeric but undefined should not.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $A≔\mathrm{Array}\left(\left[3,3,1,a,b,a,\mathrm{\pi },\mathrm{sin}\left(1\right),\mathrm{undefined},\mathrm{\infty }\right]\right)$
 ${A}{≔}\left[\begin{array}{cccccccccc}{3}& {3}& {1}& {a}& {b}& {a}& {\mathrm{\pi }}& {\mathrm{sin}}{}\left({1}\right)& {\mathrm{undefined}}& {\mathrm{\infty }}\end{array}\right]$ (1)
 > $\mathrm{RemoveNonNumeric}\left(A\right)$
 $\left[\begin{array}{ccccc}{3}& {3}& {1}& {\mathrm{\pi }}& {\mathrm{sin}}{}\left({1}\right)\end{array}\right]$ (2)
 > $\mathrm{SelectNonNumeric}\left(A,\mathrm{exclude}=\left[\mathrm{undefined}\right]\right)$
 $\left[\begin{array}{cccc}{a}& {b}& {a}& {\mathrm{\infty }}\end{array}\right]$ (3)
 > $\mathrm{RemoveNonNumeric}\left(A,\mathrm{exclude}=\left[\mathrm{undefined}\right]\right)$
 $\left[\begin{array}{cccccc}{3}& {3}& {1}& {\mathrm{\pi }}& {\mathrm{sin}}{}\left({1}\right)& {\mathrm{undefined}}\end{array}\right]$ (4)
 > $\mathrm{SelectNonNumeric}\left(A\right)$
 $\left[\begin{array}{ccccc}{a}& {b}& {a}& {\mathrm{undefined}}& {\mathrm{\infty }}\end{array}\right]$ (5)
 > $B≔\mathrm{Array}\left(\left[1,2,3,4,\mathrm{undefined},\mathrm{\infty }\right],\mathrm{datatype}=\mathrm{float}\left[8\right]\right)$
 ${B}{≔}\left[\begin{array}{cccccc}{1.}& {2.}& {3.}& {4.}& {Float}{}\left({\mathrm{undefined}}\right)& {Float}{}\left({\mathrm{\infty }}\right)\end{array}\right]$ (6)
 > $\mathrm{RemoveNonNumeric}\left(B\right)$
 $\left[\begin{array}{cccc}{1.}& {2.}& {3.}& {4.}\end{array}\right]$ (7)
 > $\mathrm{RemoveNonNumeric}\left(B,\mathrm{exclude}=\left[\mathrm{\infty }\right]\right)$
 $\left[\begin{array}{ccccc}{1.}& {2.}& {3.}& {4.}& {Float}{}\left({\mathrm{\infty }}\right)\end{array}\right]$ (8)