|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
"1^(x=defective square_matrix)" does not evaluate to I(dim(x))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 ? 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> |
|
|
Re: "1^(x=defective square_matrix)" does not evaluate to I(dim(x))On Monday, January 14, 2008, at 11:39AM, "Rolf Fabian" <Rolf.Fabian@...> 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@... >https://www.cae.wisc.edu/mailman/listinfo/bug-octave > > Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
Re: "1^(x=defective square_matrix)" does not evaluate to I(dim(x))Oops.
The proposed fix is definitely wrong it should be read as : ========================= Proposed receipe of a fix, 1 ^ (x = any square matrix) = 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. ========================= Sorry for any inconvenience Rolf Fabian < r dot fabian at jacobs-university dot de>
Rolf Fabian
<r dot fabian at jacobs-university dot de> |
|
|
Re: "1^(x=defective square_matrix)" does not evaluate to I(dim(x))Dear Ben
Thanks for checking the particular defective example using matlab. We learn that obviously matlab checks the condition number of the eigensystem (eigenvectors as columns of v) prior to similarity (back-)transformation and displays a warning it v is close to singular (which means that x is defective). But I can't see why the magnitude of RCOND = 2.220446e-17 reported by matlab differs from rcond = 1/cond(v) = 4.3554e-017 concluded from Octaves result of "cond(v) = 2.2960e+016". Does rcond in Octave and MatLab have different meanings ? What does ML mean by 'badly scaled? Thanks again Rolf Fabian
Rolf Fabian
<r dot fabian at jacobs-university dot de> |
|
|
Re: "1^(x=defective square_matrix)" does not evaluate to I(dim(x))On Monday, January 14, 2008, at 12:13PM, "Rolf Fabian" <Rolf.Fabian@...> wrote:
> >Dear Ben > >Thanks for checking the particular defective example using matlab. > >We learn that obviously matlab checks the condition number of >the eigensystem (eigenvectors as columns of v) prior to >similarity (back-)transformation and displays a warning it >v is close to singular (which means that x is defective). > >But I can't see why the magnitude of RCOND = 2.220446e-17 >reported by matlab differs from >rcond = 1/cond(v) = 4.3554e-017 concluded from Octaves >result of "cond(v) = 2.2960e+016". Does rcond in Octave and >MatLab have different meanings ? >What does ML mean by 'badly scaled? > >Thanks again > >Rolf Fabian > the RCOND should be compared to eps. I don't think the difference here is significant. I've noticed much larger differences between straight blas/lapack, Apple's version, and Atlas. Regarding "badly scaled", I've always assumed one or more rows/columns contained coefficients that are scaled substantially different than the others. If I'm wrong on that, perhaps someone else can explain. Ben _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
Re: "1^(x=defective square_matrix)" does not evaluate to I(dim(x))On 14-Jan-2008, Rolf Fabian wrote:
| | Oops. | The proposed fix is definitely wrong | it should be read as : | | ========================= | Proposed receipe of a fix, | 1 ^ (x = any square matrix) | = 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. | ========================= I would consider a patch. jwe _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
| Free embeddable forum powered by Nabble | Forum Help |