Re: Bug in PolynomialReduce
- To: mathgroup at smc.vnet.net
- Subject: [mg15041] Re: Bug in PolynomialReduce
- From: Daniel Lichtblau <danl>
- Date: Wed, 9 Dec 1998 04:12:25 -0500
- Organization: Wolfram Research, Inc.
- References: <74aier$44f@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Greg Arnold wrote: > > Hello all, > > I'm trying to use GroebnerBasis and PolynomialReduce to simplify > equations which I'm trying to integrate. My general problem is that I > want to be able to substitute for complex functions. However, I'm not > getting the expected result even for this fairly simple case: > > In[46]:= > gb=GroebnerBasis[{r1==z/y,r2==x/y},{x,y,z,r1,r2}]; gb // InputForm > > Out[46]//InputForm= > {r1*y - z, -r1 + z/y, x - r2*y} > > In[48]:= > Length[gb] > > Out[48]= > 3 > > In[53]:= > pr=PolynomialReduce[ z/y+x/y,gb,{x,y,z,r1,r2}]; pr // InputForm > > Out[53]//InputForm= > {{0, 0, y^(-1), 0}, (r2*y + z)/y} > > (1) I expect to have only 3 coefficients (not 4) in the first part, This is a small bug. The problem is that PolynomialReduce creates a list of polynomials for the second argument, and this list includes an "extra" polynomial to handle an internal variable denoting the reciprocal of y. Instead it (PolynomialReduce) should issue a warning message and not use any hidden internal polynomials. This is something I will fix. > and (2) the residual (the last part) should reduce to r1+r2 > > Am I doing something wrong?... > > P.S. I did notice that if I choose the order {x,z,y,r1,r2}, then I will > get the expected result for both (1) and (2)!. However, I cannot think > of a way to decide which way(s) will work and which will not. > ... Note that GroebnerBasis and PolynomialReduce are only defined for polynomial inputs, so there is some necessity of forming internal variables for an example such as the one given above. If instead you avoid this then the result will not be subject to undocumented internals for handling non-polynomials. So I would do this example by making everything explicitly polynomial, introducing a new variable and polynomial to handle 1/y, and ordering the variables so that the r's are last. Specifically: In[2]:= gb = GroebnerBasis[{r1-z*yrecip,r2-x*yrecip,y*yrecip-1}, {yrecip,x,y,z,r1,r2}] Out[2]= {r1 y - z, x - r2 y, r1 - yrecip z, -1 + y yrecip} In[3]:= pr = PolynomialReduce[ z*yrecip+x*yrecip, gb, {yrecip,x,y,z,r1,r2}] Out[3]= {{0, yrecip, -1, r2}, r1 + r2} Daniel Lichtblau Wolfram Research