Ask Your Question

Peter Heinig's profile - activity

2019-08-26 14:13:03 -0500 received badge  Popular Question (source)
2019-06-04 17:34:24 -0500 received badge  Popular Question (source)
2018-03-26 07:14:00 -0500 received badge  Nice Question (source)
2018-03-23 13:07:01 -0500 asked a question How to test with whether a group is cyclic?

Does Sage offer a 'native' way to test whether a group is cyclic?

Remarks. Needless to say, Sage offers commands like 'is_abelian()' or 'is_finite()', but wherever I look, nothing like 'is_cyclic'.

2018-03-15 12:21:39 -0500 asked a question Why does this program sometimes cause an error message, while sometimes it runs perfectly?

I simply do not understand why the program





G = PermutationGroup([p0,p1]).cayley_graph(connecting_set=[p0,p1]).to_simple()



seems to work perfectly about half of the time (I did not measure the success-probability precisely), but every other time yields the error message

Traceback (click to the left of this block for traceback)


ValueError: An element appears twice. It should not.

Question. What did I do wrong?

Again, often, I do not encounter any error. I recognize that I use random numbers as input, and the obvious guess is that this a contributing cause of the error, but, still, to me it seems that this should run each and every time.

2018-03-09 09:50:57 -0500 asked a question Is it possible to send a saved list of data to the sagecell-server

Is it possible to send a precomputed list L that one has computed and saved with


to the server at and then do a calculation with L on that server? If so, how?

2018-03-08 08:11:16 -0500 received badge  Supporter (source)
2018-03-08 04:21:30 -0500 received badge  Student (source)
2018-03-08 02:27:10 -0500 asked a question How to take an initial segment of the data structure graphs(n) ?

Is there a possibility to access individual elements of the data-structure constructed by the command


? How to take an initial segment of it?

It seems not to be a list, which presumably is the reason why commands like ' graphs(7)[0] ' or ' graphs(7)[:5] ' are not allowed.

2018-03-07 12:26:15 -0500 received badge  Scholar (source)
2018-03-07 07:41:16 -0500 asked a question What is a possibility to tell Sage to turn a list into a multiset?

A well-known computer algebra package features a useful command called 'Tally', which e.g. takes a list like 2,1,2,2,3,1 and returns the list of pairs (1,2),(2,3),(3,1), where the second component of each pair equals the multiplicity of the first component of the pair in the input list. Currently, I am learning more Sage, and I need some functionality like the above.

My question. Is there a 'native' way to do the same in Sage? Of course, I could program something like this, but what is, in your opinion, the currently 'best' way to turn an arbitrary list into a multiset, with the multiplicities conveniently recorded?