bugGNU Octave - Bugs: bug #49015, atan2 singular cases

 
 

bug #49015: atan2 singular cases

Submitted by:  Ernst Reissner <ernstreissner>
Submitted on:  Tue 06 Sep 2016 01:49:26 PM UTC  
 
Category:  Documentation Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Wed 07 Sep 2016 04:33:01 PM UTC, comment #6: 

I can reopen it, doesn't change much.

The basis of Octave's atan2 function is C++ std::atan2, the documentation of which is here:

http://en.cppreference.com/w/cpp/numeric/math/atan2

The C++ function contains the following summary description:

> Computes the arc tangent of y/x using the signs of arguments to determine the correct quadrant.


That's pretty much the same wording and spirit as the Octave doc string.

Mike Miller <mtmiller>
Project Administrator
Wed 07 Sep 2016 08:26:19 AM UTC, comment #5: 

please reopen this bug.

Ernst Reissner <ernstreissner>
Wed 07 Sep 2016 08:25:56 AM UTC, comment #4: 

I do not agree:
one has to state that it is atan(y/x) and then the exceptions.
As it is, it is contradictuous.
atan(y/x) is not equvalent with arg (complex (X, Y)).

As an alternative first sentence one could write that it is
arg (complex (X, Y)).

I am not sure whether this is what is implemented.
I only know that this is what shall be implemented according to the standard.

Ernst Reissner <ernstreissner>
Tue 06 Sep 2016 10:35:58 PM UTC, comment #3: 

The relationship between atan2 and arg is already in the full doc string, so that is done.

The first sentence cannot possibly be a complete description of the function behavior, it is a simple general definition, which the full doc string clarifies.

Mike Miller <mtmiller>
Project Administrator
Tue 06 Sep 2016 10:31:49 PM UTC, comment #2: 

The first sentence is
Compute atan (Y / X) for corresponding elements of Y and X.

This is definitively wrong
if "...the first argument is @code{+0} and the second argument is negative,".

Then we obtain atan(0)=0.

With the rule i give, the result is pi.

You are right, it suffices to write `arg (complex (X, Y))'.

Correct is to write either a definition with atan(y/x)
and with the exceptions I gave
or if you give a definition in terms of arg,

but not both.

Ernst Reissner <ernstreissner>
Tue 06 Sep 2016 06:48:22 PM UTC, comment #1: 

IMHO these cases are all covered by the sentence

This function is equivalent to 'arg (complex (X, Y))'.

Mike Miller <mtmiller>
Project Administrator
Tue 06 Sep 2016 01:49:26 PM UTC, original submission:  

i doubt that atan2(y,x) is nothing but atan(y/x).
I think the truth is

%% This is essentially @code{atan(y/z)} with the following exceptions:
%% @itemize
%% @item
%% If the first argument is @code{+0} and the second argument is negative,
%% or the first argument is positive and finite
%% and the second argument is negative infinity,
%% then the result is the highest value less or equal to @code{pi}.
%% @item
%% If the first argument is @code{-0} and the second argument is negative,
%% or the first argument is negative and finite
%% and the second argument is negative infinity,
%% then the result is the lowest value less or equal to @code{-pi}.
%% @item
%% If the first argument is positive and the second argument is @code{0},
%% or the first argument is positive infinity
%% and the second argument is finite,
%% then the result is the double value closest to @code{pi/2}.
%% @item
%% If the first argument is negative and the second argument is @code{0},
%% or the first argument is negative infinity
%% and the second argument is finite,
%% then the result is the double value closest to @code{-pi/2}.
%% @item
%% If both arguments are positive infinity,
%% then the result is the value closest to @code{pi/4}.
%% @item
%% If the first argument is positive infinity
%% and the second argument is negative infinity,
%% then the result is the double value closest to @code{3*pi/4}.
%% @item
%% If the first argument is negative infinity and
%% the second argument is positive infinity,
%% then the result is the double value closest to @code{-pi/4}.
%% @item
%% If both arguments are negative infinity,
%% then the result is the double value closest to @code{-3*pi/4}.
%% @end itemize
%%

Ernst Reissner <ernstreissner>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-18 mtmiller CategoryNone => Documentation
        Open/ClosedOpen => Closed
    2016-09-07 mtmiller Open/ClosedClosed => Open
    2016-09-06 mtmiller StatusNone => Wont Fix
        Open/ClosedOpen => Closed
    2016-09-06 ernstreissner Carbon-Copy- => Added rei3ner@arcor.de

    Back to the top


    Powered by Savane 3.5