Bug in Solve/Reduce?
- To: mathgroup
- Subject: Bug in Solve/Reduce?
- From: sdoyle at fed.frb.gov
- Date: Tue, 25 Apr 89 09:58:32 CDT
I've run into a problem with Solve and Reduce where it appears to be `creating' null variables that only contain the name of the Context where the manipulations are taking place. To re-create the problem, just read in the file `SolveBug.m' (included below) in the normal way. This defines a symbol poly with a fourth degree polynomial in X and sets the Cubics option of Roots to False. When you enter Solve[poly==0, X] an answer is returned that contains a variable Global` (the Context name with no symbol appended). I've included sample session following SolveBug.m. The FullForm of the value returned by Reduce also contains this null variable. Any Ideas? Or... Did I make a mistake? Is it an error to turn off the Cubics option but not the Quartics? Any help appreciated! Sean Doyle Board of Governors of the Federal Reserve System Washington, DC 20551 (202) 452-2352 uucp: uunet!fed!m1swd00 , internet: sdoyle at fed.frb.gov (* ****************** Start of SolveBug.m ****************** *) (* Bug in Solve/Reduce *) (* Set options for Roots *) SetOptions[Roots, Cubics->False] (* Define polynomial in X *) poly = (d e + f g) a c b^2 X^4 + (a e + c d) b X^3 + (1 + 2 (d e + f g) a b c) X^2 + (a e + c d) X + (d e + f g) a c Print["Input Polynomial: ", poly] Print["Solve[poly==0, X]",Solve[poly==0, X]]; (* **************** End of SolveBug.m ************************* *) **** Session: Part 1. Notice that the solution contains the **** variable Global`. If I bury this in a Package, the name of **** the package is there instead. Why should there be a package **** name in the middle of an expression with no variable attached? mqws2(14)% math SunMathematica (sun3.68881) 1.1 (September 14, 1988) [With pre-loaded data] by S. Wolfram, D. Grayson, R. Maeder, H. Cejtin, S. Omohundro, D. Ballman and J. Keiper Copyright 1988 Wolfram Research Inc. -- SunView graphics initialized -- In[1]:= <<SolveBug.m 2 Input Polynomial: X (1 + 2 a b c (d e + f g)) + X (c d + a e) + 3 4 2 > X b (c d + a e) + a c (d e + f g) + X a b c (d e + f g) Solve[poly==0, X]{{X -> -(b (c d + a e)) > (--------------------------- + 2 2 2 (a b c d e + a b c f g) Global` > Sqrt[-4 (------- - 2 <<< And so on.... the output goes on for a while with many Global` variables appearing... >> In[2]:= **** Now let's look at the FullForm of this expression. It still contains **** the Global` context string with no variable attached. Out[4]//FullForm= > List[List[Rule[X, Times[Rational[1, 2], > Plus[Times[Rational[-1, 2], b, > Plus[Times[c, d], Times[a, e]], > Power[Plus[Times[a, Power[b, 2], c, d, e], > Times[a, Power[b, 2], c, f, g]], -1]], > Power[Plus[Times[-4, > Plus[Times[Rational[1, 2], Global`], > Times[-1, <<< And so on. The expression goes on for a number of lines...>>> **** The Global` variables appear in output from Reduce as well.