I have an expression and I want to select the part of the expression which has diff(y(x),x) in the expression.
Using select(has,expr,diff(y(x),x) works, except when the expression happend to be exactly diff(y(x),x) in this case select returns diff()
I understand why this happens. But I can not avoid this problem by say first checking if the expression has more than one operand, because nops(diff(y(x),x) is 2 and not one. Also 1+diff(y(x),x) has two operands. And I can not check if the expression is of type `+` or `*` before, because other types can have more than one operand also.
So now what I do is the folliwng: first check if the expression has diff(y(x),x). If so, convert the expression to D and now check if nops is more than one, and if so, only now call select.
This is becuase nops(D(y)(x)) is one, while nops(diff(y(x),x) is two.
Is there a better way to do this, in order to avoid calling select and getting diff() ? I suppose I could also just check if the expression is exactly diff(y(x),x) before even calling select or has and avoid all this?