Sometimes, the derivative of a function can be simplified nicely using the definition of the function itself. For example, if $f(x) = e^{x^2}$, then $$f'(x) = 2x \cdot f(x).$$ How can I perform this simplification in Mathematica?
For example, the input
f[x_] := Exp[x^2]
g[x_] := Defer[f][x] + x
g'[x]
results in the ouput:
1 + f'[x]
Instead, I'd like it to output the following:
1 + 2x f[x]
How can I use Defer
(or a similar command) such that the evaluation of f[x]
is deferred, but f'[x]
is evaluated?