octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #50124] cplxpair produces incorrect result for


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #50124] cplxpair produces incorrect result for second column of complex pairs
Date: Fri, 27 Jan 2017 14:25:39 +0000 (UTC)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0

Follow-up Comment #19, bug #50124 (project octave):

for future reference, had to cleanup the script to run in Matlab:

no printf in matlab.

printf --> fprintf

" --> '

endfor --> end

end_try_catch --> end

"Undefined function 'printf' for input arguments of type 'char'"

can't do abs(z)(1)

   absz = abs(z)
   absz(1)


anyway, after that it ran and I don't think I changed any intended function:


>> tcplxpair
Tests to determine how the tolerance parameter is handled for determining real
numbers
How is the default tolerance used?
Was real until 1 + 100*eps*i
abs(z) = 1
Do we get the same results by passing 100*eps for the tolerance?
Was real until 1 + 100*eps*i
abs(z) = 1
Does doubling the tolerance work as expected?
Was real until 1 + 200*eps*i
abs(z) = 1
Tests with default tolerance
Determine how real numbers are found
Was real until 1 + 100*eps*i
abs(z) = 1
If the real part is doubled how does it compare
Was real until 2 + 200*eps*i
abs(z) = 2
What if there is another real value of large magnitude
Was real until 2 + 200*eps*i
abs(z) = 2
Tests for complex pairs
What if there is error in the real part, but imaginary parts are equal
Pairing was successful until (1 + 141*eps) + 1i, 1 - 1i
abs(z) = 1.41421
if the imaginary part is doubled what happens
Pairing was successful until (1 + 223*eps) + 2i, 1 - 2i
abs(z) = 2.23607
how are errors in the imaginary part handled
Pairing was successful until 1 + (141*eps*1i + 1i), 1 - 1i
abs(z) = 1.41421
scale the real part
Pairing was successful until 2 + (223*eps*1i + 1i), 2 - 1i
abs(z) = 2.23607
scale the imaginary part
Pairing was successful until 1 + (222*eps*1i + 2i), 1 - 2i
abs(z) = 2.23607
Add a larger pair of cojugates to make sure it is being done per pair
Pairing was successful until 1 + (222*eps*1i + 2i), 1 - 2i, 400 + 100i, 400 -
100i
abs(z) = 2.23607
sort order with a real, and error in the imaginary part
z =
  1.000000000000000 + 0.000000000000000i
  1.000000000000000 + 1.000000000000018i
  1.000000000000000 - 1.000000000000000i
ans =
  1.000000000000000 - 1.000000000000018i
  1.000000000000000 + 1.000000000000018i
  1.000000000000000 + 0.000000000000000i
z =
  1.000000000000000 + 0.000000000000000i
  1.000000000000000 + 1.000000000000000i
  1.000000000000000 - 1.000000000000018i
ans =
  1.000000000000000 - 1.000000000000000i
  1.000000000000000 + 1.000000000000000i
  1.000000000000000 + 0.000000000000000i
does the input order matter for the real part
z =
  1.000000000000000 + 1.000000000000018i
  1.000000000000000 - 1.000000000000000i
  1.000000000000000 + 0.000000000000000i
ans =
  1.000000000000000 - 1.000000000000018i
  1.000000000000000 + 1.000000000000018i
  1.000000000000000 + 0.000000000000000i
z =
  1.000000000000000 + 1.000000000000000i
  1.000000000000000 - 0.999999999999982i
  1.000000000000000 + 0.000000000000000i
ans =
  1.000000000000000 - 1.000000000000000i
  1.000000000000000 + 1.000000000000000i
  1.000000000000000 + 0.000000000000000i
does the input order matter for the cplx pairs
z =
  1.000000000000018 + 1.000000000000000i
  1.000000000000000 - 1.000000000000000i
ans =
  1.000000000000018 - 1.000000000000000i
  1.000000000000018 + 1.000000000000000i
z =
  1.000000000000000 - 1.000000000000000i
  1.000000000000018 + 1.000000000000000i
ans =
  1.000000000000018 - 1.000000000000000i
  1.000000000000018 + 1.000000000000000i
If value is real, with imaginary component less than tolerance, is result
real?z =
  1.000000000000000 + 0.000000000000018i
ans =
     1
ans =
  logical
   1


i attached the matlab compatible version as tcplxpair_matlab.m

(file #39570)
    _______________________________________________________

Additional Item Attachment:

File name: tcplxpair_matlab.m             Size:3 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?50124>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]