MathGroup Archive 2009

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

Search the Archive

Re: Very strange behaviour of ArcTan[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102673] Re: Very strange behaviour of ArcTan[]
  • From: pfalloon <pfalloon at gmail.com>
  • Date: Tue, 18 Aug 2009 06:08:59 -0400 (EDT)
  • References: <h6bh4m$6ov$1@smc.vnet.net>

On Aug 17, 10:06 pm, Alexey <lehi... at gmail.com> wrote:
> Hello,
> I just have discovered some strange (buggy?) feature of ArcTan[]
> function in Mathematica 5.2. Try the following;
>
> In[72]:=
> ArcTan[.5,$MachinePrecision]
> ArcTan[.5]
>
> Out[72]=
> 1.53947
>
> Out[73]=
> 0.463648
>
> The expression ArcTan[.5,$MachinePrecision] must (?) give an error but
> in really gives some strange output without any error messages... What
> do you think about this?

You should check the documentation for the ArcTan function: there is a
form of this function which takes two inputs, so all you have done is
invoked that:

In[29]:= {x,y} = {0.5, $MachinePrecision};
ArcTan[x,y]

Out[30]= 1.53947

There is nothing buggy going on there, but clearly it's not what you
meant to do.

I'm not sure *what* you meant to do: if you were trying to get the
output to MachinePrecision, the above is not the way to do this (not
sure where you got the idea of adding a second argument: you need to
use the function N). But it is unnecessary in this case because the
argument 0.5 is already at machine precision. The following would be a
sensible input:

In[31]:= N[ArcTan[1/2]]

Out[31]= 0.463648

Note that this returns machine-precision output:

In[32]:= Precision[%]

Out[32]= MachinePrecision


Cheers,
Peter.


  • Prev by Date: Re: Very strange behaviour of ArcTan[]
  • Next by Date: Re: Very strange behaviour of ArcTan[]
  • Previous by thread: Re: Very strange behaviour of ArcTan[]
  • Next by thread: "Mathematica could not establish a connection to the kernel"