Re: bug in CoefficientArrays?
- To: mathgroup at smc.vnet.net
- Subject: [mg43927] Re: [mg43923] bug in CoefficientArrays?
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Mon, 13 Oct 2003 04:04:31 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On Sunday, October 12, 2003, at 05:03 PM, Mark Fisher wrote:
> FYI: This looks like a bug to me:
>
> In[77]:=
> poly=a+(1-b)(c-d)x-e y;
> {m0,m1}=CoefficientArrays[poly,{x,y}];
> m0+m1.{x,y}-poly//Simplify
>
> Out[79]=
> (d-b d+c (-1+b+b d)) x
>
> --Mark
>
>
According to the documentation, the first argument in CoefficientArrays
ought to be a list of polynomials rather than a single polynomial and :
In[1]:=
poly=a+(1-b)(c-d)x-e y;
In[2]:=
{m0,m1}=CoefficientArrays[{poly},{x,y}];
In[3]:=
m0+m1.{x,y}-poly//Simplify
Out[3]=
{0}
Of course it is trivial to modify CoefficientArrays to work properly
with just a single polynomial, and since this sort of thing is the
usual approach in Mathematica (e.g. Solve with a single equation vs.
Solve with a system of equations) it seems like an oversight that it
was not done here. But as the documentation clearly says "The first
element a has the same length as the list polys", the word "bug" is not
strictly appropriate.
Andrzej Kozlowski
Yokohama, Japan
http://www.mimuw.edu.pl/~akoz/
http://platon.c.u-tokyo.ac.jp/andrzej/