[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #53880] (x<1)(1) depends on x(2):
From: |
Dave Goel |
Subject: |
[Octave-bug-tracker] [bug #53880] (x<1)(1) depends on x(2): |
Date: |
Fri, 11 May 2018 16:09:44 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.117 Safari/537.36 |
URL:
<http://savannah.gnu.org/bugs/?53880>
Summary: (x<1)(1) depends on x(2):
Project: GNU Octave
Submitted by: deego
Submitted on: Fri 11 May 2018 08:09:43 PM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name: DAVE GOEL
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.2.2
Operating System: GNU/Linux
_______________________________________________________
Details:
QUIZ: Think of a strange scenario where the result of (x<1)(1) depends on
the value of x(2) (!)
Yes, there's such an a possible:
x=[-2 -1] and x = [-2 i] return different answers for (x<1)(1).
That's because octave switches to abs() if it encounters complex numbers.
The problems with this, in my opinion, are:
(1) Strange logic above of result(1) depending on x(2).
(2) A strange discontinuity in y<1 between y = -2 and x = -2 + eps i
(3) Matlab, see below.
(4) As it stands, < is therefore useless and unreliable when using complex
numbers. You cannot consistently rely on it to use abs, since you never know
when x will be interpreted as real.
----
A more consistent approach seems to be to use Re() instead of Abs() when
comparing complex numbers. Instead of any strange behaviors as above, that
transitions smoothly when x becomes real.
Finally, matlab seems to use the behavior I recommended:
https://www.mathworks.com/help/matlab/ref/lt.html#bt297ps-5
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?53880>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #53880] (x<1)(1) depends on x(2):,
Dave Goel <=
- [Octave-bug-tracker] [bug #53880] (x<1)(1) depends on x(2):, Michael Leitner, 2018/05/11
- [Octave-bug-tracker] [bug #53880] (x<1)(1) depends on x(2):, John W. Eaton, 2018/05/11
- [Octave-bug-tracker] [bug #53880] (x<1)(1) depends on x(2):, Mike Miller, 2018/05/11
- [Octave-bug-tracker] [bug #53880] (x<1)(1) depends on x(2):, John W. Eaton, 2018/05/11
- [Octave-bug-tracker] [bug #53880] (x<1)(1) depends on x(2):, Rik, 2018/05/11
- [Octave-bug-tracker] [bug #53880] (x<1)(1) depends on x(2):, Marco Caliari, 2018/05/12
- [Octave-bug-tracker] [bug #53880] (x<1)(1) depends on x(2):, Michael Leitner, 2018/05/12
- [Octave-bug-tracker] [bug #53880] (x<1)(1) depends on x(2):, Dan Sebald, 2018/05/12
- [Octave-bug-tracker] [bug #53880] (x<1)(1) depends on x(2):, Lars Kindermann, 2018/05/13
- [Octave-bug-tracker] [bug #53880] (x<1)(1) depends on x(2):, Michael Leitner, 2018/05/14