From: withoff@spider.wri.com (David Withoff)
Subject: Re: more on mma big bad bug 
Summary: Technical explanation
Organization: Wolfram Research, Inc.
Date: Fri, 8 Jan 1993 01:39:31 GMT

In article <15373.2b4c73d5@ohstpy.mps.ohio-state.edu> vandesande@ohstpy.mps.ohio-state.edu writes:
>
>Pi Sqrt[Pi]/(2 2 Sqrt[2])
>
>The explanation for the "big bad bug" from Wolfram is that 
>the Simplification rules for Power conflict.  The expression
>is "simplified" back and forth between two different forms.
>Will fix in another release, they say.  There is no really 
>satisfactory fix.
>
>Here is another big bad bug:
>
>Integrate[E^( - k1*r[1]),{k1, 0, Infinity}]
>
>Note that this expression correctly evaluates in version 2.0.
>
>Brett

I'd like to offer a few thoughts about each of these problems.

First of all, registered users who have encountered these (or any other)
problems with Mathematica are encouraged to contact Technical Support
(support@wri.com) at Wolfram Research for assistance in finding
appropriate solutions.  Both of the above problems are soluble.

The second problem (with Integrate[E^( - k1*r[1]),{k1, 0, Infinity}])
is fairly simple, and there is a simple fix.

The problem shows up in the thin version of the kernel, and is caused
by a conflict between the variable r and a corresponding variable
in the integration packages.  There are a number of solutions, such
as using a different variable the first time the integral is evaluated,
evaluating another integral first (anything that loads the integration
packages will do -- try Integrate[x, {x, 0, 1}]), loading the
integration packages manually (<< Integrate`main`) before doing the
integral, using the full version of the kernel, or editing a few lines
in the integration packages to correct the problem at its source.
The problem will be fixed in the next release.

The other problem, with Pi Sqrt[Pi]/(2 2 Sqrt[2]), was detected and
fixed late last year.  This fix will also be included in the next
release.

In addition to the upcoming fix, it is fairly easy to add
workarounds that will work in Version 2.0 and in Version 2.1, and
that handle all of the examples I have seen.

The bug is present in Version 2.0 and Version 2.1, and is not
machine-dependent.

The fact that the bug has been part of the released product for
several years and was not reported until recently suggests that
it probably doesn't come up very often in practical situations.
I suspect that very few people are affected by it.

As others have already noted, Times and Power perform a number
of automatic transformations.  The infinite loop described here
is caused by a conflict between two such transformations.  The
details of what is going on have also already been posted by
other users.

The loop occurs for the product of a rational number with a
numerator of 1, and a rational power of the product of Pi (or
other numerical constants, like E) and another rational number
with a numerator of 1.

One workaround is to intercept the pattern that leads to the problem
and arrange for it to evaluate to something else.

In[1]:= Unprotect[Times]

Out[1]= {Times}

In[2]:= (Pi*(x_Rational)?(Numerator[#1] == 1 & ))^(y_Rational)*
           (z_Rational)?(Numerator[#1] == 1 & ) := rootPi[y] x^y z

In[3]:= Format[rootPi[y_]] := Pi^y

In[4]:= N[rootPi[y_]] := N[Pi^y]

In[5]:= Pi Sqrt[Pi]/(2 3 Sqrt[2])

          3/2
        Pi
Out[5]= ------
           3/2
        3 2

In[6]:= N[%]

Out[6]= 0.656234

There are a number of other approaches.

Again, registered users who have questions about these or other technical
issues related to their use of Mathematica are encouraged to contact
Wolfram Research Technical Support for assistance.

Dave Withoff
Technical Development
Wolfram Research

Newsgroups: sci.math.symbolic,sci.math.num-analysis,sci.math,sci.math.stat,sci.comp-aided,sci.astro,sci.bio,sci.med,sci.misc,sci.physics,sci.edu,sci.aeronautics,comp.robotics,sci.engr,sci.engr.civil,sci.engr.mech