Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Possible Bug in ArcTan ?

  • To: mathgroup at
  • Subject: [mg64894] Re: Possible Bug in ArcTan ?
  • From: Paul Abbott <paul at>
  • Date: Tue, 7 Mar 2006 06:11:44 -0500 (EST)
  • Organization: The University of Western Australia
  • References: <du6o44$5rg$> <du83m5$sv3$> <du8are$fp7$> <dubgv0$fm7$> <due86a$9vj$>
  • Sender: owner-wri-mathgroup at

In article <due86a$9vj$1 at>,
 "Jens-Peer Kuska" <kuska at> wrote:

> why you want avoid the two-argument form. The two-argument form help
> a lot during programing, because one has not to type
> If[x=!=0,ArcTan[y/x]]
> and a division by zero is in the most programing languages
> a very hard and evil error.

There is no "division by zero" error using the form

  2 ArcTan[y/(x+Sqrt[x^2+y^2])]

except when x == y == 0 -- where the result is undefined anyway. 
However, as David Cantrell points out, this form (only) fails if y is 
zero and x is negative (returning 0 instead of Pi), and so must be 
considered separately.

Since Mathematica has the two-argument form, one should use it. However, 
my point was that, mathematically, 2 ArcTan[y/(x+Sqrt[x^2+y^2])] is 
preferable to ArcTan[y/x].


Paul Abbott                                      Phone:  61 8 6488 2734
School of Physics, M013                            Fax: +61 8 6488 1014
The University of Western Australia         (CRICOS Provider No 00126G)    

  • Prev by Date: Re: Plus Behavior Inside a Notation Box?
  • Next by Date: Re: Compile Fourier
  • Previous by thread: Re: Possible Bug in ArcTan ?
  • Next by thread: Re: Possible Bug in ArcTan ?