1
$\begingroup$

I have very long expressions with functions f[x,y] and g[x,y] which satisfy

Derivative[1, 0][f][x, y] == - Derivative[0, 1][g][x, y]

I want to simplify expressions such as

Derivative[2, 0][f][x, y] - Derivative[1, 1][g][x, y]

which should evaluate to zero.

Ideally, the relation between the functions would only be imposed locally (comparable to the local definitions of variables inside a Block or similar).

What I have tried so far

I have found a solution which is non-local and also works only in the simplest cases. Using the function SetDelayed

Derivative[1, 0][f][x, y] := Derivative[0, 1][g][x, y]

correctly evaluates expressions like

Derivative[1, 0][f][x, y] - Derivative[0, 1][g][x, y]

to zero, but not

Derivative[2, 0][f][x, y] - Derivative[1, 1][g][x, y]

Interestingly, with the above SetDelayed the following evaluates to zero:

D[f[x, y], {x, 2}] - D[g[x, y], x, y]
$\endgroup$
  • $\begingroup$ So why not add Derivative[k_Integer?Positive, 0][f][x_, y_] := Derivative[k - 1, 1][g][x, y] as a definition? $\endgroup$ – J. M.'s discontentment Dec 18 '16 at 8:25
  • $\begingroup$ @J.M. This does indeed work for the examples I have provided but misses, for example, Derivative[1, 1][f][x, y] - Derivative[0, 2][g][x, y]. $\endgroup$ – user137217 Dec 18 '16 at 8:36
  • $\begingroup$ Yes, because the previous definition fixed the order of the partial with respect to the second variable. I was nudging you to think carefully about the general rule for implementing Derivative[j, k][f][x, y]. $\endgroup$ – J. M.'s discontentment Dec 18 '16 at 8:38
  • $\begingroup$ I see. Derivative[j_Integer?Positive, k_Integer?Positive][f][x_, y_] := Derivative[j - 1, k + 1][g][x, y]. Thanks a lot. Do you think it is ok to put ImposeRelation[expr_] := Block[{}, Derivative[j_Integer?Positive, k_Integer?Positive][f][x_, y_] := Derivative[j - 1, k + 1][g][x, y]; expr]? $\endgroup$ – user137217 Dec 18 '16 at 8:49
  • $\begingroup$ If you want to account for 0, use NonNegative instead as the condition. I don't know about OK; why not just try it out? You can always start in a fresh kernel if things go south for some reason. $\endgroup$ – J. M.'s discontentment Dec 18 '16 at 8:51
2
$\begingroup$

Following the comments by J. M. the definition using SetDelayed can be extended to an arbitrary number of partial derivatives:

Derivative[j_Integer?Positive, k_Integer?NonNegative][f][x_, y_] :=
  Derivative[j - 1, k + 1][g][x, y]

To satisfy the requirement of locality the following may be used:

ImposeRelation[expr_] := 
  Block[{fL, gL}, 
    Derivative[j_Integer?Positive, k_Integer?NonNegative][fL][x_, y_] :=
      Derivative[j - 1, k + 1][gL][x, y]; 
    expr /. {f -> fL, g -> gL} /. {fL -> f, gL -> g}]
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.