I'm new to Mathematica and I have a question about modifying derivative expressions. I have two mathematical conditions
$$ \displaystyle \frac{\partial g}{\partial y} = -\frac{\partial f}{\partial x}$$
$$ \displaystyle \frac{\partial f}{\partial y} = \frac{\partial g}{\partial x}$$
Given any derivative
$$ \displaystyle \frac{\partial^{n+m} f}{\partial x^n \partial y^m} $$
How can I make the substitutions above programmatically?
I tried the following
ruleA = Derivative[dx_, dy_][g][x, y] -> -Derivative[dx + 1, dy - 1][f][x, y];
ruleB = Derivative[dx_, dy_][f][x, y] -> Derivative[dx + 1, dy - 1][g][x, y];
myRules = Dispatch[{ruleA,ruleB}];
then apply the rule to an expression using the /.
notation. It works, but I get negative derivatives. Also, it looks like it only applies the rules once. So this doesn't achieve what I'm looking for, but not having an experience with Mathematica, I'm not sure what the approach should be.
As a more explicit example of what I'm looking to accomplish, assume $n = 1, m = 2$, which gives
$$ \displaystyle \frac{\partial^{3} f}{\partial x \partial y^2} $$
After one application of the rules, it should equal
$$ \displaystyle \frac{\partial^{3} g}{\partial x^2 \partial y} $$
There is one more substitution to make, giving
$$ \displaystyle - \frac{\partial^{3} f}{\partial x^3} $$