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: DocumentationSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: Wont FixAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating 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 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

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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 18 Nov 2016 07:20:27 PM UTCmtmillerCategoryNone=>Documentation
      Open/ClosedOpen=>Closed
    Wed 07 Sep 2016 04:33:01 PM UTCmtmillerOpen/ClosedClosed=>Open
    Tue 06 Sep 2016 06:48:22 PM UTCmtmillerStatusNone=>Wont Fix
      Open/ClosedOpen=>Closed
    Tue 06 Sep 2016 01:49:26 PM UTCernstreissnerCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1