# Singular

#### D.4.25.1 sagbiSPoly

Procedure from library `sagbi.lib` (see sagbi_lib).

Usage:
sagbiSPoly(A[, returnRing, meth]); A is an ideal, returnRing and meth are integers.

Return:
ideal or ring

Assume:
basering is not a qring

Purpose:
Returns SAGBI S-polynomials of the leading terms of a given ideal A if returnRing=0.
Otherwise returns a new ring containing the ideals algebraicRelations
and spolynomials, where these objects are explained by their name.
See the example on how to access these objects. @format The other optional argument meth determines which method is used for computing the algebraic relations.
- If meth=0 (default), the procedure std is used.
- If meth=1, the procedure slimgb is used.
- If meth=2, the prodecure uses toric_ideal.
@end format

Example:
 ```LIB "sagbi.lib"; ring r= 0,(x,y),dp; ideal A=x*y+x,x*y^2,y^2+y,x^2+x; //------------------ Compute the SAGBI S-polynomials only sagbiSPoly(A); ==> _[1]=x2y-xy2+x2-xy ==> _[2]=x2y3+1/2xy4+1/2x2y2+xy3+1/2xy2 //------------------ Extended ring is to be returned, which contains // the ideal of algebraic relations and the ideal of the S-polynomials def rNew=sagbiSPoly(A,1); setring rNew; spolynomials; ==> spolynomials[1]=x^2*y-x*y^2+x^2-x*y ==> spolynomials[2]=x^2*y^3+1/2*x*y^4+1/2*x^2*y^2+x*y^3+1/2*x*y^2 algebraicRelations; ==> algebraicRelations[1]=@y(1)^2-@y(3)*@y(4) ==> algebraicRelations[2]=@y(3)^2*@y(4)-@y(2)^2 //----------------- Now we verify that the substitution of A[i] into @y(i) // results in the spolynomials listed above ideal A=fetch(r,A); map phi=rNew,x,y,A; ideal spolynomials2=simplify(phi(algebraicRelations),1); spolynomials2; ==> spolynomials2[1]=x^2*y-x*y^2+x^2-x*y ==> spolynomials2[2]=x^2*y^3+1/2*x*y^4+1/2*x^2*y^2+x*y^3+1/2*x*y^2 ```