I've constructed an example for a
regular (non-singular) matrix x which is defective:
x =
0 1 0 0
1 0 2 3
0 0 0 1
0 0 1 0
It pocesses eigenvalues [1,-1,1,-1] and it proved to be
an excellent candidate to check Octave's matrix function
capabilities for defective arguments.
This study concerns consistency of results from ^ operator
and sqrtm - function for defective argument x.
Basically, it should be easy to see that we expect
(1) sqrtm(x)^2 - x = zeros
and (2) ( x^(1/2) )^2 - x = zeros
octave-3.0.0.exe:> computer, version
i686-pc-msdosmsvc
ans = 3.0.0
octave-3.0.0.exe:> x=[0 1 0 0; 1 0 2 3; 0 0 0 1; 0 0 1 0]
First we check the 'sqrtm' function (1):
octave-3.0.0.exe:> norm ( sqrtm(x)^2 .- x ,'fro')
ans = 4.5163e-015
and get approximately the expected result.
On the other hand, the matrix power operator test (2)
returns a result far from expectation:
octave-3.0.0.exe:> norm ( ( x^(1/2) )^2 .- x ,'fro')
ans = 3.5770
No warning is displayed.
Conclusion
Whereas 'sqrtm' seems to be robust (at least for this
single test matrix), the Octave's power operator
fails seriously for defective matrix input.
Octave's matrix power operator ^ needs to be fixed
to account for defective argument, or at least a
warning needs to be displayed.
Rolf Fabian
Rolf Fabian
<r dot fabian at jacobs-university dot de>