> < ^ Date: Wed, 18 Sep 1996 18:42:13 +0200
> < ^ From: Richard Rossmanith <richard@maxp03.mathe.uni-jena.de >
> ^ Subject: Gaps in GAP's functions for polynomials

Dear Gap-Forum,

I have encountered two small gaps in GAP's functions that deal (or rather,
refuse to deal) with polynomials:

1. The HTML-GAP-Manual, Release 3.4 (10. Jul. 1994), states that
> there is no generic way to test whether a [Ring] element is irreducible.
Yes, there is:

RingOps.IsIrreducible:=function(arg)
if Length(arg)=1 then
return Length(Factors(arg))=1;
elif Length(arg)=2 then
return Length(Factors(arg,arg))=1;
else
Error("Wrong number of arguments");
fi;
end;

2. Usually, you use a list to define a polynomial. But maybe later on, you want
the list back, and you want that simply by using the command List(p). (E.g. I
wanted to construct the companion matrix of a polynomial.) The following patch
for List allows this:

```List:=function ( arg )
local  lst, i, fun;
if Length( arg ) = 1  then
if IsString( arg )  then
lst := [  ];
for i  in [ 1 .. LengthString( arg ) ]  do
lst[i] := SubString( arg, i, i );
od;
elif IsList( arg )  then
lst := arg;
elif IsPerm( arg )  then
lst := [  ];
for i  in [ 1 .. LargestMovedPointPerm( arg ) ]  do
lst[i] := i ^ arg;
od;
elif IsWord( arg )  then
lst := [  ];
for i  in [ 1 .. LengthWord( arg ) ]  do
lst[i] := Subword( arg, i, i );
od;
elif IsPolynomial( arg )  then   #  *** THIS IS ***
lst := arg.coefficients;     #  *** NEW !!! ***
else
Error( "can't convert ", arg, " into a list" );
fi;
elif Length( arg ) = 2 and IsList( arg ) and IsFunc( arg )  then
lst := [  ];
fun := arg;
for i  in [ 1 .. Length( arg ) ]  do
lst[i] := fun( arg[i] );
od;
else
Error( "usage: List( <obj> ) or List( <list>, <func> )" );
fi;
return lst;
end;
```

Regards, Richard

```_______________________________________________________________________________
richard rossmanith
http://www.minet.uni-jena.de/~richard/
```

> < [top]