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 22:14:41 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

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

The function cplxpair is defined in an m-file.  If you look at the start of
the code there is a series of FIXME notes.


## FIXME: subsort returned pairs by imaginary magnitude
## FIXME: Why doesn't exp (2i*pi*[0:4]'/5) produce exact conjugates?  Does
## FIXME: it in Matlab?  The reason is that complex pairs are supposed
## FIXME: to be exact conjugates, and not rely on a tolerance test.


This seems relevant.  Also, with a high enough tolerance you can force Octave
to match pairs which are fairly far apart.  Octave does pair them, but returns
each half of the pair exactly as it appeared in the input.  If Matlab is
choosing to keep only one half of a pair and conjugate it to get the second
half, then this test will immediately show it.


z = [1 + 0.5i; 1; 1-0.49i]
cplxpair (z, 1e14)


The results for Octave are


octave:21> z = [1 + 0.5i; 1; 1-0.49i]
z =

   1.0000 + 0.5000i
   1.0000 + 0.0000i
   1.0000 - 0.4900i

octave:22> cplxpair (z, 1e14)
ans =

   1.0000 - 0.4900i
   1.0000 + 0.5000i
   1.0000 + 0.0000i



@Nicholas: Can you run the test code in Matlab to see what happens?



    _______________________________________________________

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]