This seems ridiculously basic, but I cannot find anywhere explaining how to do it.
If you evaluate certain undefined functions like 1/0 or Tan[\[Pi]/2], Mathematica evaluates to ComplexInfinity. For some reason, however, the following expression does not act as expected:
1/0 == ComplexInfinity
This results in
ComplexInfinity == ComplexInfinity
rather than the expected
True
So the question is, how do you test whether a function evaluates to ComplexInfinity, or better yet, how do you test if a function is (mathematically, not programmatically) undefined?
ComplexInfinity, you can usesomething === ComplexInfinity. This is a structural test that'll only return True if the two symbols are identical. It's not a mathematical test like == is. – Szabolcs Feb 6 at 17:05Infinity,-Infinity,ComplexInfinityare just special printed forms ofDirectedInfinity. Check their FullForm or their Head: they have structure. – Szabolcs Feb 6 at 17:09