I have pushed some changes to github to fix https://github.com/kpeeters/cadabra2/issues/71 and also make integrate_by_parts
more consistent. That is, it will now always integrate by parts only once (even if there is a double derivative), and you have to give it the full argument of the derivative which you want to move away. Example:
\partial{#}::PartialDerivative;
ex:= \int{ a \partial_{0}{\partial_{0}{a} } }{x};
which represents
$$\int a \partial_{0 0}{a} {\rm d}x$$
The following
integrate_by_parts(_, $a$);
will not do anything (because \partial_{0}
acts on \partial_{0}{a}
, not on a
). But
integrate_by_parts(_, $\partial_{0}{a}$);
will produce
$$-\int \partial_{0}{a} \partial_{0}{a} {\rm d}x$$
A few more examples of this are in tests/integrals.cdb
For your concrete case, a simple
integrate_by_parts(_, $a$);
will now produce zero because it will only act on the first term.