Thread: Documentation fix regarding atan2

Documentation fix regarding atan2

From
"Andrew Maclean"
Date:
In Table 9.4 of the documentation atan2 is described as follows:
atan2(x, y)inverse tangent of x/y
 
I am sure it should read as:
atan2(y, x)inverse tangent of y/x
 
This looks to be the standard C++/c atan2(y,x) function.
 
You can easily test this:
If y = 2, x = 1, then degrees(atan(y/x)) =63.4 but if we proceed according to the documentation; degrees(atan2(x,y))=degrees(atan2(1,2))=25.6 which is not the same as degrees(atan(y/x)).
So it must be degrees(atan2(y,x))=degrees(atan2(2,1))=63.4.
 

Thanks
   Andrew

--
___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney  2006  NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.acfr.usyd.edu.au/
___________________________________________

Re: Documentation fix regarding atan2

From
Bruno Wolff III
Date:
On Wed, Sep 05, 2007 at 10:37:18 +1000,
  Andrew Maclean <andrew.amaclean@gmail.com> wrote:
> In Table 9.4 of the documentation atan2 is described as follows:
>   atan2(*x*, *y*) inverse tangent of *x*/*y*
>
> I am sure it should read as:
>   atan2(*y*, x) inverse tangent of y/x

Aren't those two statements sayiong the same thing?
You've just switched the names 'x' and 'y' and not changed their relationships.

>
>
> You can easily test this:
> If y = 2, x = 1, then degrees(atan(y/x)) =63.4 but if we proceed according
> to the documentation; degrees(atan2(x,y))=degrees(atan2(1,2))=25.6 which is
> not the same as degrees(atan(y/x)).

In this example you switched things around part way thorugh. atan2(1,2)
is the atan of (1/2), not atan(2/1) as used at the beginning of the example.

> So it must be degrees(atan2(y,x))=degrees(atan2(2,1))=63.4.

Re: Documentation fix regarding atan2

From
Tom Lane
Date:
Bruno Wolff III <bruno@wolff.to> writes:
>  Andrew Maclean <andrew.amaclean@gmail.com> wrote:
>> In Table 9.4 of the documentation atan2 is described as follows:
>> atan2(*x*, *y*) inverse tangent of *x*/*y*
>>
>> I am sure it should read as:
>> atan2(*y*, x) inverse tangent of y/x

> Aren't those two statements sayiong the same thing?

They're logically equivalent but I think Andrew is right that y/x
corresponds to the usual interpretation of X and Y directions in
trigonometry.

            regards, tom lane

Re: Documentation fix regarding atan2

From
"Andrew Maclean"
Date:

A Cartesian coordinate system is generally assumed i.e there exists an x-y coordinate system so there is an inherent ordering property here.

 

Regarding atan2, this makes interesting reading: http://en.wikipedia.org/wiki/Atan2

 

All I am asking is the documentation for atan2 conform with the correct definition. You are actually using atan2(y,x) in postgresql.

 

The inverse tangent is defined as arctan(y/x). Hence atan2 should be atan2(y,x) to be consistent with this definition. This conforms with C++, C usage.

 

Andrew

 

 

 

 

-----Original Message-----
From: Bruno Wolff III [mailto:bruno@wolff.to]
Sent: Wednesday, 5 September 2007 12:34
To: a.maclean@cas.edu.au
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Documentation fix regarding atan2

 

On Wed, Sep 05, 2007 at 10:37:18 +1000,

  Andrew Maclean <andrew.amaclean@gmail.com> wrote:

> In Table 9.4 of the documentation atan2 is described as follows:

>   atan2(*x*, *y*) inverse tangent of *x*/*y*

>

> I am sure it should read as:

>   atan2(*y*, x) inverse tangent of y/x

 

Aren't those two statements sayiong the same thing?

You've just switched the names 'x' and 'y' and not changed their relationships.

 

>

>

> You can easily test this:

> If y = 2, x = 1, then degrees(atan(y/x)) =63.4 but if we proceed according

> to the documentation; degrees(atan2(x,y))=degrees(atan2(1,2))=25.6 which is

> not the same as degrees(atan(y/x)).

 

In this example you switched things around part way thorugh. atan2(1,2)

is the atan of (1/2), not atan(2/1) as used at the beginning of the example.

 

> So it must be degrees(atan2(y,x))=degrees(atan2(2,1))=63.4.

Re: Documentation fix regarding atan2

From
Bruce Momjian
Date:
Change made.  Thanks.  Your documentation changes can be viewed in five
minutes using links on the developer's page,
http://www.postgresql.org/developer/testing.

---------------------------------------------------------------------------


Andrew Maclean wrote:
> In Table 9.4 of the documentation atan2 is described as follows:
>   atan2(*x*, *y*) inverse tangent of *x*/*y*
>
> I am sure it should read as:
>   atan2(*y*, x) inverse tangent of y/x
>
> This looks to be the standard C++/c atan2(y,x) function.
>
> You can easily test this:
> If y = 2, x = 1, then degrees(atan(y/x)) =63.4 but if we proceed according
> to the documentation; degrees(atan2(x,y))=degrees(atan2(1,2))=25.6 which is
> not the same as degrees(atan(y/x)).
> So it must be degrees(atan2(y,x))=degrees(atan2(2,1))=63.4.
>
>
> Thanks
>    Andrew
>
> --
> ___________________________________________
> Andrew J. P. Maclean
> Centre for Autonomous Systems
> The Rose Street Building J04
> The University of Sydney  2006  NSW
> AUSTRALIA
> Ph: +61 2 9351 3283
> Fax: +61 2 9351 7474
> URL: http://www.acfr.usyd.edu.au/
> ___________________________________________

--
  Bruce Momjian  <bruce@momjian.us>          http://momjian.us
  EnterpriseDB                               http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: Documentation fix regarding atan2

From
"Andrew Maclean"
Date:
Thanks.

On 9/15/07, Bruce Momjian <bruce@momjian.us> wrote:

Change made.  Thanks.  Your documentation changes can be viewed in five
minutes using links on the developer's page,
http://www.postgresql.org/developer/testing.

---------------------------------------------------------------------------


Andrew Maclean wrote:
> In Table 9.4 of the documentation atan2 is described as follows:
>   atan2(*x*, *y*) inverse tangent of *x*/*y*
>
> I am sure it should read as:
>   atan2(*y*, x) inverse tangent of y/x
>
> This looks to be the standard C++/c atan2(y,x) function.
>
> You can easily test this:
> If y = 2, x = 1, then degrees(atan(y/x)) =63.4 but if we proceed according
> to the documentation; degrees(atan2(x,y))=degrees(atan2(1,2))= 25.6 which is
> not the same as degrees(atan(y/x)).
> So it must be degrees(atan2(y,x))=degrees(atan2(2,1))=63.4.
>
>
> Thanks
>    Andrew
>
> --
> ___________________________________________
> Andrew J. P. Maclean
> Centre for Autonomous Systems
> The Rose Street Building J04
> The University of Sydney  2006  NSW
> AUSTRALIA
> Ph: +61 2 9351 3283
> Fax: +61 2 9351 7474
> URL: http://www.acfr.usyd.edu.au/
> ___________________________________________

--
Bruce Momjian  <bruce@momjian.us >          http://momjian.us
EnterpriseDB                               http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org/



--
___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney  2006  NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.acfr.usyd.edu.au/
___________________________________________