Frank Quinn asked:
I have commutative rational algebras that are supposed to be semisimple
over some cyclotomic field. How can I find this structure? Extending
coefficients to "Cyclotomics" and using "CentralIdempotentsOfAlgebra" gives
a crash, apparently because GAP cannot factor polynomials over cyclotomics.
The algorithm to compute idempotents crucially needs to factorize a polynomial. (The problem is equivalent to a problem of polynomial factorization.)
Unfortunately at the moment GAP 4 does not contain code to factorize
polynomials over algebraic number fields.
For finite degree extensions this is not a fundamental problem: We had an
algorithm for this in GAP 3, but so far I did not find time to convert it to
(If you need to solve this problem we could provide you with code that will
allow you to ``feed in'' a polynomial factorization obtained by another
In principle this should be sufficient for factorization over the
cyclotomics as well, though I don't see how to find the smallest subfield
that contains all the cyclotomic elements needed to factor a given
> Is there some way to find where the implementation of a function is in the
> library? For instance material related to structure constant tables for
> algebras occurs in at least three different files. Reading the code can be
> very helpful, but I can't always find it.
I fear there is no general solution to this, but probably the following
remarks are of help:
There is a function `ApplicableMethod' that will return the function
used as a method for an operation. It is not yet documented in 4b5, but I
append the documentation as it will be in the next release.
<algebra over Rationals, with 1 generators>
#I Searching Method for CentralIdempotentsOfSemiring with 1 arguments:
#I Total: 3 entries
2: ``CentralIdempotentsOfSemiring: for an associative algebra'', value: 36
function( A ) ... end
(Now `meth' is a function you can `Print'.)
To find the occurrence of functions and methods in the library, I tend to
use `grep'. To find a function, I search for the function name in the `gd'
files (as it is declared only once, only one file will show), it is very
likely the function will occur in the corresponding `gi' file.
To find a method I search for `Method(' (this catches `InstallMethod' and
`InstallOtherMethod' and the installation string (`ApplicableMethod' will
print it in the higher print levels) or the operation name.
(It would be nice to have better browsing tools, but I fear at the moment
this is beyond our capabilities.)
Finally, allow me to plug my talk at our Workshop in Linz about the library
which gives a little bit further information. Slides can be found at:
I hope this is of some help,
% the manual section on `ApplicableMethod':
\>ApplicableMethod( <opr>, <args>[, <printlevel>] ) F
\>ApplicableMethod( <opr>, <args>, <printlevel>, <nr> ) F
\>ApplicableMethod( <opr>, <args>, <printlevel>, "all" ) F
In the first form, `ApplicableMethod' returns the method of highest rank
that is applicable for the operation <opr> with the arguments in the
The default <printlevel> is `0'.
If no method is applicable then `fail' is returned.
In the second form, if <nr> is a positive integer then
`ApplicableMethod' returns the <nr>-th applicable method for the
operation <opr> with the arguments in the list <args>, where the methods
are ordered according to descending rank. If less than <nr> methods are
applicable then `fail' is returned.
If the fourth argument is the string `"all"' then `ApplicableMethod'
returns a list of all applicable methods for <opr> with arguments
<args>, ordered according to descending rank.
Depending on the integer value <printlevel>, additional information is
printed. Admissible values and their meaning are as follows.
information about the applicable method,
also information about the not applicable methods of higher rank,
also for each not applicable method the first reason why it is not
also for each not applicable method all reasons why it is not
also the function body of the selected method(s)
When a method returned by `ApplicableMethod' is called then it returns
either the desired result or the string `TRY_NEXT_METHOD', which
corresponds to a call to `TryNextMethod' in the method and means that
the method selection would call the next applicable method.
*Note:* The kernel provides special treatment for the infix operations
`\\+', `\\-', `\\*', `\\/', `\\^', `\\mod' and `\\in'. For some kernel
objects (notably cyclotomic numbers, finite field elements and vectors
thereof) it calls kernel methods circumventing the method selection
mechanism. Therefore for these operations `ApplicableMethod' may return
a method which is not the kernel method actually used.