RandomElement - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

GroupTheory

 RandomElement
 produce a random element of a group
 RandomInvolution
 produce a random involution of a group
 RandomPElement
 produce a random p-element of a group
 RandomPPrimeElement
 produce a random element of a group with order relatively prime to p

 Calling Sequence RandomElement( G ) RandomInvolution( G ) RandomPElement( p, G ) RandomPPrimeElement( p, G )

Parameters

 G - a permutation group p - a prime number

Description

 • The RandomElement( G ) command returns a randomly selected element of the group G.
 • The RandomInvolution( G ) command returns a randomly selected involution (element of order $2$) of the group G. An exception is raised if G has odd order (as in that case, G contains no involutions).
 • For a prime number p, the RandomPElement( p, G ) command returns a random element of the group G with order equal to a power of p. An exception is raised in case p does not divide the order of G.
 • For a prime number p, the RandomPPrimeElement( p, G ) command returns a random element of the group G with order relatively prime to p. An exception is raised if G is a $p$-group.

Examples

 > $\mathrm{with}\left(\mathrm{GroupTheory}\right):$
 > $G≔\mathrm{Group}\left(\left\{\mathrm{Perm}\left(\left[\left[1,2\right]\right]\right),\mathrm{Perm}\left(\left[\left[1,2,3\right],\left[4,5\right]\right]\right)\right\}\right)$
 ${G}{≔}⟨\left({1}{,}{2}\right){,}\left({1}{,}{2}{,}{3}\right)\left({4}{,}{5}\right)⟩$ (1)
 > $\mathrm{RandomElement}\left(G\right)$
 $\left({1}{,}{2}\right)\left({4}{,}{5}\right)$ (2)
 > $\mathrm{RandomElement}\left(G\right)$
 $\left({1}{,}{3}{,}{2}\right)$ (3)
 > $G≔\mathrm{ExceptionalGroup}\left("G2\left(3\right)"\right)$
 ${G}{≔}{{G}}_{{2}}\left({3}\right)$ (4)
 > $\mathrm{RandomInvolution}\left(G\right)$
 $\left({1}{,}{184}\right)\left({2}{,}{325}\right)\left({3}{,}{144}\right)\left({4}{,}{127}\right)\left({5}{,}{207}\right)\left({6}{,}{121}\right)\left({7}{,}{193}\right)\left({8}{,}{106}\right)\left({9}{,}{238}\right)\left({10}{,}{294}\right)\left({11}{,}{13}\right)\left({12}{,}{326}\right)\left({14}{,}{197}\right)\left({15}{,}{303}\right)\left({17}{,}{267}\right)\left({18}{,}{67}\right)\left({20}{,}{107}\right)\left({21}{,}{211}\right)\left({22}{,}{219}\right)\left({23}{,}{318}\right)\left({24}{,}{161}\right)\left({25}{,}{209}\right)\left({26}{,}{126}\right)\left({27}{,}{333}\right)\left({28}{,}{256}\right)\left({29}{,}{298}\right)\left({30}{,}{44}\right)\left({31}{,}{316}\right)\left({32}{,}{194}\right)\left({33}{,}{324}\right)\left({34}{,}{250}\right)\left({35}{,}{172}\right)\left({36}{,}{78}\right)\left({37}{,}{304}\right)\left({38}{,}{321}\right)\left({39}{,}{82}\right)\left({40}{,}{117}\right)\left({41}{,}{91}\right)\left({42}{,}{276}\right)\left({43}{,}{224}\right)\left({45}{,}{47}\right)\left({46}{,}{135}\right)\left({48}{,}{280}\right)\left({49}{,}{143}\right)\left({50}{,}{344}\right)\left({51}{,}{168}\right)\left({52}{,}{96}\right)\left({53}{,}{166}\right)\left({54}{,}{165}\right)\left({55}{,}{277}\right)\left({56}{,}{230}\right)\left({57}{,}{292}\right)\left({58}{,}{338}\right)\left({59}{,}{313}\right)\left({60}{,}{334}\right)\left({61}{,}{158}\right)\left({62}{,}{237}\right)\left({63}{,}{100}\right)\left({64}{,}{89}\right)\left({65}{,}{262}\right)\left({66}{,}{195}\right)\left({68}{,}{315}\right)\left({69}{,}{71}\right)\left({70}{,}{233}\right)\left({72}{,}{263}\right)\left({73}{,}{160}\right)\left({74}{,}{131}\right)\left({75}{,}{279}\right)\left({77}{,}{154}\right)\left({79}{,}{151}\right)\left({81}{,}{124}\right)\left({83}{,}{181}\right)\left({84}{,}{268}\right)\left({86}{,}{282}\right)\left({87}{,}{141}\right)\left({88}{,}{229}\right)\left({90}{,}{191}\right)\left({92}{,}{260}\right)\left({93}{,}{108}\right)\left({94}{,}{310}\right)\left({95}{,}{152}\right)\left({97}{,}{118}\right)\left({98}{,}{252}\right)\left({99}{,}{271}\right)\left({101}{,}{192}\right)\left({102}{,}{287}\right)\left({103}{,}{203}\right)\left({104}{,}{210}\right)\left({105}{,}{272}\right)\left({109}{,}{183}\right)\left({110}{,}{347}\right)\left({111}{,}{213}\right)\left({112}{,}{142}\right)\left({113}{,}{322}\right)\left({114}{,}{115}\right)\left({116}{,}{317}\right)\left({119}{,}{284}\right)\left({120}{,}{137}\right)\left({122}{,}{288}\right)\left({123}{,}{342}\right)\left({125}{,}{218}\right)\left({128}{,}{259}\right)\left({129}{,}{157}\right)\left({130}{,}{264}\right)\left({132}{,}{349}\right)\left({133}{,}{200}\right)\left({134}{,}{198}\right)\left({136}{,}{305}\right)\left({139}{,}{330}\right)\left({140}{,}{182}\right)\left({145}{,}{270}\right)\left({146}{,}{255}\right)\left({147}{,}{240}\right)\left({148}{,}{225}\right)\left({149}{,}{351}\right)\left({153}{,}{247}\right)\left({155}{,}{169}\right)\left({156}{,}{244}\right)\left({159}{,}{306}\right)\left({162}{,}{319}\right)\left({163}{,}{320}\right)\left({164}{,}{340}\right)\left({167}{,}{314}\right)\left({170}{,}{185}\right)\left({171}{,}{220}\right)\left({173}{,}{297}\right)\left({174}{,}{269}\right)\left({175}{,}{296}\right)\left({177}{,}{302}\right)\left({178}{,}{215}\right)\left({179}{,}{285}\right)\left({180}{,}{226}\right)\left({186}{,}{335}\right)\left({187}{,}{301}\right)\left({188}{,}{234}\right)\left({189}{,}{227}\right)\left({190}{,}{293}\right)\left({199}{,}{266}\right)\left({201}{,}{241}\right)\left({202}{,}{261}\right)\left({204}{,}{254}\right)\left({205}{,}{327}\right)\left({206}{,}{251}\right)\left({208}{,}{323}\right)\left({212}{,}{236}\right)\left({216}{,}{336}\right)\left({217}{,}{308}\right)\left({221}{,}{299}\right)\left({222}{,}{295}\right)\left({223}{,}{265}\right)\left({228}{,}{311}\right)\left({232}{,}{248}\right)\left({235}{,}{291}\right)\left({242}{,}{246}\right)\left({243}{,}{286}\right)\left({245}{,}{312}\right)\left({249}{,}{253}\right)\left({257}{,}{290}\right)\left({258}{,}{307}\right)\left({273}{,}{309}\right)\left({274}{,}{283}\right)\left({275}{,}{281}\right)\left({278}{,}{300}\right)\left({328}{,}{350}\right)\left({329}{,}{346}\right)\left({332}{,}{348}\right)\left({337}{,}{341}\right)\left({343}{,}{345}\right)$ (5)
 > $g≔\mathrm{RandomInvolution}\left(G\right)$
 ${g}{≔}\left({2}{,}{230}\right)\left({3}{,}{258}\right)\left({4}{,}{135}\right)\left({5}{,}{133}\right)\left({6}{,}{299}\right)\left({7}{,}{117}\right)\left({8}{,}{145}\right)\left({9}{,}{112}\right)\left({10}{,}{16}\right)\left({11}{,}{85}\right)\left({12}{,}{281}\right)\left({13}{,}{90}\right)\left({15}{,}{170}\right)\left({18}{,}{211}\right)\left({19}{,}{223}\right)\left({20}{,}{267}\right)\left({21}{,}{75}\right)\left({22}{,}{87}\right)\left({23}{,}{218}\right)\left({24}{,}{26}\right)\left({25}{,}{244}\right)\left({27}{,}{44}\right)\left({29}{,}{191}\right)\left({30}{,}{70}\right)\left({31}{,}{97}\right)\left({32}{,}{302}\right)\left({33}{,}{308}\right)\left({34}{,}{316}\right)\left({35}{,}{278}\right)\left({36}{,}{276}\right)\left({37}{,}{348}\right)\left({38}{,}{131}\right)\left({39}{,}{61}\right)\left({40}{,}{271}\right)\left({41}{,}{73}\right)\left({42}{,}{47}\right)\left({43}{,}{106}\right)\left({45}{,}{225}\right)\left({46}{,}{306}\right)\left({48}{,}{340}\right)\left({49}{,}{264}\right)\left({50}{,}{84}\right)\left({51}{,}{288}\right)\left({52}{,}{180}\right)\left({53}{,}{294}\right)\left({54}{,}{186}\right)\left({55}{,}{265}\right)\left({56}{,}{317}\right)\left({57}{,}{199}\right)\left({58}{,}{334}\right)\left({59}{,}{303}\right)\left({60}{,}{270}\right)\left({62}{,}{119}\right)\left({63}{,}{234}\right)\left({64}{,}{197}\right)\left({65}{,}{312}\right)\left({66}{,}{188}\right)\left({67}{,}{125}\right)\left({68}{,}{118}\right)\left({69}{,}{309}\right)\left({71}{,}{212}\right)\left({72}{,}{95}\right)\left({74}{,}{177}\right)\left({76}{,}{235}\right)\left({77}{,}{341}\right)\left({78}{,}{158}\right)\left({79}{,}{200}\right)\left({80}{,}{210}\right)\left({81}{,}{305}\right)\left({82}{,}{122}\right)\left({83}{,}{130}\right)\left({86}{,}{346}\right)\left({88}{,}{332}\right)\left({89}{,}{193}\right)\left({91}{,}{167}\right)\left({92}{,}{240}\right)\left({93}{,}{220}\right)\left({94}{,}{329}\right)\left({96}{,}{156}\right)\left({98}{,}{319}\right)\left({99}{,}{134}\right)\left({100}{,}{178}\right)\left({101}{,}{304}\right)\left({102}{,}{216}\right)\left({103}{,}{307}\right)\left({104}{,}{260}\right)\left({105}{,}{142}\right)\left({107}{,}{321}\right)\left({108}{,}{248}\right)\left({109}{,}{337}\right)\left({110}{,}{147}\right)\left({111}{,}{330}\right)\left({113}{,}{192}\right)\left({114}{,}{165}\right)\left({115}{,}{139}\right)\left({116}{,}{339}\right)\left({120}{,}{279}\right)\left({121}{,}{161}\right)\left({123}{,}{326}\right)\left({124}{,}{238}\right)\left({126}{,}{162}\right)\left({127}{,}{228}\right)\left({128}{,}{336}\right)\left({129}{,}{213}\right)\left({136}{,}{345}\right)\left({138}{,}{203}\right)\left({140}{,}{245}\right)\left({141}{,}{349}\right)\left({143}{,}{163}\right)\left({144}{,}{160}\right)\left({146}{,}{268}\right)\left({148}{,}{296}\right)\left({149}{,}{189}\right)\left({150}{,}{266}\right)\left({151}{,}{313}\right)\left({152}{,}{324}\right)\left({153}{,}{215}\right)\left({154}{,}{196}\right)\left({155}{,}{295}\right)\left({157}{,}{289}\right)\left({159}{,}{184}\right)\left({164}{,}{256}\right)\left({166}{,}{243}\right)\left({168}{,}{227}\right)\left({169}{,}{342}\right)\left({173}{,}{269}\right)\left({174}{,}{241}\right)\left({175}{,}{323}\right)\left({176}{,}{198}\right)\left({179}{,}{284}\right)\left({181}{,}{338}\right)\left({182}{,}{297}\right)\left({183}{,}{285}\right)\left({185}{,}{242}\right)\left({187}{,}{239}\right)\left({190}{,}{262}\right)\left({194}{,}{231}\right)\left({195}{,}{257}\right)\left({201}{,}{247}\right)\left({202}{,}{221}\right)\left({204}{,}{282}\right)\left({205}{,}{351}\right)\left({206}{,}{229}\right)\left({207}{,}{343}\right)\left({208}{,}{327}\right)\left({214}{,}{318}\right)\left({217}{,}{253}\right)\left({219}{,}{274}\right)\left({222}{,}{261}\right)\left({224}{,}{254}\right)\left({226}{,}{292}\right)\left({232}{,}{325}\right)\left({233}{,}{236}\right)\left({246}{,}{272}\right)\left({249}{,}{301}\right)\left({250}{,}{251}\right)\left({252}{,}{350}\right)\left({259}{,}{315}\right)\left({275}{,}{328}\right)\left({277}{,}{283}\right)\left({280}{,}{286}\right)\left({287}{,}{322}\right)\left({290}{,}{293}\right)\left({291}{,}{311}\right)\left({298}{,}{344}\right)\left({300}{,}{347}\right)\left({310}{,}{320}\right)\left({331}{,}{333}\right)$ (6)
 > $g\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{in}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}G$
 ${\mathrm{true}}$ (7)
 > $\mathrm{PermOrder}\left(g\right)$
 ${2}$ (8)
 > $G≔\mathrm{QuasicyclicGroup}\left(5,'\mathrm{form}'="multiplicative"\right)$
 ${G}{≔}{{C}}_{{{5}}^{{\mathrm{\infty }}}}$ (9)
 > $g≔\mathrm{RandomElement}\left(G\right)$
 ${g}{≔}{{ⅇ}}^{\frac{{2140214}{}{I}}{{9765625}}{}{\mathrm{\pi }}}$ (10)
 > $g\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{in}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}G$
 ${\mathrm{true}}$ (11)
 > $G≔\mathrm{DihedralGroup}\left(5\right)$
 ${G}{≔}{{\mathbf{D}}}_{{5}}$ (12)
 > $g≔\mathrm{RandomPElement}\left(5,G\right)$
 ${g}{≔}\left({1}{,}{3}{,}{5}{,}{2}{,}{4}\right)$ (13)
 > $g\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{in}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}G$
 ${\mathrm{true}}$ (14)
 > $\mathrm{PermOrder}\left(g\right)$
 ${5}$ (15)
 > $g≔\mathrm{RandomPPrimeElement}\left(5,G\right)$
 ${g}{≔}\left({1}{,}{2}\right)\left({3}{,}{5}\right)$ (16)
 > $g\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{in}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}G$
 ${\mathrm{true}}$ (17)
 > $\mathrm{PermOrder}\left(g\right)$
 ${2}$ (18)
 > $G≔\mathrm{DihedralGroup}\left(120\right):$
 > { to 100 do PermOrder( RandomPElement( 2, G ) ) end };
 $\left\{{2}{,}{4}{,}{8}\right\}$ (19)
 > { to 100 do PermOrder( RandomPPrimeElement( 2, G ) ) end };
 $\left\{{3}{,}{5}{,}{15}\right\}$ (20)
 > { to 100 do PermOrder( RandomInvolution( G ) ) end };
 $\left\{{2}\right\}$ (21)

Compatibility

 • The GroupTheory[RandomElement] command was introduced in Maple 17.
 • For more information on Maple 17 changes, see Updates in Maple 17.
 • The GroupTheory[RandomInvolution], GroupTheory[RandomPElement] and GroupTheory[RandomPPrimeElement] commands were introduced in Maple 2019.
 • For more information on Maple 2019 changes, see Updates in Maple 2019.

 See Also