# Singular

#### D.7.2.1 invariantRing

Procedure from library `ainvar.lib` (see ainvar_lib).

Usage:
invariantRing(m,p,q,b[,r,pa]); m matrix, p,q poly, b,r int, pa string

Assume:
p,q variables with m(p)=q and q invariant under m
i.e. if p=x(i) and q=x(j) then m[j,1]=0 and m[i,1]=x(j)

Return:
ideal, containing generators of the ring of invariants of the additive group (K,+) given by the vector field
 ``` m = m[1,1]*d/dx(1) +...+ m[n,1]*d/dx(n). ```
If b>0 the computation stops after all invariants of degree <= b (and at least one of higher degree) are found or when all invariants are computed.
If b<=0, the computation continues until all generators of the ring of invariants are computed (should be used only if the ring of invariants is known to be finitely generated, otherwise the algorithm might not stop).
If r=1 a different reduction is used which is sometimes faster (default r=0).

Display:
if pa is given (any string as 5th or 6th argument), the computation pauses whenever new invariants are found and displays them

Theory:
The algorithm for computing the ring of invariants works in char 0 or suffiently large characteristic.
(K,+) acts as the exponential of the vector field defined by the matrix m.
For background see G.-M. Greuel, G. Pfister,
Geometric quotients of unipotent group actions, Proc. London Math. Soc. (3) 67, 75-105 (1993).

Example:
 ```LIB "ainvar.lib"; //Winkelmann: free action but Spec(k[x(1),...,x(5)]) --> Spec(invariant ring) //is not surjective ring rw=0,(x(1..5)),dp; matrix m[5][1]; m[3,1]=x(1); m[4,1]=x(2); m[5,1]=1+x(1)*x(4)+x(2)*x(3); ideal in=invariantRing(m,x(3),x(1),0); //compute full invarint ring in; ==> in[1]=x(1) ==> in[2]=x(2) ==> in[3]=x(2)*x(3)*x(4)-x(2)*x(5)+x(4) ==> in[4]=x(1)*x(3)*x(4)-x(1)*x(5)+x(3) //Deveney/Finston: The ring of invariants is not finitely generated ring rf=0,(x(1..7)),dp; matrix m[7][1]; m[4,1]=x(1)^3; m[5,1]=x(2)^3; m[6,1]=x(3)^3; m[7,1]=(x(1)*x(2)*x(3))^2; ideal in=invariantRing(m,x(4),x(1),6); //all invariants up to degree 6 in; ==> in[1]=x(1) ==> in[2]=x(3) ==> in[3]=x(2) ==> in[4]=x(3)^3*x(4)-x(1)^3*x(6) ==> in[5]=x(2)^3*x(4)-x(1)^3*x(5) ==> in[6]=x(2)^2*x(3)^2*x(4)-x(1)*x(7) ==> in[7]=x(1)^2*x(2)^2*x(6)-x(3)*x(7) ==> in[8]=x(1)^2*x(3)^2*x(5)-x(2)*x(7) ==> in[9]=x(1)^2*x(2)*x(3)^4*x(4)*x(5)+x(1)^2*x(2)^4*x(3)*x(4)*x(6)-x(1)^5*x(\ 2)*x(3)*x(5)*x(6)-2*x(2)^2*x(3)^2*x(4)*x(7)+x(1)*x(7)^2 ```