|  |  A.5.2 Invariants of a finite group 
Two algorithms to compute the invariant ring are implemented in
SINGULAR, invariant_ringandinvariant_ring_random,
both by Agnes E. Heydtmann (agnes@math.uni-sb.de). 
Bases of homogeneous invariants are generated successively and those are
chosen as primary invariants that lower the dimension of the ideal
generated by the previously found invariants (see paper "Generating a
Noetherian Normalization of the Invariant Ring of a Finite Group" by
Decker, Heydtmann, Schreyer (J.Symb.Comput. 25, No.6, 727-731, 1998).
In the non-modular case secondary invariants are calculated by finding a basis
(in terms of monomials) of the basering modulo the primary invariants,
mapping to invariants with the Reynolds operator and using those or
their power products such that they are linearly independent modulo the
primary invariants (see paper "Some Algorithms in Invariant Theory of
Finite Groups" by Kemper and Steel
(In: Proceedings of the Euroconference in Essen 1997, Birkhäuser Prog. Math. 173, 267-285, 1999)).
In the modular case they
are generated according to "Calculating Invariant Rings of Finite Groups
over Arbitrary Fields" by Kemper (J.Symb.Comput. 21, No.3, 351-366, 1996).
 
We calculate now an example from Sturmfels: "Algorithms in Invariant
Theory 2.3.7":
 
 |  |   LIB "finvar.lib";
  ring R=0,(x,y,z),dp;
  matrix A[3][3]=0,1,0,-1,0,0,0,0,-1;
  // the group G is generated by A in Gl(3,Q);
  print(A);
==> 0, 1,0,
==> -1,0,0,
==> 0, 0,-1
  print(A*A*A*A); // the fourth power of A is 1
==> 1,0,0,
==> 0,1,0,
==> 0,0,1 
  // Use the first method to compute the invariants of G:
  matrix B(1..3);
  B(1..3)=invariant_ring(A);
  // SINGULAR returns 2 matrices, the first containing
  // primary invariants and the second secondary
  // invariants, i.e., module generators over a Noetherian
  // normalization
  // the third result are the irreducible secondary invariants
  // if the Molien series was available
  print(B(1));
==> z2,x2+y2,x2y2
  print(B(2));
==> 1,xyz,x2z-y2z,x3y-xy3
  print(B(3));
==> xyz,x2z-y2z,x3y-xy3
  // Use the second method,
  // with random numbers between -1 and 1:
  B(1..3)=invariant_ring_random(A,1);
  print(B(1..3));
==> z2,x2+y2,x4+y4-z4
==>  1,xyz,x2z-y2z,x3y-xy3
==>  xyz,x2z-y2z,x3y-xy3
 | 
 
 |