Given list \(3,4,x,x^2,x^3\), find those elements of form \(x^n\) where \(n\) is anything other than \(1\).
In Maple
The above can also be written in the long form
restart; L:=[3,4,x,x^2,x^3]; map(proc(X) if patmatch(X,x^n::nonunit(anything)) then X; else NULL; fi; end proc,L) [x^2, x^3]
In Mathematica
Cases[{3, 4, x, x^2, x^3}, x^_] {x^2, x^3}