7
$\begingroup$

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 $\partial^k(f)$ are not assumed to commute with each other in any way for differing values of $k \geq 0$.

$\endgroup$
2
  • 1
    $\begingroup$ I have added an answer mentioning Cadabra to your post on MSE. $\endgroup$ Commented Jun 20 at 14:48
  • 1
    $\begingroup$ @KasperPeeters: Thank you! This is exactly what I was looking for! Feel free to post an answer here as well! $\endgroup$
    – M.G.
    Commented Jun 20 at 14:50

1 Answer 1

8
$\begingroup$

Does this fit your desires? This is Mathematica code:

D[(1 + f[t]) ** (1 + f[t]), {t, 2}]

Out:=(1 + f[t]) ** f''[t] + 2 f'[t] ** f'[t] + f''[t] ** (1 + f[t])

Operation ** is non-commutative multiplication.

$\endgroup$
9
  • $\begingroup$ Yes, this seems to work as desired! Thank you! I was not aware of the non-commutative multiplication option in Mathematica! Quick question, though. Is there a way for Mathematica to better group the terms as in my answer for improved overview of the terms? $\endgroup$
    – M.G.
    Commented Jun 20 at 16:48
  • $\begingroup$ Also, can Mathematica compute explicitly the operator $(f\partial)^3$? This is equally important for me. $\endgroup$
    – M.G.
    Commented Jun 20 at 16:53
  • 2
    $\begingroup$ @M.G. You can install the package NCAlgebra mathweb.ucsd.edu/~ncalg and then use NCExpand $\endgroup$
    – Anixx
    Commented Jun 20 at 16:58
  • 1
    $\begingroup$ @M.G. You can also use dot product: D[(1 + f[t]) . (1 + f[t]), {t, 2}]. As long as the objects are not matrices or lists, it will behave like **. $\endgroup$
    – Anixx
    Commented Jun 20 at 17:16
  • 1
    $\begingroup$ @M.G. In any case you can use the Nest function to repeat an operation n times. $\endgroup$
    – Anixx
    Commented Jun 20 at 18:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .