I have noticed that Sign
function can be very well applied to matrices using MatrixFunction
. It even works on some zero divisors, such as {{1,1},{1,1}}
. But how does it work and what is its meaning?
For instance, I noticed that when applied to split-complex numbers in matrix form it takes 9 possible values: $0,1,-1, j, -j, 1/2+j/2,1/2-j/2, -1/2+j/2, -1/2-j/2$. This is in contrast to complex numbers, where the set of values is infinite.
When applied to dual numbers, it gives 5 different values.
The usual rule $\text{sign } (AB)=\text{sign }A\cdot \text{sign } B$ still holds though.
It can give totally complicated results, for instance, when applied to a tessarine $1+i+j$:
Unprotect[Power];
Power[0, 0] = 1;
Protect[Power];
$Pre = If[FreeQ[#, J], #, Module[{tmp},
tmp = Evaluate[
MatrixFunction[Function[J, #], {{0, 1}, {1, 0}}]] //
FullSimplify;
tmp /. {{a_, b_}, {b_, a_}} -> a + J b]] &;
Sign[J + 1 + I]
It produces: $\left(\frac{1+\frac{i}{2}}{\sqrt{5}}-\frac{i}{2}\right) j+\left(\frac{1}{5}+\frac{i}{10}\right) \left(\sqrt{5}+(1+2 i)\right)$
But how does it work
is it not just element by element?Sign[{{1, -8}, {1, 7}}]
gives{{1, -1}, {1, 1}}
so theSign
was applied to each element of the matrix? resulting in new matrix with only1
and-1
in it. but may be I am overlooking something deeper in your question. $\endgroup$MatrixFunction
. Without it, a function applies to a matrix element-wise. $\endgroup$MatrixFunction[Sign, {{1, -8}, {-1, 7}}]
and you will get a more complicated result $\left( \begin{array}{cc} -\frac{3}{\sqrt{17}} & -\frac{8}{\sqrt{17}} \\ -\frac{1}{\sqrt{17}} & \frac{3}{\sqrt{17}} \\ \end{array} \right)$. $\endgroup$Sign
does work element by element. But there is a $Pre here and some magical handling of the symbolJ
so it's not obvious what to expect in the result. You might want to break this down into separate steps to understand exactly where it departs from expectations. $\endgroup$MatrixFunction[f, {{1, -8}, {-1, 7}}]
. As long as no derivatives of the scalar function occur, substitutingSign
forf
will yield the results you see. $\endgroup$