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: Rik
Subject: [Octave-bug-tracker] [bug #50124] cplxpair produces incorrect result for second column of complex pairs
Date: Thu, 26 Jan 2017 23:10:45 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

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

To address Mike's comment: if we don't know Matlab's exact tolerance
calculation, then start with a low tolerance.  With a low tolerance, the two
complex numbers won't pair and Matlab will emit an error.  Increase the
tolerance until Matlab is able to pair the two complex numbers and then see
whether the result is an exactly conjugated pair or the original two complex
numbers paired.

To address Bill's comment: The calculated tolerance used by Octave is

tol * eps (abs (Z))


For Z == 1+0.5i,


abs (1+0.5i)
ans =  1.1180
eps (ans)
ans =    2.2204e-16
ans * 1e14
ans =  0.022204


The test metric is


abs (Z2 - conj (Z1))


or


abs (1-0.49i - conj (1+0.5i))
===
abs (1-0.49i - (1-0.5i))
===
abs (.01i)
===
.01


Since .01 < 0.022204, they will pair.

If you introduce an absolutely crazy tolerance, like 1e25, then the numbers
will be treated as all real.  However, this is easily detected because the
true real number (1+0i) will not be at the end of the list separated from the
complex numbers at the start.  Instead, the list ordering will be the same as
the input in Octave.


    _______________________________________________________

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]