I can't figure this one out.
I need to pick out the subexpression anything*sin(3*x) from an expression.
it works, when the expression is anything*sin(3*x)+something else. But when the expression is exactly anything*sin(3*x) then select returns 1 and not anything*sin(3*x) as I was expecting.
So I must be doing something silly, but do not see it.
returns true. good. Now I test it on
and this returns what is expected. 25*A*exp(3*x) but when I type
it return 1
reading select help page did not help. Tried flatten, inplace.
I can do this using patmatch
But why is select not working in the above? What is the correct way to do this so it works for a*expr+anything and also for a*expr only? This is done inside a function and not interactive. So I need it to work for both cases, since the input can be anything, but I only need the term anything*exp(3*x) pulled out.