\( \DeclareMathOperator{\abs}{abs} \newcommand{\ensuremath}[1]{\mbox{$#1$}} \)
(%i1) |
MatrixIndex
(
A
)
:
=
block
(
[
n
,
m
,
i
,
r0
,
r1
,
B
]
,
if not ( matrixp ( A ) ) then error ( "Matrix expected" ) , [ n , m ] : matrix_size ( A ) , if n # m then error ( "Square matrix expected" ) , r0 : n , B : ident ( n ) , for i : 0 thru n do ( B : B . A , r1 : rank ( B ) , if is ( r0 = r1 ) then return ( i ) , r0 : r1 ) ) $ |
(%i2) |
DrazinInverse
(
A
)
:
=
block
(
[
n
,
k
,
s
]
,
k : MatrixIndex ( A ) , n : length ( A ) , limit ( invert ( s · ident ( n ) + A ^ ^ ( k + 1 ) ) . ( A ^ ^ k ) , s , 0 ) ) $ |
(%i5) |
M1
:
matrix
(
[
m11
,
m12
,
m13
]
,
[
m21
,
0
,
0
]
,
[
m31
,
0
,
0
]
)
;
print ( "Index: " , MatrixIndex ( M1 ) ) $ DrazinInverse ( M1 ) ; |
\[\operatorname{(M1) }\begin{pmatrix}\ensuremath{\mathrm{m11}} & \ensuremath{\mathrm{m12}} & \ensuremath{\mathrm{m13}}\\ \ensuremath{\mathrm{m21}} & 0 & 0\\ \ensuremath{\mathrm{m31}} & 0 & 0\end{pmatrix}\]\[\mbox{Index: 1}\]
\[\operatorname{ }\begin{pmatrix}0 & \frac{\ensuremath{\mathrm{m12}}}{\ensuremath{\mathrm{m13}}\, \ensuremath{\mathrm{m31}}+\ensuremath{\mathrm{m12}}\, \ensuremath{\mathrm{m21}}} & \frac{\ensuremath{\mathrm{m13}}}{\ensuremath{\mathrm{m13}}\, \ensuremath{\mathrm{m31}}+\ensuremath{\mathrm{m12}}\, \ensuremath{\mathrm{m21}}}\\ \frac{\ensuremath{\mathrm{m21}}}{\ensuremath{\mathrm{m13}}\, \ensuremath{\mathrm{m31}}+\ensuremath{\mathrm{m12}}\, \ensuremath{\mathrm{m21}}} & -\frac{\ensuremath{\mathrm{m11}}\, \ensuremath{\mathrm{m12}}\, \ensuremath{\mathrm{m21}}}{{{\ensuremath{\mathrm{m13}}}^{2}} {{\ensuremath{\mathrm{m31}}}^{2}}+2 \ensuremath{\mathrm{m12}}\, \ensuremath{\mathrm{m13}}\, \ensuremath{\mathrm{m21}}\, \ensuremath{\mathrm{m31}}+{{\ensuremath{\mathrm{m12}}}^{2}} {{\ensuremath{\mathrm{m21}}}^{2}}} & -\frac{\ensuremath{\mathrm{m11}}\, \ensuremath{\mathrm{m13}}\, \ensuremath{\mathrm{m21}}}{{{\ensuremath{\mathrm{m13}}}^{2}} {{\ensuremath{\mathrm{m31}}}^{2}}+2 \ensuremath{\mathrm{m12}}\, \ensuremath{\mathrm{m13}}\, \ensuremath{\mathrm{m21}}\, \ensuremath{\mathrm{m31}}+{{\ensuremath{\mathrm{m12}}}^{2}} {{\ensuremath{\mathrm{m21}}}^{2}}}\\ \frac{\ensuremath{\mathrm{m31}}}{\ensuremath{\mathrm{m13}}\, \ensuremath{\mathrm{m31}}+\ensuremath{\mathrm{m12}}\, \ensuremath{\mathrm{m21}}} & -\frac{\ensuremath{\mathrm{m11}}\, \ensuremath{\mathrm{m12}}\, \ensuremath{\mathrm{m31}}}{{{\ensuremath{\mathrm{m13}}}^{2}} {{\ensuremath{\mathrm{m31}}}^{2}}+2 \ensuremath{\mathrm{m12}}\, \ensuremath{\mathrm{m13}}\, \ensuremath{\mathrm{m21}}\, \ensuremath{\mathrm{m31}}+{{\ensuremath{\mathrm{m12}}}^{2}} {{\ensuremath{\mathrm{m21}}}^{2}}} & -\frac{\ensuremath{\mathrm{m11}}\, \ensuremath{\mathrm{m13}}\, \ensuremath{\mathrm{m31}}}{{{\ensuremath{\mathrm{m13}}}^{2}} {{\ensuremath{\mathrm{m31}}}^{2}}+2 \ensuremath{\mathrm{m12}}\, \ensuremath{\mathrm{m13}}\, \ensuremath{\mathrm{m21}}\, \ensuremath{\mathrm{m31}}+{{\ensuremath{\mathrm{m12}}}^{2}} {{\ensuremath{\mathrm{m21}}}^{2}}}\end{pmatrix}\]
(%i8) |
M2
:
matrix
(
[
0
,
0
,
0
,
m14
]
,
[
0
,
0
,
m23
,
m24
]
,
[
m31
,
m32
,
0
,
m34
]
,
[
0
,
0
,
0
,
0
]
)
;
print ( "Index: " , MatrixIndex ( M2 ) ) $ DrazinInverse ( M2 ) ; |
\[\operatorname{(M2) }\begin{pmatrix}0 & 0 & 0 & \ensuremath{\mathrm{m14}}\\ 0 & 0 & \ensuremath{\mathrm{m23}} & \ensuremath{\mathrm{m24}}\\ \ensuremath{\mathrm{m31}} & \ensuremath{\mathrm{m32}} & 0 & \ensuremath{\mathrm{m34}}\\ 0 & 0 & 0 & 0\end{pmatrix}\]\[\mbox{Index: 2}\]
\[\operatorname{ }\begin{pmatrix}0 & 0 & 0 & 0\\ 0 & 0 & \frac{1}{\ensuremath{\mathrm{m32}}} & \frac{\ensuremath{\mathrm{m24}}\, \ensuremath{\mathrm{m32}}+\ensuremath{\mathrm{m14}}\, \ensuremath{\mathrm{m31}}}{\ensuremath{\mathrm{m23}} {{\ensuremath{\mathrm{m32}}}^{2}}}\\ \frac{\ensuremath{\mathrm{m31}}}{\ensuremath{\mathrm{m23}}\, \ensuremath{\mathrm{m32}}} & \frac{1}{\ensuremath{\mathrm{m23}}} & 0 & \frac{\ensuremath{\mathrm{m34}}}{\ensuremath{\mathrm{m23}}\, \ensuremath{\mathrm{m32}}}\\ 0 & 0 & 0 & 0\end{pmatrix}\]
Created with wxMaxima.