# Which CAS can do non-commutative differential algebra?

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, and let $$f \in R$$ be a generic 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)$$ Note that generically the elements $$f$$ and $$\partial(f)$$ don't necessarily commute.

• Just write your own codes. Commented Nov 2, 2023 at 16:04
• The Weyl algebras, you mean? Apparently SageMath has a few related classes. (You don't have to install it, you can use SageMathCell). Or if you indeed want derivations rather than the usual Leibniz's rule, there are univariate polynomial rings. However I'm not sure about generic elements. Commented Nov 2, 2023 at 20:31
• @Amateur_Algebraist: no, not Weyl algebras, just a generic non-commutative ring equipped with a generic derivation. The point is that I need the output to be expressed in terms of $\partial$ and $f$ only, whereas the concreteness of Weyl algebras (imposed by the the relations between the generators $x_i$ and $\partial / \partial x_j$) will obscure that - it would be too concrete. What I am after, is actually simpler because $\partial^k(f)$, $k \in \mathbb{N}$, are treated as blackboxes.
– M.G.
Commented Nov 2, 2023 at 21:07
• This recent conference paper notes a few implementations of related things in other CAS and also advertises a WIP SageMath package that allows one to define a differential ring. I don't know whether it can represent "unevaluated" $\partial^k f$, maybe you can contact the author directly. Commented Nov 3, 2023 at 10:51
• @Amateur_Algebraist: Nice find! This looks very promising (and even mentions corresponding packages for different CAS-es)! Thank you!
– M.G.
Commented Nov 3, 2023 at 12:32

\partial{#}::Derivative;
{\partial{#}, f}::NonCommuting;
ex:=\partial{\partial{(1+f)**2}};
converge(ex):
expand_power(_)
product_rule(_)
distribute(_)
;


the output is $$2\partial\left(\partial{f}\right)+\partial\left(\partial{f}\right) f+2\partial{f} \partial{f}+f \partial\left(\partial{f}\right)$$ Similarly for your other example.

• Awesome! Thank you! My next move would've been to resort to A3 paper just to be able to write down the actual expressions I need!
– M.G.
Commented Jun 20 at 14:51