[GAP Forum] Is there a simple way to view the source of the function (ex. IsSolvable)?
buynnnmmm1 at yahoo.co.jp
buynnnmmm1 at yahoo.co.jp
Wed Sep 17 00:17:07 BST 2014
Dear Stefan Kohl,
It's wonderful! It's great!
Thank you very much for your help!
P.S.
I resent same e-mail, because I forgot cc:.
With best regards
----- Original Message -----
> From: Stefan Kohl <stefan at mcs.st-and.ac.uk>
> To: Stephen Linton <steve.linton at st-andrews.ac.uk>
> Cc: buynnnmmm1 at yahoo.co.jp; support at gap-system.org
> Date: 2014/9/17, Wed 08:05
> Subject: Re: [GAP Forum] Is there a simple way to view the source of the function (ex. IsSolvable)?
>
> On Tue, September 16, 2014 10:53 pm, Stephen Linton wrote:
>> The thing is that IsSolvable is not really a single function, it is an
> Operation.
>>
>> An Operation in GAP is a collection of functions called Methods that can be
> used to
>> compute the result for different kinds of objects.
>>
>> You can get the actual Method applied to particular objects via
> “ApplicableMethod”. For
>> instance:
>>
>> gap> g := SymmetricGroup(5);
>> Sym( [ 1 .. 5 ] )
>> gap> ApplicableMethod(IsSolvableGroup,[g]);
>> function( G ) ... end
>> gap> f := last;
>> function( G ) ... end
>> gap> Print(f);
>> function ( G )
>> local pcgs;
>> pcgs := TryPcgsPermGroup( G, false, false, true );
>> if IsPcgs( pcgs ) then
>> SetIndicesEANormalSteps( pcgs, pcgs!.permpcgsNormalSteps );
>> SetIsPcgsElementaryAbelianSeries( pcgs, true );
>> if not HasPcgs( G ) then
>> SetPcgs( G, pcgs );
>> fi;
>> if not HasPcgsElementaryAbelianSeries( G ) then
>> SetPcgsElementaryAbelianSeries( G, pcgs );
>> fi;
>> return true;
>> else
>> return false;
>> fi;
>> return;
>> end
>> gap> FilenameFunc(f);
>> "/Users/sal/HG/gap/lib/grpperm.gi"
>> gap> StartlineFunc(f);
>> 1221
>>
>> So the Method that would apply to this particular group is found in
> grpperm.gi starting
>> at line 1221 (in my development version of GAP).
>
> A slightly more direct approach is with PageSource:
>
> gap> PageSource(ApplicableMethod(IsSolvableGroup,[SymmetricGroup(5)]));
> Showing source in /cygdrive/c/GAP/GAP4R7/lib/grpperm.gi (from line 1216)
> #############################################################################
> ##
> #M IsSolvableGroup( <G> ) . . . . . . . . . . . . . . . . solvability
> test
> ##
> InstallMethod( IsSolvableGroup,"for permgrp", true, [ IsPermGroup ],
> 0,
> function(G)
> local pcgs;
> pcgs:=TryPcgsPermGroup( G, false, false, true );
> if IsPcgs(pcgs) then
> SetIndicesEANormalSteps(pcgs,pcgs!.permpcgsNormalSteps);
> SetIsPcgsElementaryAbelianSeries(pcgs,true);
> if not HasPcgs(G) then
> SetPcgs(G,pcgs);
> fi;
> if not HasPcgsElementaryAbelianSeries(G) then
> SetPcgsElementaryAbelianSeries(G,pcgs);
> fi;
> return true;
> else
> return false;
> fi;
> end);
>
> Stefan
>
More information about the Forum
mailing list