I am trying to define a derivative of a function which is itself an integral. The function GaussInt[f_,x_]
is the integral over f (a function of x) with respect to the measure $\exp(-x^2/2)/\sqrt{2\pi}$. I prefer to use the function GaussInt
rather than write out the integral to prevent mathematica from attempting to solve the integral (which it can't do, but it spends a lot of time trying). The problem is that GaussInt
doesn't satisfy the usual chain rule. That is
D[GaussInt[f_,x_], z_]:= GaussInt[D[f,z], z]
but Mathematica uses the chain rule to decide
D[GaussInt[f_,x_], z_] := GaussInt'[f,x] D[f,z]
which usually leads to the wrong answer.
I can get around this by defining my own differentiation operator
Dd[GaussInt[a_,z_],x_] := GaussInt[Dd[a,x], z]
I then have to define all the usual rules for Dd
. Although this works its is rather inelegant. My problem is I don't know how to robustly switch off the chain rule for differentiation when applied to my function GaussInt
. Any ideas?
GaussInt
? Are you doingD[GaussInt[f,x],x]
? Because this evaluates toDerivative[0, 1][GaussInt][f, x]
(which displays as $\mathrm{GaussInt}^{(0,1)}[f,x]$), notGaussInt'[f,x]
(the latter doesn't make sense, as prime is only used for a single-variable function). $\endgroup$:=
form (unless, of course, your input was in the form of a:=
statement). $\endgroup$