• To: mathgroup at smc.vnet.net
• Subject: [mg59597] Re: [mg59580] Re: Mathematica goes Bad
• From: Andrzej Kozlowski <akozlowski at gmail.com>
• Date: Sat, 13 Aug 2005 03:26:31 -0400 (EDT)
• References: <200508090730.DAA19089@smc.vnet.net> <ddcb4g\$5bk\$1@smc.vnet.net> <200508120737.DAA17602@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```On 12 Aug 2005, at 09:37, Maxim wrote:

> On Wed, 10 Aug 2005 07:42:08 +0000 (UTC), Daniel Lichtblau
> <danl at wolfram.com> wrote:
>
>
>>
>> I think it is safe to say that symbolic calculus is fraught with
>> problematic areas where, for example, mistakes involving a
>> combination
>> of branch cuts and arithmetic with infinities can lead to erroneous
>> results. I do not see any evidence of this sort of phenomenon in the
>> example above, though. That was just a design decision. While you may
>> think it was the wrong thing to do, it is not symptomatic of deep
>> mathematical flaws.
>>
>> I will note that by our metrics the number of open bugs in Limit
>> dropped
>> sharply between versions 4 and 5 of Mathematica (I am not going to
>> quantify more closely than that).
>>
>>
>> Daniel Lichtblau
>> Wolfram Research
>>
>>
>
> Certainly this model of directed infinities has some peculiar
> properties.
> For example, some functional identities don't hold when infinite
> quantities are involved:
>
> In[1]:= E^Infinity*E^(I*Pi) == E^(Infinity + I*Pi)
>
> Out[1]= False
>
> So E^(a + b) != E^a*E^b. This also means that Exp is not a continuous
> function anymore:
>
> In[2]:= Limit[E^(x + 2*I*ArcTan[x]), x -> Infinity]
>
> Out[2]= Infinity
>
> This is the result we get if we interchange Exp and Limit operations,
> which is equivalent to continuity. However, the correct result is
> -Infinity (Arg tends to Pi).

This is a good example, which indeed brings up one of the problematic
aspects of Mathematica's "intuitive" and "informal" approach to
certain mathematical issues. I am very fond of this informality, but
I think that there are situations where it requires more care on the
part of the user than would be the case with a program that required
the user always to specify domains of functions, ground fields (real
complex) for algebraic structures etc.

In particular,  when one considers such notions as of continuity and
limits one has to be  clear about what topological space one is
working working with. Leaving this out and using "intuition" can
sometimes tie one in all sort of knots. Unfortunately, Mathematica's
"intuitive" approach in this case easily leads to confusion. The
problem is that Matheamtica allows one to combine together objects
belonging to different mathematical realms and perform operations on
them that only make sense in one of them.

One example of this is that Mathematica allows one to combine the
three objects, Infinity, -Infinty and ComplexInfinity in the same
expression. If one treats these as purely formal algebraic entities
one can probably state a consistent set of rules for dealing with all
three in this way, but it is a different matter if you want to
consider topological notions such as convergence. You then need a
well defined topological space and these three object do not belong
to the same one.

In fact there are at least three topological spaces that are relevant
in the context of Infinity, -Infinity and ComplexInfinity. First of
all there is the standard two-point comactification of the real line
(topologically the closed unit interval) [-Infinity,Infinity].
Secondly, there is the "Riemann-sphere" one point compactification of
the complex plane, consisting of all the complex numbers plus the
point at infinity, denoted in Mathematica by ComplexInfinity.

Last  there is something problematic: another "compactification" of
the complex plane  that turns it not into the Riemann sphere but into
a closed disk, with the complex plane corresponding to the open disk
whose boundary consists of DirectedInfinities in various directions.
You can think of it as the complex numbers plus entities of the form
DirectedInfinity[z], where z is a unit complex number. This
compactification includes Infinity=DirectedInfinity[1]  and -
Infinity=DirectedInfinity[-1] but not ComplexInfinity. It is this
compactification that is often used by Mathematica. Unfortunately,
this compactification has rather bad and unintuitive properties
analytic properties.
One of them is that functions continuous on the complex plane
(interior of the disc) may not have a continuous extension to the
boundary. One such example is provided by the exponential function.
Consider the simple question related to Maxim's example: what should
be the value of Exp at DirectedInfinity[1]? One might think that it
is enough to take a sequence of points in the complex plane
converging to DirectedInfinity[1] and take the limit of this sequence
as the value of Exp. But, of course this can't be done in the obvious
way. Indeed, consider the sequences  x=a+ I Pi and x=a + 2 I Pi as a -
> DirectedInfinity[1] along the positive real line. In both cases x
tends to DirectedInfinity[1] (although not along rays form 0!) but in
the first case we have

Simplify[Exp[a + I*Pi], a â?? Reals]

-E^a

while in the second

Simplify[Exp[a + 2*I*Pi], a â?? Reals]

E^a

Thus the first path should give us DirectedInfinity[-1] as the value
of Exp[DirectedInfinity[1]] while the other should give
DirectedInfinity[1]. This forces us to say that Exp[DirectedInfinity
[1]] is actually not defined continuously althogh Exp[Infinity] is
clearly Infinity. Here I am distinguishing Infinity (one of the ends
of the two point compactification of the real line) and
DirectedInfinity[1] but of course Mathematica considers them to be
the same. Actually Exp[DirectedInfinity[1]] should either be left
undefined  or defined as ComplexInfinity.

Of course if Mathematica consistently used the Riemann sphere one
point compactification when dealing with complex infinities such
problems would not occur. In the discussed example the argument would
run as follows:

Consider the expression:

Limit[E^(x + 2*I*ArcTan[x]), x -> Infinity]

possibility that x is a point on the Riemann sphere, since on the
Riemann sphere no such thing as Infinity exists. So we must x as a
real valued variable.  That means of course that 2*I*ArtTan[x] is now
imaginary valued and x + 2*I*ArcTan[x] must lie on the Riemann
sphere. We can now use continuity and the answer turns out to be
uncontroversially
ComplexInfinity (there is no Infinity or -Infinity in the Riemann
sphere model). This would give ComplexInfinity as the final answer.

If we adopted this approach (Infinity and -Infinity are only used in
a purely real context -- the two point compactification of the real
line while in the complex context we always use ComplexInfinity) we
have to approach the problem differently. In order to avoid getting
ComplexInfinity (which is the only infinity in the complex plane) we
would have to make sure that the function whose limit we are seeking
is always real valued. For example, in the above case we could do:

Limit[ComplexExpand[Re[E^(x + 2*I*ArcTan[x])]],
x -> Infinity]

-Infinity

Of course the current version of Mathematica returns

Limit[ComplexExpand[E^(x + 2*I*ArcTan[x])],
x -> Infinity]

-Infinity

which while happens to be what we wanted is, in my opinion,
"incorrect", in view of what I tried to argue above. The correct
answer ought to be ComplexInfinity. I realize that to many this may
seem excessively pedantic but I can't see any other view to deal with
the problem pointed out by Maxim. In other words the proposed
solution is: return Infinity or -Infinity only as limits of functions
which are unambiguously real valued; in all other cases return
ComplexInfinity. DirectedInfinity[1] and DirectedInfinity[-1] should
be distingushed from Infinity and -Infinity.
Expressions such as Infinity + I*Pi should either be returned
unevaluated or interpreted as ComplexInfinity+I*Pi. One could still,
use DirectedInfinity for limits:

Limit[x, x -> DirectedInfinity[I]]

DirectedInfinity[I]

although this answer should (probably) be ComplexInfinity.

The answer ComplexInfininity I consider correct in all cases, though
of course to return it in all cases could sometimes be viewed a "loss
of information".

If anyone has a better idea that solves the problem pointed out by
Maxim then I would like to hear of it.

Andrzej Kozlowski

```

• Prev by Date: Re: Linking to Mathematica Kernel from Excel
• Next by Date: Re: Units, simplification