Let A is a nilpotent matrix.
$\boldsymbol{A}^l=\mathbf{0}$
To derive
$(\boldsymbol{I}-\boldsymbol{A})^{-1}=\boldsymbol{?}$
The answer in the textbook is
$(\boldsymbol{I}-\boldsymbol{A})^{-1}=\boldsymbol{I}+\boldsymbol{A}+\boldsymbol{A}^2+\cdots+\boldsymbol{A}^{l-1}$
Here's my code:
Let l=5, i.e, $\boldsymbol{A}^5=\mathbf{0}$
Clear["Global`*"];
Idm = IdentityMatrix[k];
t = Inverse[Idm - mA];
m0 = 0;
$Assumptions = mA \[Element] Matrices[{k, k}, Reals];
$Assumptions = MatrixPower[mA, 5] == m0;
TensorExpand[t]
MatrixPower[-mA + IdentityMatrix[k], -1]
or k=3, l=5,
Clear["Global`*"];
Idm = IdentityMatrix[3];
t = Inverse[Idm - mA];
m0 = ConstantArray[0, {3, 3}];
$Assumptions = mA \[Element] Matrices[{3, 3}, Reals];
$Assumptions = MatrixPower[mA, 5] == m0;
TensorExpand[t]
$\left\{\left\{\frac{1}{1-3 m A}-\frac{2 m A}{1-3 m A}, \frac{m A}{1-3 m A}, \frac{m A}{1-3 m A}\right\},\left\{\frac{m A}{1-3 m A}, \frac{1}{1-3 m A}-\frac{2 m A}{1-3 m A}, \frac{m A}{1-3 m A}\right\},\left\{\frac{m A}{1-3 m A}, \frac{m A}{1-3 m A}, \frac{1}{1-3 m A}-\frac{m A}{1-3 m A}\right\}\right\}$
How to 'Series expand' abstract matrix expression by MMA code?
In this question, i.e $(\boldsymbol{I}-\boldsymbol{A})^{-1}=\boldsymbol{I}+\boldsymbol{A}+\boldsymbol{A}^2+\cdots+\boldsymbol{A}^{l-1}$
EDIT
I used the NCAlgebra program to write the code (Refer to https://mathematica.stackexchange.com/a/191397/69835), which is very close to the answer I want. How to simplify the final result based on the assumptions given in the question?
Let l=5, i.e, $\boldsymbol{A}^5=\mathbf{0}$
Clear["Global`*"];
<< NC`
<< NCAlgebra`
NCSeries[f_, {x_, x0_, n_}] := Block[{h}, SetNonCommutative[h];
Plus @@ (Table[1/i!, {i, 0, n}]*
NestList[NCDirectionalD[#, {x, h}] &, f, n]) /. x -> x0 /.
h -> x]
f = inv[1 - a];
FullSimplify[NCSeries[f, {a, 0, 7}],
Assumptions -> a ** a ** a ** a ** a == 0]
1 + a + a ** a + a ** a ** a + a ** a ** a ** a + a ** a ** a ** a ** a ** a + a ** a ** a ** a ** a ** a ** a
The result I hope to get is
1 + a + a ** a + a ** a ** a + a ** a ** a ** a
/.a ** a ** a ** a ** a ->0– Lacia Oct 04 '22 at 17:081 + a + a ** a + a ** a ** a + a ** a ** a ** a + a ** a ** a ** a ** a ** a + a ** a ** a ** a ** a ** a ** a /. NonCommutativeMultiply[p : a ..] /; Length[List@p] > 4 -> 0where p can be replaced by another name. That removes all terms that have more than 4 a's in the multiplication. – userrandrand Oct 04 '22 at 17:18Nullis caused by the<< NC`at the end ofNCSeries[…]line, obviously a simple mistake. – xzczd Oct 05 '22 at 05:48