Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*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 smc.vnet.net
  • Subject: [mg64936] Re: Possible Bug in ArcTan ?
  • From: "David W. Cantrell" <DWCantrell at sigmaxi.org>
  • Date: Wed, 8 Mar 2006 00:59:56 -0500 (EST)
  • References: <du6o44$5rg$1@smc.vnet.net> <du83m5$sv3$1@smc.vnet.net> <du8are$fp7$1@smc.vnet.net> <dubgv0$fm7$1@smc.vnet.net> <due86a$9vj$1@smc.vnet.net> <dujr11$8ou$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Paul Abbott <paul at physics.uwa.edu.au> wrote:
> 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.

First, there will be division by zero if y is zero and x is nonpositive.
See below.

Second, the very special case when both x and y are zero is interesting.
Of course, one could well argue that we should _want_ the result to be
undefined, that is, Indeterminate in Mathematica. And indeed, that's what
Paul's expression gives. But there's also a good argument that we should
want ArcTan[x,y] to be defined even when both x and y are zero. That's what
Mathematica does: ArcTan[0,0] yields Interval[{-Pi,Pi}]. IMO, the only
result which would be slightly better would be the "half-open, half-closed"
interval (-Pi, Pi], which I suppose is unavailable in Mathematica.

> 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.

Actually, when x is negative and y is zero, we also have division by zero.
But then we're dividing into zero as well, and so in Mathematica the result
is neither Pi nor 0, but rather Indeterminate.

David


  • Prev by Date: Re: Listable functions with two brackets f[][] (SubValues)
  • Next by Date: Re: Listable functions with two brackets f[][] (SubValues)
  • Previous by thread: Re: Possible Bug in ArcTan ?
  • Next by thread: Re: Possible Bug in ArcTan ?