0
$\begingroup$

I used the Tag Set Delayed to set

F /: D[F[f_], x_] := F[D[f, x]]

It works if I give as input a single F:

D[F[g[x]],x] = F[g'[x]]

the result is as expected. However if I insert a linear combination of Fs

D[F[g[x]] + F[h[x]], x] = F'[g[x]]g'[x]+F'[h[x]]h'[x]

instead of

D[F[g[x]] + F[h[x]], x] = F[g'[x]] + F[h'[x]]

I was expecting the last result since I thought that first the D would distribute on Fs

D[F[g[x]],x] + D[F[h[x]],x]

and then my Tag Set Delayed would have applied.

Instead

Defining

d[a_ + b_] := d[a] + d[b];
F/:d[F[g_],x_]:=F[d[g,x]];

I gat the expected result

d[F[g[x]]+F[h[x]],x] = F[d[g[x],x]]+F[d[h[x],x]]

Which is what I would like to have with D.

Question

How can I get the same behavior with D?

$\endgroup$
3
  • $\begingroup$ Can you provide a MWE? $\endgroup$
    – MaPo
    Commented Feb 11, 2019 at 14:09
  • $\begingroup$ I was thinking F as an operator. Imagine F = Sum. It is linear and a derivative can be moved inside. $\endgroup$
    – MaPo
    Commented Feb 11, 2019 at 14:26
  • $\begingroup$ With F = Sum there is no contradiction in D[Sum[f[x] , ...], x]. How can I have a similar structure with a generic F? $\endgroup$
    – MaPo
    Commented Feb 11, 2019 at 14:33

1 Answer 1

1
$\begingroup$

You need to turn off automatic handling of derivatives for your function by adjusting the system options:

With[{old = OptionValue[SystemOptions["DifferentiationOptions"],"DifferentiationOptions"->"ExcludedFunctions"]},
    SetSystemOptions["DifferentiationOptions" -> "ExcludedFunctions" -> DeleteDuplicates[Append[old, F]]]
];

D[F[a_], r__] ^:= F[D[a, r]]

Then:

D[F[g[x]] + F[h[x]], x]

F[g'[x]] + F[h'[x]]

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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