"1^(x=defective square_matrix)" does not evaluate to I(dim(x))
Ben Abbott
bpabbott at mac.com
Mon Jan 14 10:43:39 CST 2008
On Monday, January 14, 2008, at 11:39AM, "Rolf Fabian" <Rolf.Fabian at gmx.de> wrote:
>
>It can be shown, that
>1^(x = square matrix of size n) should always evaluate to
>eye(n), no matter of the contents of exponent matrix x
>as long as no NaN elements occur in x.
>
>octave-3.0.0.exe:> n=1; 1^(x = randn(n)+rand(n)*i) # OK
>ans = 1
>octave-3.0.0.exe:> n=2; 1^(x = randn(n)+rand(n)*i) # OK
>ans =
> 1.00000 - 0.00000i 0.00000 + 0.00000i
> 0.00000 - 0.00000i 1.00000 + 0.00000i
>
>octave-3.0.0.exe:> n=3; 1^(x = randn(n)+rand(n)*i) # OK
>ans =
> 1.00000 + 0.00000i 0.00000 + 0.00000i 0.00000 + 0.00000i
> 0.00000 + 0.00000i 1.00000 + 0.00000i 0.00000 + 0.00000i
> 0.00000 + 0.00000i 0.00000 + 0.00000i 1.00000 + 0.00000i
>
>octave-3.0.0.exe:> x=[0 1 0 0; 1 0 2 3; 0 0 0 1; 0 0 1 0]
>x =
> 0 1 0 0
> 1 0 2 3
> 0 0 0 1
> 0 0 1 0
>
>==============================
>octave-3.0.0.exe:> 1^x # FAIL
>ans =
> 1.00000 0.00000 1.37500 1.62500
> 0.00000 1.00000 2.00000 1.00000
> 0.00000 0.00000 1.00000 0.00000
> 0.00000 0.00000 0.00000 1.00000
>==============================
>
>This result differs significantly from expected result,
>namely 'eye(4)'.
>Hence the evaluation by Octave is definitely incorrect.
>BTW What does MatLab report here ?
Matlab 2007b on my Mac PPC gives,
>> x=[0 1 0 0; 1 0 2 3; 0 0 0 1; 0 0 1 0];
>> 1^x
Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 2.220446e-17.
ans =
1.000000000000000 0 0.366116523516816 0.366116523516816
0 1.000000000000000 0 0
0.000000000000000 -0.000000000000000 1.000000000000000 -0.000000000000000
0 0 0 1.000000000000000
>>
Ben
>
>What is special with the above counter example x ?
>At a first glance nothing, except that it has only
>zero entries on the main diagonal and thus it is
>traceless. It's determinant is det(x)=1, thus it
>is regular (non-singular).
>
>But x is severly defective which can be checked
>by
>octave-3.0.0.exe:> [v,d] = eig(x)
>v =
> 0.70711 -0.70711 -0.70711 0.70711
> 0.70711 0.70711 -0.70711 -0.70711
> 0.00000 -0.00000 0.00000 -0.00000
> 0.00000 -0.00000 0.00000 0.00000
>
>d =
> 1 0 0 0
> 0 -1 0 0
> 0 0 1 0
> 0 0 0 -1
>
>octave-3.0.0.exe:> cond(v)
>ans = 2.2960e+016
>octave-3.0.0.exe:> rank(v)
>ans = 2
>
>There is a rank deficiency of 2 for the
>matrix of eigenvectors v .
>Thus v is not invertible and the
>obviously underlying similarity
>transformation fails.
>
>=========================
>Proposed receipe of a fix,
> c : real or complex scalar :
> c ^ (x = any square matrix)
> = log ( c ) .* eye ( dimension (x) )
>no matter about particular
>content of matrix x ( as long
>as input does not contain 'NaN',
>but -/+ Inf elements of x
>should be allowed / accepted.
>=========================
>
>Rolf Fabian
>
>< r dot fabian at jacobs-university dot de>
>
>
>-----
>Rolf Fabian
><r dot fabian at jacobs-university dot de>
>
>--
>View this message in context: http://www.nabble.com/%221%5E%28x%3Ddefective-square_matrix%29%22-does-not-evaluate-to-I%28dim%28x%29%29-tp14804976p14804976.html
>Sent from the Octave - Bugs mailing list archive at Nabble.com.
>
>_______________________________________________
>Bug-octave mailing list
>Bug-octave at octave.org
>https://www.cae.wisc.edu/mailman/listinfo/bug-octave
>
>
More information about the Bug-octave
mailing list