[GAP Forum] Orbit of group action on matrices
Keshav Rao Kini
krkini at ntu.edu.sg
Sat Sep 25 08:50:37 BST 2010
Hello,
As the message states, you cannot assign values to elements of an immutable list. When you tested your act function at the prompt, you passed it a list literal, which is mutable. Presumably Orbit() is passing your function an immutable list (which is wise as it preserves the arguments you sent to Orbit()), which your function then chokes on. You could try for example using ShallowCopy() on the list x which is passed to your function:
gap> act:=function(x,g)
> local i,y;
> y:=ShallowCopy(x);
> for i in [1..Length(y[1])] do y[i]:=Permuted(y[i],g); od;
> return Permuted(y,g);
> end;
function( x, g ) ... end
gap> act([[1,2],[3,4]],(1,2));
[ [ 4, 3 ], [ 2, 1 ] ]
gap> Orbit(Group((1,2)),[[1,2],[3,4]],act);
[ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 4, 3 ], [ 2, 1 ] ] ]
gap>
As I am a GAP beginner, I can't guarantee that there isn't a better way to do this, but it seems to work ;) Here is some more information about mutability: http://www.gap-system.org/Manuals/doc/htm/ref/CHAP012.htm#SECT006
Yours,
Keshav
On Sat, Sep 25, 2010 at 14:36, Benjamin Sambale <bsambale at gmx.de<mailto:bsambale at gmx.de>> wrote:
Dear Forum,
I've defined an action of a permutation group on a set of square
matrices in the following way:
act:=function(x,g)
local i;
for i in [1..Length(x[1])] do x[i]:=Permuted(x[i],g); od;
return Permuted(x,g);
end;
This works as expected, for example:
gap> act([[1,2],[3,4]],(1,2));
[ [ 4, 3 ], [ 2, 1 ] ]
However, using the Orbit command gives
gap> Orbit(Group((1,2)),[[1,2],[3,4]],act);
Lists Assignment: <list> must be a mutable list
What is wrong here?
Thanks,
Benjamin Sambale
_______________________________________________
Forum mailing list
Forum at mail.gap-system.org<mailto:Forum at mail.gap-system.org>
http://mail.gap-system.org/mailman/listinfo/forum
________________________________
CONFIDENTIALITY: This email is intended solely for the person(s) named and may be confidential and/or privileged. If you are not the intended recipient, please delete it, notify us and do not copy, use, or disclose its content. Thank you.
Towards A Sustainable Earth: Print Only When Necessary
More information about the Forum
mailing list