When I have a complicated expression that depends on some variable, say, $f$, the following usually works ok:
Expression ./ { f-> x^2 }
But if $f$ is a function f[x,y], and Expression has not only terms like f[x,y] but also D[ f[x,y], x] (in markup they show up as f^{(1,0)}[x,y]), the above substitution would leave the derivatives unaffected
Is there a smarter way to do expression replacement that does the expected behavior with derivatives of the replaced expression?
Derivative[1, 0][f][x, y] + f[x, y] /. f -> (#^2 &)? – Kuba Dec 13 '15 at 15:43Sum[Nest[#.{p, q} &, D[f[x, y], {{x, y}, k}], k], {k, 0, 2}] /. f -> (Sin[#1 + Sin[#2]] &). – J. M.'s missing motivation Dec 13 '15 at 15:44dChange[ Derivative[1, 0][f][x, y] + f[x, y], f[x, y] == x^2 ]from 80241 – Kuba Dec 13 '15 at 15:46