# Singular

#### D.4.2.1 algebra_containment

Procedure from library `algebra.lib` (see algebra_lib).

Usage:
algebra_containment(p,A[,k]); p poly, A ideal, k integer.
A = A[1],...,A[m] generators of subalgebra of the basering

Return:
 ``` - k=0 (or if k is not given) an integer: 1 : if p is contained in the subalgebra K[A[1],...,A[m]] 0 : if p is not contained in K[A[1],...,A[m]] - k=1 : a list, say l, of size 2, l[1] integer, l[2] ring, satisfying l[1]=1 if p is in the subalgebra K[A[1],...,A[m]] and then the ring l[2]: ring, contains poly check = h(y(1),...,y(m)) if p=h(A[1],...,A[m]) l[1]=0 if p is not in the subalgebra K[A[1],...,A[m]] and then l[2] contains the poly check = h(x,y(1),...,y(m)) if p satisfies the nonlinear relation p = h(x,A[1],...,A[m]) where x = x(1),...,x(n) denote the variables of the basering ```

Display:
if k=0 and printlevel >= voice+1 (default) display the polynomial check

Note:
The proc inSubring uses a different algorithm which is sometimes faster.

Theory:
The ideal of algebraic relations of the algebra generators A[1],..., A[m] is computed introducing new variables y(i) and the product order with x(i) >> y(i).
p reduces to a polynomial only in the y(i) <=> p is contained in the subring generated by the polynomials A[1],...,A[m].

Example:
 ```LIB "algebra.lib"; int p = printlevel; printlevel = 1; ring R = 0,(x,y,z),dp; ideal A=x2+y2,z2,x4+y4,1,x2z-1y2z,xyz,x3y-1xy3; poly p1=z; poly p2= x10z3-x8y2z3+2x6y4z3-2x4y6z3+x2y8z3-y10z3+x6z4+3x4y2z4+3x2y4z4+y6z4; algebra_containment(p1,A); ==> // x(3) ==> 0 algebra_containment(p2,A); ==> // y(1)*y(2)*y(5)^2+y(3)*y(5)^3+4*y(1)*y(2)*y(6)^2+4*y(6)^3*y(7)+2*y(2)*y\ (5)*y(7)^2 ==> 1 list L = algebra_containment(p2,A,1); ==> ==> // 'algebra_containment' created a ring as 2nd element of the list. ==> // The ring contains the polynomial check which defines the algebraic rel\ ation. ==> // To access to the ring and see check you must give the ring a name, ==> // e.g.: ==> def S = l[2]; setring S; check; ==> L[1]; ==> 1 def S = L[2]; setring S; check; ==> y(1)*y(2)*y(5)^2+y(3)*y(5)^3+4*y(1)*y(2)*y(6)^2+4*y(6)^3*y(7)+2*y(2)*y(5)\ *y(7)^2 printlevel = p; ```