4
$\begingroup$

Is there any way to convert the output of NCAlgebra to standard Mathematica form?

For example

<< NC`

<< NCAlgebra`

MatrixForm[m = {{a, b, c}, {d, e, f}, {g, h, i}}];
NCInverse[m][[1, 1]]

The output is

    a^(-1) ** (1 - b ** (e - d ** a^(-1) ** b)^(-1) ** (-d ** a^(-1) - (f - d ** a^(-1) ** c) ** (i - g ** a^(-1) ** c - (h - g ** a^(-1) ** b) ** (e - d ** a^(-1) ** b)^(-1) ** (f - d ** a^(-1) ** c))^(-1) ** (-g ** a^(-1) + (h - g ** a^(-1) ** b) ** (e - d ** a^(-1) ** b)^(-1) ** d ** a^(-1))) - c ** (i - g ** a^(-1) ** c - (h - g ** a^(-1) ** b) ** (e - d ** a^(-1) ** b)^(-1) ** (f - d ** a^(-1) ** c))^(-1) ** (-g ** a^(-1) + (h - g ** a^(-1) ** b) ** (e - d ** a^(-1) ** b)^(-1) ** d ** a^(-1)))

I want to change the output to standard form of Mathematica like

Inverse[a].(1-b.Inverse[e-d.Inverse[a].b]...
$\endgroup$
1
  • $\begingroup$ This is tricky, especially if you want it to work with letters that will be substituted by matrices. The main trouble is that things like a + b ** c will be expanded incorrectly: b**c will be added entrywise to the entries a. We have an internal routine for doing that in NCAlgebra but I never thought it was good enough to be made public. $\endgroup$ Dec 11, 2018 at 6:54

1 Answer 1

6
$\begingroup$

While I am not familiar with NCAlgebra, the following seems to work:

result /. {inv -> Inverse, NonCommutativeMultiply -> Dot}
(* Inverse[
  a].(1 - b.Inverse[
     e - d.Inverse[
        a].b].(-d.Inverse[a] - (f - d.Inverse[a].c).Inverse[
        i - g.Inverse[a].c - (h - g.Inverse[a].b).Inverse[
           e - d.Inverse[a].b].(f - d.Inverse[a].c)].(-g.Inverse[
            a] + (h - g.Inverse[a].b).Inverse[
           e - d.Inverse[a].b].d.Inverse[a])) - 
   c.Inverse[
     i - g.Inverse[a].c - (h - g.Inverse[a].b).Inverse[
        e - d.Inverse[a].b].(f - d.Inverse[a].c)].(-g.Inverse[
         a] + (h - g.Inverse[a].b).Inverse[
        e - d.Inverse[a].b].d.Inverse[a])) *)

Note that NCAlgebra produces inv[a] when inverting a. This is formatted as $a^{-1}$, but the underlying structure is just inv. You can see this using FullForm.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.