bugGNU Octave - Bugs: bug #53462, Inf*i is not equivalent to...

 
 

bug #53462: Inf*i is not equivalent to complex(0, Inf)

Submitter:  Dildar Sk <hodor123456>
Submitted:  Sun 25 Mar 2018 01:55:31 PM UTC
   
 
Category:  Octave Function Severity:  2 - Minor
Priority:  3 - Low Item Group:  Matlab Compatibility
Status:  Duplicate Assigned to:  None
Originator Name:  Dildar Sk Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 26 Mar 2018 10:31:20 PM UTC, comment #8: 

I think so, done.

Mike Miller <mtmiller>
Group Member
Mon 26 Mar 2018 10:05:50 PM UTC, comment #7: 

Can we close this as a duplicate of bug #31974?

Rik <rik5>
Group administrator
Mon 26 Mar 2018 07:01:02 PM UTC, comment #6: 

And this seems to be covered pretty thoroughly by bug #31974.

Mike Miller <mtmiller>
Group Member
Mon 26 Mar 2018 06:58:57 PM UTC, comment #5: 

I've updated the summary and metadata to reflect the remaining issue here. In Matlab, Inf*i evaluates to complex(0, Inf).

Mike Miller <mtmiller>
Group Member
Sun 25 Mar 2018 03:31:34 PM UTC, comment #4: 

"What happens for you if you do",


angle (complex (0, Inf))
angle (complex (NaN, Inf))
angle (complex (Inf, NaN))
angle (complex (NaN, NaN))
angle (complex (Inf, Inf))


Yes,the results are same in MATLAB and Octave.

Dildar Sk <hodor123456>
Sun 25 Mar 2018 02:17:19 PM UTC, comment #3: 

That should have been

For


inf * i


Octave computes...

John W. Eaton <jwe>
Group administrator
Sun 25 Mar 2018 02:15:57 PM UTC, comment #2: 

For inf*i, Octave computes inf * complex (0, 1), which produces complex (NaN, Inf), so I think angle is doing the right thing to return NaN for that value.

What happens for you if you do


angle (complex (0, Inf))
angle (complex (NaN, Inf))
angle (complex (Inf, NaN))
angle (complex (NaN, NaN))
angle (complex (Inf, Inf))


in both Octave and Matlab?

If these all agree, then I think the actual "problem" is that Octave doesn't have a special case for Inf * i.  The real issue here is that Octave (and Matlab) don't have pure imaginary numbers.  So given that, the question is what (if any) special cases should be handled for operations when the real part of a complex number is zero.  We've been over this issue a number of times before, and it's not clear to me what the correct thing is.

John W. Eaton <jwe>
Group administrator
Sun 25 Mar 2018 02:01:05 PM UTC, comment #1: 

I am really sorry, there was a i variable present there, so the following report isn't valid.But,
angle(inf*i) producing different result in MATLAB and Octave.
MATLAB giving pi/2 where Octave giving NaN.

Dildar Sk <hodor123456>
Sun 25 Mar 2018 01:55:31 PM UTC, original submission:  

In MATLAB,


>> angle(i)

ans =

    1.5708

>> angle(10i)

ans =

    1.5708


In Octave,


>> angle(i)
ans = 0
>> angle(10i)
ans =  1.5708


angle(x+iy) is equal to,atan(y/x),
so,angle(0+iy)=atan(y/0)=atan(inf)=pi/2.
Definite the answer should be like MATLAB 1.5708.

Dildar Sk <hodor123456>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by hodor123456 (Submitted the item)
  • -email is unavailable- added by hodor123456
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-03-26 mtmiller StatusConfirmed Duplicate
        Open/ClosedOpen Closed
    2018-03-26 mtmiller Dependencies- Depends on bugs #31974
    2018-03-26 mtmiller Item GroupIncorrect Result Matlab Compatibility
    2018-03-26 mtmiller Severity3 - Normal 2 - Minor
        Priority5 - Normal 3 - Low
        StatusNone Confirmed
        Summaryangle(0+xi) producing inaccurate result. Inf*i is not equivalent to complex(0, Inf)
    2018-03-25 hodor123456 Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code