I generally use GAP, but because GAP lacks visualization capabilities, I recently started exploring polymake for plotting purposes. What I want to achieve is plotting the icosahedral group (regular icosahedron) and the binary icosahedral group. With this aim, I have some questions:
Is there any direct access to these two groups in polymake? By this, I mean that, for example, in GAP, you can simply say g:=SL(2,5) and access the group and its generators easily. Is such a thing possible in polymake?
I am trying to plot a regular icosahedron just like in the following image: https://en.wikipedia.org/wiki/Regular_i ... angles.svg and I have the following code:
Code: Select all
use application 'polytope';
my $phi = (1 + sqrt(5)) / 2;
# Define the vertices of an icosahedron
my $v = new Matrix<Rational>([
[-1, 0, 0],
[1, 0, 0],
[0, -1, 0],
[0, 1, 0],
[0, 0, -1],
[0, 0, 1],
[0, -1/$phi, -$phi],
[0, 1/$phi, -$phi],
[0, -1/$phi, $phi],
[0, 1/$phi, $phi],
[-1/$phi, -$phi, 0],
[1/$phi, -$phi, 0],
[-1/$phi, $phi, 0],
[1/$phi, $phi, 0],
[-$phi, 0, -1/$phi],
[$phi, 0, -1/$phi],
[-$phi, 0, 1/$phi],
[$phi, 0, 1/$phi],
[-$phi, -1/$phi, 0],
[$phi, -1/$phi, 0],
[-$phi, 1/$phi, 0],
[$phi, 1/$phi, 0],
]);
# Define the faces of the icosahedron
my $f = new Matrix<Rational>([
[0, 8, 4],
[0, 5, 10],
[0, 4, 5],
[0, 10, 11],
[0, 11, 8],
[1, 6, 9],
[1, 7, 6],
[1, 9, 11],
[1, 10, 7],
[1, 11, 10],
[2, 7, 9],
[2, 8, 3],
[2, 6, 7],
[2, 9, 3],
[2, 3, 8],
[3, 4, 8],
[3, 9, 4],
[3, 6, 4],
[3, 5, 6],
[3, 10, 5]
]);
# Create the icosahedron
my $P = new Polytope(POINTS=>$v, FACETS=>$f);
# Visualize the icosahedron
$P->VISUAL;
Code: Select all
use application 'polytope';
# Define rotation matrices for the icosahedral group
my @rotations;
for (my $i = 0; $i < 3; $i++) {
for (my $j = 0; $j < 3; $j++) {
next if $i == $j;
for my $sign (1, -1) {
my $mat = new Matrix<Rational>([
[$i == 0 ? $sign : 0, $j == 1 ? $sign : 0, $i == 2 ? $sign : 0],
[$i == 1 ? $sign : 0, $j == 2 ? $sign : 0, $j == 0 ? $sign : 0],
[$j == 2 ? $sign : 0, $i == 0 ? $sign : 0, $j == 1 ? $sign : 0]
]);
push @rotations, $mat;
}
}
}
# Define vertices of an icosahedron
my $v = new Matrix<Rational>([
[-1, 0, 0], [1, 0, 0], [0, -1, 0], [0, 1, 0], [0, 0, -1], [0, 0, 1]
]);
# Create the icosahedron
my $P = new Polytope(POINTS=>$v);
# Apply the rotation matrices to the vertices of the icosahedron
for my $rot (@rotations) {
my @transformed_vertices;
for my $i (0 .. $v->rows - 1) {
my $vertex = $v->row($i);
my $transformed_vertex = $vertex * $rot;
# Calculate the magnitude of the transformed vertex
my $magnitude = sqrt($transformed_vertex->[0]**2 + $transformed_vertex->[1]**2 + $transformed_vertex->[2]**2);
# Check if the magnitude is not zero
if ($magnitude > 0) {
push @transformed_vertices, $transformed_vertex;
}
}
# Create a new Polytope with the transformed vertices and visualize it
my $transformed = new Polytope(POINTS=>\@transformed_vertices);
$transformed->VISUAL;
}