How to simplify expressions containing derivatives

Is there a way to reverse the application of derivative rules in order to simplify expressions including derivatives?

e.g. in Mathematica code: Want to go from

(g[x, y]*Derivative[1, 0][f][x, y])/h[x, y] + (f[x, y]*Derivative[1, 0][g][x, y])/h[x, y] -
(f[x, y]*g[x, y]*Derivative[1, 0][h][x, y])/h[x, y]^2


to

D[f[x, y]*g[x, y]/h[x, y], x]

• can't you just call it d? and then d->D?
– acl
Commented Mar 25, 2013 at 0:07
• @acl I'm not sure if that would work in my case. To give more background, I'm calculating Christoffel symbols, see mathworld.wolfram.com/ChristoffelSymboloftheSecondKind.html eq. 3. The procedure outputs the symols that are not zero which is what I want, but it evaluates all the derivatives (huge mess). Commented Mar 25, 2013 at 0:13
• You should spend some time writing a small example in valid Mathematica code so that we can see what your starting point is. Otherwise we'd have to waste time guessing wether some or all of the f, g, h are defined or not, whether x is the independent variable, etc.
– Jens
Commented Mar 25, 2013 at 0:16
• But then the title of the question should be different.
– Jens
Commented Mar 25, 2013 at 0:46
• @Barefeg Re: your recent comments above, let me clarify a few things for you, since you're new here. 1) This is not a personal support site. We try our best to keep questions meaningful and useful to a wide audience and that means, having an appropriate title that succinctly describes the problem (which will then allow others to easily search for it). If titles didn't matter, we might as well call this "How to make Lasagna". 2) This is a community run site and people here are volunteering their time to help others. Snapping at the very people who are trying to help you is not a good idea.
– rm -rf
Commented Mar 25, 2013 at 1:47

Actually, Integrate will work. The trouble is preventing the evaluation of the derivative.

expr = With[{anti =
Integrate[(g[x, y]*Derivative[1, 0][f][x, y])/
h[x, y] + (f[x, y]*Derivative[1, 0][g][x, y])/
h[x, y] - (f[x, y]*g[x, y]*Derivative[1, 0][h][x, y])/h[x, y]^2,
x]}, HoldForm[D[anti, x]]]


Use ReleaseHold[expr] if you want to evaluate the derivative.

• Great, this works almost perfectly. Is there any way to make this more general? For example if the expression contains full derivatives instead of being a full derivative? In other words, a way to look for full derivatives and simplify them while leaving the other parts unchanged. If this is not clear I can give an example. Commented Mar 25, 2013 at 2:06
• You would probably have to teach Mathematica how to simplify. I'm not sure about the best way. Perhaps these will be helpful: a question about sums or a question about vector calculus. Adding another example to your question might help others give a more complete answer. Commented Mar 25, 2013 at 10:35
• @Barefeg you could try simp[exp_] := Simplify[exp, TransformationFunctions -> (Block[{x}, Defer[D[#, x]] &[Integrate[#, x]]] &)];
– Rojo
Commented Mar 25, 2013 at 14:36

If you are starting with you original expression (basically a general derivative unfloded):

exp = (g[x, y]*Derivative[1, 0][f][x, y])/h[x, y] +
(f[x, y]*Derivative[1, 0][g][x, y])/h[x, y] -
(f[x, y]*g[x, y]*Derivative[1, 0][h][x, y])/h[x, y]^2;


You know that the only variable with respect to which differentiation is taken is x. Then you could just try to integrate and it will give what you need:

Integrate[exp, x]


(f[x, y] g[x, y])/h[x, y]

meaning expression under derivative.