Question: How to evaluate a derivative at a specific function value.

Say I have an expression like

diff(f(x),x)*cos(f(x));

and I want to evaluate it where the function f(x)=0 (without a priori knowing f(x)). Since cos(0)=1, I expect the answer to be simply diff(f(x),x); in general this won't be identically zero. However, if I try

eval(%,f(x)=0);

it replaces f(x) with zero everywhere, including in the derivative (as expected from the documentation) and returns 0.

So, my question: is there a way to evaluate an expression at a known value of a function (f(x)=0) without knowing the function?

It seems using convert/D manages to solve it, but I imagine there's a better way to do this. I've tried using RootOf(f(x)), but can't seem to make that work.

Please Wait...