I would like to identify which terms in my expression are a total derivative and which ones are not.
For expressions in which all terms are a total derivative, one can simply use integrate to find out. For instance, the following simple example nicely illustrates this:
Integrate[f[x] f'[x] + g[x] h'[x] + g'[x] h[x], x]
f[x]^2/2 + g[x] h[x]
However, for expressions that contain terms that are not total derivatives, this does not work. For instance
Integrate[f[x] f'[x] + g[x] h'[x] + g'[x] h[x]+ g[x] k[x], x]
would not work. Mathematica just returns the same expression with an integral sign. I would like it to tell me that the first three terms are a total derivative and the last one is not.
Any other practical ways to go about this?