Cases2[expr, f]
returns a list of all objects in expr
with head f
.
Cases2[expr,f]
is equivalent to Cases2[{expr},f[___],Infinity]//Union
.
Cases2[expr, f, g, ...]
or Cases2[expr, {f,g, ...}]
is equivalent to Cases[{expr},f[___] | g[___] ...]
.
[f[a] + f[b]^2 + f[c, d], f] Cases2
\{f(a),f(b),f(c,d)\}
[Sin[x] Sin[y - z] + g[y], Sin, g] Cases2
\{g(y),\sin (x),\sin (y-z)\}
[Sin[x] Sin[y - z] + g[x] + g[a, b, c], {Sin, g}] Cases2
\{g(x),g(a,b,c),\sin (x),\sin (y-z)\}
[GS[p] . GS[q] + SP[p, p], Dot] Cases2
\left\{\left(\bar{\gamma }\cdot \overline{p}\right).\left(\bar{\gamma }\cdot \overline{q}\right)\right\}