Given \(3 \,{\mathrm e}^{x}+\sin \left (a \,{\mathrm e}^{x}\right ) f\left ({\mathrm e}^{5 x}\right )\) how to find all terms with pattern anything*exp ? If we do this
expr:=3*exp(x)+sin(a*exp(x))*f(exp(5*x)); indets(expr,`&*`(anything,'specfunc(exp)')); # {a*exp(x), 3*exp(x)}
We see it did not find exp(5*x) this is because there is nothing multiplying the exp
function. To find this we add Or like this to count for both cases
expr:=3*exp(x)+sin(a*exp(x))*f(exp(5*x)); indets[flat](expr,Or( `&*`(anything,'specfunc(exp)'), 'specfunc(exp)' )) # {a*exp(x), 3*exp(x), exp(5*x)}
The flat option is needed, as without it this will be the result