Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ArcTan[1/0] no result, but ArcTan[Infinity] ok. How to resolve?

6,792 views
Skip to first unread message

steve

unread,
May 9, 2005, 2:06:13 AM5/9/05
to
hi;
Mathematica 5.1, on windows.

ArcTan[1/0] gives an error but
ArcTan[Infinity] gives the correct answer.

One way to make ArcTan[1/0] give Pi/2 is to
write it as ArcTan[0,1].

I do know that 1/0 is DirectedInfinity[] with
unknown direction while Infinity is
DirectedInfinity[1], and that is probably the
reason that ArcTan[1/0] gives an error
but ArcTan[Infinity] does not.

I am asking is how to make 1/0 result in DirectedInfinity[1]
to avoid the error? is this possible?

What function do I need to wrap 1/0 with to
cause it to become Infinity[1] instead of
Infinity[] ? or may be I need to figure how
to detect if a division results in Infinity[]
and convert that to Infinity[1]? do I need
to redfine 1/0 somehow? may be make a new
rule to say if Mathematica see 1/0 expression then
make it Infinity[1]? but may be this will screw
other things?

Or may I should not mess with this stuff and
just change the code to ArcTan[x,y] instead of
ArcTan[y/x] and be happy?

thanks,
Steve

dh

unread,
May 11, 2005, 2:35:12 AM5/11/05
to
Hi Steve,
If you are know what you are doing, you could redefine the value of 0^-1
by the following:

Unprotect[Power];
Power[0, -1] = DirectedInfinity[1];

with this you will then get:
ArcTan[1/0] --> Pi/2

Sincerely, Daniel

David W. Cantrell

unread,
May 11, 2005, 2:45:06 AM5/11/05
to
"steve" <nma...@hotmail.com> wrote:
> hi;
> Mathematica 5.1, on windows.
>
> ArcTan[1/0] gives an error but
> ArcTan[Infinity] gives the correct answer.
>
> One way to make ArcTan[1/0] give Pi/2 is to
> write it as ArcTan[0,1].
>
> I do know that 1/0 is DirectedInfinity[] with
> unknown direction while Infinity is
> DirectedInfinity[1], and that is probably the
> reason that ArcTan[1/0] gives an error
> but ArcTan[Infinity] does not.
>
> I am asking is how to make 1/0 result in DirectedInfinity[1]
> to avoid the error? is this possible?

That could be done, by changing the definition of division, but doing so
would be highly inadvisable in general. (However, in some particular
contexts -- for example, if one were dealing only with nonnegative extended
reals -- then it would be perfectly correct to have 1/0 give
DirectedInfinity[1]. But how would we restrict Mathematica to such a
context?)

> What function do I need to wrap 1/0 with to cause it to become
> Infinity[1] instead of Infinity[] ?

The simplest would surely be Abs[]. That's a reasonable option iff the
result you want from ArcTan[t] is always supposed to be in the
interval [0, Pi/2]; otherwise, do as you suggested below, changing your
code to use ArcTan[x, y] instead.

> or may be I need to figure how
> to detect if a division results in Infinity[]
> and convert that to Infinity[1]? do I need
> to redfine 1/0 somehow? may be make a new
> rule to say if Mathematica see 1/0 expression then
> make it Infinity[1]? but may be this will screw
> other things?

The latter, IMO.

> Or may I should not mess with this stuff and
> just change the code to ArcTan[x,y] instead of
> ArcTan[y/x] and be happy?

Why not?

David

Scout

unread,
May 12, 2005, 2:59:20 AM5/12/05
to
1 / 0 gets rightly : 'Infinite expression'.
In fact that rapresentation is symbolically entered in Math as 'Infinity'.
So, if you want to write 1/0 you have just to enter Infinity symbol.
Otherwise, if you have an expression like 1/x
and calculate Limit[ArcTan[1/x],x->0] you get Pi/2, as you expected.

~Scout~

"steve" <nma...@hotmail.com> ha scritto nel messaggio
news:d5mukl$dru$1...@smc.vnet.net...

0 new messages