|
View:
New views
11 Messages
—
Rating Filter:
Alert me
|
|
|
exponentiation problemHello All,
examples: " octave:19> (-ones(1)) ^ 0.25 ans = 0.70711 + 0.70711i octave:20> (-ones(2)) ^ 0.25 ans = 0.42045 + 0.42045i 0.42045 + 0.42045i 0.42045 + 0.42045i 0.42045 + 0.42045i octave:21> (-ones(3)) ^ 0.25 ans = 0.31024 + 0.31022i 0.31018 + 0.31017i 0.31018 + 0.31021i 0.31018 + 0.31017i 0.31025 + 0.31025i 0.31018 + 0.31019i 0.31018 + 0.31021i 0.31018 + 0.31019i 0.31024 + 0.31021i octave:22> (-ones(3)) .^ (0.25 * ones(3)) ans = 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i octave:23> (ones(3)) ^ 0.25 ans = 0.43874 + 0.00001i 0.43865 + 0.00000i 0.43869 - 0.00002i 0.43865 + 0.00000i 0.43876 + 0.00000i 0.43867 - 0.00001i 0.43869 - 0.00002i 0.43867 - 0.00001i 0.43872 + 0.00002i " - " octave:19> (-ones(1)) ^ 0.25 ans = 0.70711 + 0.70711i ", " octave:22> (-ones(3)) .^ (0.25 * ones(3)) ans = 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i " are correct IMHO; " octave:23> (ones(3)) ^ 0.25 ans = 0.43874 + 0.00001i 0.43865 + 0.00000i 0.43869 - 0.00002i 0.43865 + 0.00000i 0.43876 + 0.00000i 0.43867 - 0.00001i 0.43869 - 0.00002i 0.43867 - 0.00001i 0.43872 + 0.00002i " is especially worrysome because imaginary part appears out of nowhere. Regards, Sergei. Applications From Scratch: http://appsfromscratch.berlios.de/ ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
exponentiation problemOn 15-Jan-2008, Sergei Steshenko wrote:
| examples: | | " | octave:19> (-ones(1)) ^ 0.25 | ans = 0.70711 + 0.70711i | octave:20> (-ones(2)) ^ 0.25 | ans = | | 0.42045 + 0.42045i 0.42045 + 0.42045i | 0.42045 + 0.42045i 0.42045 + 0.42045i | | octave:21> (-ones(3)) ^ 0.25 | ans = | | 0.31024 + 0.31022i 0.31018 + 0.31017i 0.31018 + 0.31021i | 0.31018 + 0.31017i 0.31025 + 0.31025i 0.31018 + 0.31019i | 0.31018 + 0.31021i 0.31018 + 0.31019i 0.31024 + 0.31021i | | octave:22> (-ones(3)) .^ (0.25 * ones(3)) | ans = | | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i | | octave:23> (ones(3)) ^ 0.25 | ans = | | 0.43874 + 0.00001i 0.43865 + 0.00000i 0.43869 - 0.00002i | 0.43865 + 0.00000i 0.43876 + 0.00000i 0.43867 - 0.00001i | 0.43869 - 0.00002i 0.43867 - 0.00001i 0.43872 + 0.00002i | " | | - | | " | octave:19> (-ones(1)) ^ 0.25 | ans = 0.70711 + 0.70711i | ", | | " | octave:22> (-ones(3)) .^ (0.25 * ones(3)) | ans = | | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i | " | | are correct IMHO; | | " | octave:23> (ones(3)) ^ 0.25 | ans = | | 0.43874 + 0.00001i 0.43865 + 0.00000i 0.43869 - 0.00002i | 0.43865 + 0.00000i 0.43876 + 0.00000i 0.43867 - 0.00001i | 0.43869 - 0.00002i 0.43867 - 0.00001i 0.43872 + 0.00002i | " | | is especially worrysome because imaginary part appears out of nowhere. It is not surprising that the matrix cases are faulty for singular matrices or matrices with repeated eigenvalues given that they are implemented using a simple similarity transform. I think that fixing that problem is not trivial. Perhaps we should just try to provide a warning in these cases. I'd certainly consider a patch for that. jwe _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
Re: exponentiation problem--- Sergei Steshenko <sergstesh@...> wrote: > Hello All, > > examples: > > " > octave:19> (-ones(1)) ^ 0.25 > ans = 0.70711 + 0.70711i > octave:20> (-ones(2)) ^ 0.25 > ans = > > 0.42045 + 0.42045i 0.42045 + 0.42045i > 0.42045 + 0.42045i 0.42045 + 0.42045i > > octave:21> (-ones(3)) ^ 0.25 > ans = > > 0.31024 + 0.31022i 0.31018 + 0.31017i 0.31018 + 0.31021i > 0.31018 + 0.31017i 0.31025 + 0.31025i 0.31018 + 0.31019i > 0.31018 + 0.31021i 0.31018 + 0.31019i 0.31024 + 0.31021i > > octave:22> (-ones(3)) .^ (0.25 * ones(3)) > ans = > > 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > > octave:23> (ones(3)) ^ 0.25 > ans = > > 0.43874 + 0.00001i 0.43865 + 0.00000i 0.43869 - 0.00002i > 0.43865 + 0.00000i 0.43876 + 0.00000i 0.43867 - 0.00001i > 0.43869 - 0.00002i 0.43867 - 0.00001i 0.43872 + 0.00002i > " > > - > > " > octave:19> (-ones(1)) ^ 0.25 > ans = 0.70711 + 0.70711i > ", > > " > octave:22> (-ones(3)) .^ (0.25 * ones(3)) > ans = > > 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > " > > are correct IMHO; > > " > octave:23> (ones(3)) ^ 0.25 > ans = > > 0.43874 + 0.00001i 0.43865 + 0.00000i 0.43869 - 0.00002i > 0.43865 + 0.00000i 0.43876 + 0.00000i 0.43867 - 0.00001i > 0.43869 - 0.00002i 0.43867 - 0.00001i 0.43872 + 0.00002i > " > > is especially worrysome because imaginary part appears out of nowhere. > > Regards, > Sergei. > > Applications From Scratch: http://appsfromscratch.berlios.de/ > > > ____________________________________________________________________________________ > Never miss a thing. Make Yahoo your home page. > http://www.yahoo.com/r/hs > _______________________________________________ > Bug-octave mailing list > Bug-octave@... > https://www.cae.wisc.edu/mailman/listinfo/bug-octave > octave-2.9.14: " octave:1> ones(3) ^ 0.25 ans = NaN - NaNi NaN - NaNi NaN - NaNi Inf - NaNi Inf - NaNi Inf - NaNi NaN - NaNi NaN - NaNi NaN - NaNi "; octave-2.9.16: " octave:1> ones(3) ^ 0.25 ans = 0.43874 + 0.00001i 0.43865 + 0.00000i 0.43869 - 0.00002i 0.43865 + 0.00000i 0.43876 + 0.00000i 0.43867 - 0.00001i 0.43869 - 0.00002i 0.43867 - 0.00001i 0.43872 + 0.00002i ". I do not have octave-2.9.15 to check. Regards, Sergei. Applications From Scratch: http://appsfromscratch.berlios.de/ ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
Re: exponentiation problem--- "John W. Eaton" <jwe@...> wrote: > On 15-Jan-2008, Sergei Steshenko wrote: > > | examples: > | > | " > | octave:19> (-ones(1)) ^ 0.25 > | ans = 0.70711 + 0.70711i > | octave:20> (-ones(2)) ^ 0.25 > | ans = > | > | 0.42045 + 0.42045i 0.42045 + 0.42045i > | 0.42045 + 0.42045i 0.42045 + 0.42045i > | > | octave:21> (-ones(3)) ^ 0.25 > | ans = > | > | 0.31024 + 0.31022i 0.31018 + 0.31017i 0.31018 + 0.31021i > | 0.31018 + 0.31017i 0.31025 + 0.31025i 0.31018 + 0.31019i > | 0.31018 + 0.31021i 0.31018 + 0.31019i 0.31024 + 0.31021i > | > | octave:22> (-ones(3)) .^ (0.25 * ones(3)) > | ans = > | > | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > | > | octave:23> (ones(3)) ^ 0.25 > | ans = > | > | 0.43874 + 0.00001i 0.43865 + 0.00000i 0.43869 - 0.00002i > | 0.43865 + 0.00000i 0.43876 + 0.00000i 0.43867 - 0.00001i > | 0.43869 - 0.00002i 0.43867 - 0.00001i 0.43872 + 0.00002i > | " > | > | - > | > | " > | octave:19> (-ones(1)) ^ 0.25 > | ans = 0.70711 + 0.70711i > | ", > | > | " > | octave:22> (-ones(3)) .^ (0.25 * ones(3)) > | ans = > | > | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > | " > | > | are correct IMHO; > | > | " > | octave:23> (ones(3)) ^ 0.25 > | ans = > | > | 0.43874 + 0.00001i 0.43865 + 0.00000i 0.43869 - 0.00002i > | 0.43865 + 0.00000i 0.43876 + 0.00000i 0.43867 - 0.00001i > | 0.43869 - 0.00002i 0.43867 - 0.00001i 0.43872 + 0.00002i > | " > | > | is especially worrysome because imaginary part appears out of nowhere. > > It is not surprising that the matrix cases are faulty for singular > matrices or matrices with repeated eigenvalues given that they are > implemented using a simple similarity transform. I think that fixing > that problem is not trivial. Perhaps we should just try to provide a > warning in these cases. I'd certainly consider a patch for that. > > jwe > I am not sure, but should, say, (ones(3)) ^ 0.25 be equivalent to (-ones(3)) .^ (0.25 * ones(3)) ? I mean, that was my expectation, but it could be wrong. Thanks, Sergei. Applications From Scratch: http://appsfromscratch.berlios.de/ ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
Re: exponentiation problemOn 15-Jan-2008, Sergei Steshenko wrote:
| I am not sure, but should, say, | | (ones(3)) ^ 0.25 | | be equivalent to | | (-ones(3)) .^ (0.25 * ones(3)) | | ? | | I mean, that was my expectation, but it could be wrong. Your expectation is wrong. A^2 == A*A A^(1/2) == sqrtm (A) etc. jwe _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
Re: exponentiation problem--- "John W. Eaton" <jwe@...> wrote: > On 15-Jan-2008, Sergei Steshenko wrote: > > | examples: > | > | " > | octave:19> (-ones(1)) ^ 0.25 > | ans = 0.70711 + 0.70711i > | octave:20> (-ones(2)) ^ 0.25 > | ans = > | > | 0.42045 + 0.42045i 0.42045 + 0.42045i > | 0.42045 + 0.42045i 0.42045 + 0.42045i > | > | octave:21> (-ones(3)) ^ 0.25 > | ans = > | > | 0.31024 + 0.31022i 0.31018 + 0.31017i 0.31018 + 0.31021i > | 0.31018 + 0.31017i 0.31025 + 0.31025i 0.31018 + 0.31019i > | 0.31018 + 0.31021i 0.31018 + 0.31019i 0.31024 + 0.31021i > | > | octave:22> (-ones(3)) .^ (0.25 * ones(3)) > | ans = > | > | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > | > | octave:23> (ones(3)) ^ 0.25 > | ans = > | > | 0.43874 + 0.00001i 0.43865 + 0.00000i 0.43869 - 0.00002i > | 0.43865 + 0.00000i 0.43876 + 0.00000i 0.43867 - 0.00001i > | 0.43869 - 0.00002i 0.43867 - 0.00001i 0.43872 + 0.00002i > | " > | > | - > | > | " > | octave:19> (-ones(1)) ^ 0.25 > | ans = 0.70711 + 0.70711i > | ", > | > | " > | octave:22> (-ones(3)) .^ (0.25 * ones(3)) > | ans = > | > | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > | 0.70711 + 0.70711i 0.70711 + 0.70711i 0.70711 + 0.70711i > | " > | > | are correct IMHO; > | > | " > | octave:23> (ones(3)) ^ 0.25 > | ans = > | > | 0.43874 + 0.00001i 0.43865 + 0.00000i 0.43869 - 0.00002i > | 0.43865 + 0.00000i 0.43876 + 0.00000i 0.43867 - 0.00001i > | 0.43869 - 0.00002i 0.43867 - 0.00001i 0.43872 + 0.00002i > | " > | > | is especially worrysome because imaginary part appears out of nowhere. > > It is not surprising that the matrix cases are faulty for singular > matrices or matrices with repeated eigenvalues given that they are > implemented using a simple similarity transform. I think that fixing > that problem is not trivial. Perhaps we should just try to provide a > warning in these cases. I'd certainly consider a patch for that. > > jwe > Do the following two examples also represent "singular matrices or matrices with repeated eigenvalues": " octave:1> matr = [1,2,3;4,5,6;7,8,9] matr = 1 2 3 4 5 6 7 8 9 octave:2> matr ^ 0.25 ans = 0.748810 + 0.524341i 0.418020 + 0.142211i 0.087323 - 0.239825i 0.566187 + 0.057852i 0.640363 + 0.015765i 0.714353 - 0.026508i 0.383656 - 0.408544i 0.862519 - 0.110868i 1.341476 + 0.186902i ", " octave:6> rand_matr = rand(3,3) rand_matr = 0.99802 0.48525 0.71332 0.16917 0.97283 0.27022 0.93073 0.65589 0.33549 octave:7> rand_matr ^ 0.25 ans = 0.926082 + 0.130202i 0.085460 + 0.046235i 0.234396 - 0.182054i 0.020287 + 0.037973i 0.971381 + 0.013484i 0.081891 - 0.053095i 0.312304 - 0.252407i 0.181693 - 0.089630i 0.685046 + 0.352925i " ? Thanks, Sergei. Applications From Scratch: http://appsfromscratch.berlios.de/ ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
Re: exponentiation problemOn 15-Jan-2008, Sergei Steshenko wrote:
| Do the following two examples also represent | "singular matrices or matrices with repeated eigenvalues": | | " | octave:1> matr = [1,2,3;4,5,6;7,8,9] | matr = | | 1 2 3 | 4 5 6 | 7 8 9 This matrix is obviously singular (and my personal favorite). Do you not know what the term singular matrix means? | octave:6> rand_matr = rand(3,3) | rand_matr = | | 0.99802 0.48525 0.71332 | 0.16917 0.97283 0.27022 | 0.93073 0.65589 0.33549 | | octave:7> rand_matr ^ 0.25 | ans = | | 0.926082 + 0.130202i 0.085460 + 0.046235i 0.234396 - 0.182054i | 0.020287 + 0.037973i 0.971381 + 0.013484i 0.081891 - 0.053095i | 0.312304 - 0.252407i 0.181693 - 0.089630i 0.685046 + 0.352925i That matrix is not singular, nor does it have repeated eigenvalues. Furthermore, the result for ^0.25 that you show seems to me to be correct, at least to a reasonable degree of numerical accuracy. Couldn't you just check these things for yourself (hint: rank(x), eig(x), abs(x - (x^0.25)^4) )? jwe _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
Re: exponentiation problem--- "John W. Eaton" <jwe@...> wrote: > On 15-Jan-2008, Sergei Steshenko wrote: > > | Do the following two examples also represent > | "singular matrices or matrices with repeated eigenvalues": > | > | " > | octave:1> matr = [1,2,3;4,5,6;7,8,9] > | matr = > | > | 1 2 3 > | 4 5 6 > | 7 8 9 > > This matrix is obviously singular (and my personal favorite). Do you > not know what the term singular matrix means? > > | octave:6> rand_matr = rand(3,3) > | rand_matr = > | > | 0.99802 0.48525 0.71332 > | 0.16917 0.97283 0.27022 > | 0.93073 0.65589 0.33549 > | > | octave:7> rand_matr ^ 0.25 > | ans = > | > | 0.926082 + 0.130202i 0.085460 + 0.046235i 0.234396 - 0.182054i > | 0.020287 + 0.037973i 0.971381 + 0.013484i 0.081891 - 0.053095i > | 0.312304 - 0.252407i 0.181693 - 0.089630i 0.685046 + 0.352925i > > That matrix is not singular, nor does it have repeated eigenvalues. > Furthermore, the result for ^0.25 that you show seems to me to be > correct, at least to a reasonable degree of numerical accuracy. > Couldn't you just check these things for yourself (hint: rank(x), > eig(x), abs(x - (x^0.25)^4) )? > > jwe > The examples I gave here had been created before you explained me that my assumption on exponentiation was wrong, so please disregard them. Thanks, Sergei. Applications From Scratch: http://appsfromscratch.berlios.de/ ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
Re: exponentiation problemDear jwe Concerning the first criterion (singularity of base matrix b) I strongly agree. On the other hand 'repeated eigenvalues' of base matrix b is definitely a bad criterion for failure of b^scalar. As a counter example consider simply b=c*eye(n). (scalar c). Then b pocesses n repeated eigenvalues but b^scalar is well defined. You need to check whether b is 'defective'. That means that correct indicator for failure of b^scalar is rank deficiency of the eigensysstem matrix which is formed from eigenvectors of b. Rolf Fabian < r dot fabian at jacobs-university dot de> Rolf Fabian
<r dot fabian at jacobs-university dot de> |
|
|
Re: exponentiation problemDear jwe Concerning the first criterion (singularity of base matrix b) I strongly agree. On the other hand 'repeated eigenvalues' of base matrix b is definitely a bad criterion for problems with calculation of b^scalar. As a counter example consider simply b=c*eye(n). (scalar c). Then b pocesses n repeated eigenvalues but b^scalar is still well defined and can be easily calculated. You need to check whether b is 'defective'. That means that correct indicator for problems with calculation of b^scalar is rank deficiency of the eigensysstem matrix which is formed from eigenvectors of b. But even if b is found to be 'defective' this does not mean that b^scalar is undefined. It can be calculated but this requires a robust 'logm' function which is unfortunately not available in Octave. Rolf Fabian < r dot fabian at jacobs-university dot de> Rolf Fabian
<r dot fabian at jacobs-university dot de> |
|
|
Re: exponentiation problemOn 16-Jan-2008, Rolf Fabian wrote:
| But even if b is found to be 'defective' this does | not mean that b^scalar is undefined. | It can be calculated but this requires a | robust 'logm' function which is unfortunately | not available in Octave. So, since you seem to be an expert in this area, how about contributing one? jwe _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
| Free embeddable forum powered by Nabble | Forum Help |