Re: What to do?
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: What to do?
- From: withoff
- Date: Thu, 7 Jan 93 18:33:01 CST
> The internet is alive with news of a simple expression that > hangs up mma. I am 99.9% sure that someone from wri must > have picked up the bad news, but just to assure that last .1% ... Yes, I saw that discussion too. The bug that led to the discussion was detected and fixed late last year. The fix will be included in an upcoming release. My guess is that very few people are affected by it. Nevertheless, I would like to offer an explanation. 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. Registered users who have encountered this (or any other) problem are encouraged to contact Wolfram Research Technical Support (support at wri.com) for assistance in finding an appropriate solution. For those of you who didn't see the original internet discussion, here's a summary: A user reported that Pi Sqrt[Pi]/(2 3 Sqrt[2]) sends Mathematica into an infinite loop. What followed was a stream of responses (at last count there were 18) noting various properties of the bug, pointing out that it shows up on lots of different computers, and requesting explanations. One of the responses was from Richard Fateman: > At this point, I think posters should cease reporting that this occurs > on their machine and system. While I probably get as many jollies > poking at different systems' foibles, it gets boring to see them, and > I'd hate to think that EVERY bug (and alleged bug!) is going to be > bandied about this way. Presumably someone at WRI reads this and will > fix it. I would have preferred it if the first poster had reported > this to WRI, and then reported back to this netnews list the results > of his/her inquiry. The person who posted the original message sent an inquiry to Technical Support at Wolfram Research earlier this week, and a response was sent a few days later. Times and Power include a number of automatic transformations (Sqrt[8] --> 2^(3/2), Sqrt[2] Sqrt[Pi] --> Sqrt[2 Pi], etc.), largely to get expressions into a canonical form. The infinite loop described here arises because of a conflict between two such transformations. There are a number of ways of seeing the loop, one of which is to attach rules to Power and Times to have them announce what they are doing. In[13]:= Pi Sqrt[Pi]/(2 3 Sqrt[2]) ... ... ... Power evaluating: (Pi/2)^(3/2)/3 Times evaluating: Pi^3 Power evaluating: Pi^3/8 Times evaluating: (Pi^3/8)^(1/2) Power evaluating: Pi/2 Times evaluating: (Pi/2)^(3/2) Power evaluating: (Pi/2)^(3/2)/3 Times evaluating: Pi^3 Power evaluating: Pi^3/8 Times evaluating: (Pi^3/8)^(1/2) Power evaluating: Pi/2 Times evaluating: (Pi/2)^(3/2) Power evaluating: (Pi/2)^(3/2)/3 Times evaluating: Pi^3 ... ... ... 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. Although a universally appropriate solution is not known, it is possible to work around all of the examples I have seen. For example: 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 If you have questions about this or other issues related to Mathematica, you are welcome to send them to Technical Support. (Or you could send them to mathgroup, where they seem to get answered fairly promptly as well!) Dave Withoff Wolfram Research