Re: Possible Bug in ArcTan ?
- To: mathgroup at smc.vnet.net
- Subject: [mg64894] Re: Possible Bug in ArcTan ?
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Tue, 7 Mar 2006 06:11:44 -0500 (EST)
- Organization: The University of Western Australia
- References: <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org>
- Sender: owner-wri-mathgroup at wolfram.com
In article <due86a$9vj$1 at smc.vnet.net>, "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de> 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]. Cheers, Paul _______________________________________________________________________ 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) AUSTRALIA http://physics.uwa.edu.au/~paul