# Singular

#### D.7.1.2 invariant_ring_random

Procedure from library `finvar.lib` (see finvar_lib).

Usage:
invariant_ring_random(G1,G2,...,r[,flags]);
G1,G2,...: <matrices> generating a finite matrix group, r: an <int> where -|r| to |r| is the range of coefficients of random combinations of bases elements that serve as primary invariants, flags: an optional <intvec> with three entries: if the first equals 0, the program attempts to compute the Molien series and Reynolds operator, if it equals 1, the program is told that the Molien series should not be computed, if it equals -1 characteristic 0 is simulated, i.e. the Molien series is computed as if the base field were characteristic 0 (the user must choose a field of large prime characteristic, e.g. 32003) and if the first one is anything else, then the characteristic of the base field divides the group order (i.e. we will not even attempt to compute the Reynolds operator or Molien series), the second component should give the size of intervals between canceling common factors in the expansion of the Molien series, 0 (the default) means only once after generating all terms, in prime characteristic also a negative number can be given to indicate that common factors should always be canceled when the expansion is simple (the root of the extension field does not occur among the coefficients)

Return:
primary and secondary invariants for any matrix representation of a finite group

Display:
information about the various stages of the program if the third flag does not equal 0

Theory:
is the same as for invariant_ring except that random combinations of basis elements are chosen as candidates for primary invariants and hopefully they lower the dimension of the previously found primary invariants by the right amount.

Example:
 ```LIB "finvar.lib"; ring R=0,(x,y,z),dp; matrix A[3][3]=0,1,0,-1,0,0,0,0,-1; matrix P,S,IS=invariant_ring_random(A,1); print(P); ==> z2,x2+y2,x4+y4-z4 print(S); ==> 1,xyz,x2z-y2z,x3y-xy3 print(IS); ==> xyz,x2z-y2z,x3y-xy3 ```