This is a repost of my question at MSE from 7 months ago, to which I haven't been able to find an answer yet.
I am looking for a CAS (possibly incl. additional packages/libraries) that can compute generic non-commutative differential expressions. Let me illustrate what I mean by two examples.
Let $(R,\partial)$ be a generic non-commutative differential ring (i.e. $\partial$ is a derivation on $R$), say of characteristic 0 for simplicity. Let $f \in R$ be an abstract (or generic if you prefer) element. Then it should be able to express $$ \partial^2(1+f)^2 $$ as $$ 2 \partial^2(f) + \partial^2(f) f + 2 \partial(f)^2 + f \partial^2(f) $$ and $$ (f\partial)^2 f $$ as $$ f \partial(f)^2 + f^2 \partial^2 (f), $$ where the elements $f$ and $\partial^k(f)$ are treated as black boxes. In particular, the elements $f$ and $\partial(f)$ are not assumed to commute in any way.