11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

146 • Chapter 3: <strong>Programming</strong> with Modules> GroupOrder := proc( G )> description "compute the order of a finite group";> if type( G, ’SubGroup’ ) then> nops( GroupElements( G ) )> elif type( G, ’Group’ ) then> if type( G:-order, ’posint’ ) then> G:-order> elif type( G:-elements, ’set’ ) then> G:-order := nops( G:-elements )> elif type( G:-order, ’procedure’ ) then> G:-order()> else> nops( GroupElements( G ) )> end if> else> ’procname’( args )> end if> end proc:As with GroupElements, this routine checks the possible shortcuts thatmight be available for a group. It begins with those that are likely toinvolve the least computation and progresses through more costly alternatives.Only as a last resort does the procedure call GroupElements tocompute a full enumeration of the group elements only to return theirnumber.> G := Symmetric( 4 );G := module()exportid , ‘.‘, mul , inv, eq, member, gens, order, elements;option record ;end module> C := Centralizer( G, [ 1, 3, 2, 4 ] );> GroupOrder( G );C := module()export parent, test;option record ;end module24

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!