# How to make mathematica give 1/0 as infinity

I would like Mathematica to print $$\arctan(4/0)$$ as $$\frac{\pi}{2}$$ but it does not because in mathematica 1/0 is complexinfinity. How do I make it print n/0 as Infinity so that Arctan will give me what I want?

• Why positive infinity? Why not DirectedInfinity[-1]? For ArcTan, why not -Pi/2? Jan 28, 2021 at 23:23
• Actually yeah I would like it to be positive or negative infinity depending on sign of n. Jan 29, 2021 at 5:13
• $\frac{4}{0} = {\infty}_{+}$ when $ 0 "$ is infinitesimally positive ("positive zero"), but not when it's infinitesimally negative ("negative zero") nor perfectly zero (integer-zero). So it'd seem like, for this to be a correct result, you'd need to clarify what $ 0 "$ means in that expression.
– Nat
Jan 29, 2021 at 19:35
• @Nat, this is where it'd have been nice to have a "signed zero" like in IEEE's model, but alas... Jan 30, 2021 at 2:04
• @user, then you should indeed be using two-argument arctangent in the first place. Jan 30, 2021 at 2:05

On the off chance that what is desired in a computational environment in which n/0 evaluates to (positive) Infinity and t = ArcTan[..] falls in the range -Pi/2 <= t <= Pi/2. One should use caution when overwriting built-in functions. I doubt this will cause problems in computations in which n/0 should always mean positive Infinity and not ComplexInfinity.

ClearAll[evaluateWithRealPower];
SetAttributes[evaluateWithRealPower, HoldFirst];
evaluateWithRealPower[code_] :=
InternalInheritedBlock[{Power},
Unprotect[Power];
Power[0, p_?Negative] := Infinity;
Power[0., p_?Negative] := Infinity; (* optional *)
Protect[Power];
code];

evaluateWithRealPower[ArcTan[4/0]]
(*  \[Pi]/2  *)

• Perfect. Thank you! Jan 29, 2021 at 5:11

Use the two-arg version of ArcTan instead:

ArcTan[0, 4]


π/2

• ...and if you also need to evaluate at 0, 0, you could use Arg[x + I y] instead. Jan 29, 2021 at 1:15

You can convert expressions of ComplexInfinity to Infinity by using the ReplaceAll operator /..

ArcTan[4/0 /. ComplexInfinity -> Infinity]


which gives Pi/2` as output.