[GAP Forum] Re: Coefficients of constant polynomials
Alexander Hulpke
hulpke at mac.com
Mon Mar 6 02:33:14 GMT 2006
Dear Gap Forum,
Someone called `Anvita' wrote:
>
>>> If the function "CoefficientsOfUnivariatePolynomial" is applied
>>> to the
>>> unit polynomial, the result is [ 1 ], as expected:
>>> ...
>>> For the zero polynomial, however, it returns an empty set:
>>
>> Yes. the zero polynomial is stored by an empty coefficient list, as
>> there are no nonzero coefficients.
>>
>
> If the zero polynomial is stored as an empty list then why does the
> function
> "UnivariatePolynomial" return an error with an empty list as the
> second
> argument?
That is an oversight. (The conditions on coefficients is to be a list
of ring elements, the empty list does not qualify and needs to be
treated specially.) Thank you for spotting this. It will be corrected
in a future release.
As a workaround you can issue the command:
InstallOtherMethod( UnivariatePolynomial, "ring,empty cof",true,
[ IsRing, IsEmpty ], 0,
function( ring, cofs )
return LaurentPolynomialByCoefficients( ElementsFamily(FamilyObj
(ring)),cofs, 0, 1 );
end );
Best wishes,
Alexander Hulpke
More information about the Forum
mailing list