# Replace higher order derivatives given lower order derivative

I have an unknown function f[x1,x2] whose partial with respect to x1 is identically zero. I would like to make sure that whenever D[f[x1,x2],{x1,2}] shows up, for instance, it is evaluated to zero. How might I do this? Right now I have

conds = { Derivative[1,_][f][x1,x2] -> 0 };
D[f[x1, x2], x1, x2] /. conds // Simplify (* which equals zero, as I would like *)
D[f[x1, x2], {x1, 2}] /. conds // Simplify (* which is nonzero *)

• Try D[f[x1, x2], {x1, 2}] /. Derivative[k_Integer?Positive, _][f][__] :> 0 and report back. – J. M. will be back soon May 19 '16 at 3:47
• This works exactly as I would like. Thank you. – Jeremy Upsal May 20 '16 at 21:59

D[f[x1, x2], {x1, 2}] /. Derivative[k_Integer?Positive, _][f][__] :> 0