# ApCoCoA-1:SB.NFS

## SB.NFS

Computes the subalgebra normal form of a polynomial with respect to subalgebra generators.

### Syntax

SB.NFS(Polys:LIST of POLY, F:POLY):POLY SB.NFS(Polys:LIST of POLY, F:POLY, ReprType:INT):POLY SB.NFS(Polys:LIST of POLY, F:POLY, SubAlgRepr:BOOL):POLY or LIST SB.NFS(Polys:LIST of POLY, F:POLY, ReprType:INT, SubAlgRepr:BOOL):POLY or LIST

### Description

This function computes the subalgebra normal form of the polynomial `F` with respect to the polynomials in the list `Polys` which generate a subalgebra `S` of the current algebra. The optional parameter `ReprType` gives the possibility to choose between different ways of getting a term representation (see SB.TermRepr). With the optional parameter `SubAlgRepr` it is possible to control the form of the output. If `SubAlgRepr=FALSE` (which is also the default value) only the normal form will be returned, otherwise a list with the normal form `NFS(F)` of `F` and a subalgebra representation of `F - NFS(F)` will be returned. Example: Let `G = [g_1, g_2, g_3]` and let `[[1,0,3,-1],[4,2,1,2]]` be the returned representation of `F - NFS(F)`. Then it follows

`F-NFS(F) = -1*(g_1)^1(g_2)^0(g_3)^3 + 2*(g_1)^4(g_2)^2(g_3)^1`

That means that the last entry of every list in the representation gives the coefficients and the other entries the exponents.

@param

*Polys*A list of polynomials, which are the generators of the current subalgebra.@param

*F*A polynomial.@return Depending on the optional parameter

*SubAlgRepr*either a polynomial or a list including a polynomial and a list of integers.

The following parameters are optional:

@param

*ReprType*Either 0,1 or 2. With this parameter it is possible to choose between different ways of getting the representation: By`ReprType=0`a toric ideal is used to compute the representation. This is also the default value. By`ReprType=1`algebra homomorphisms are used, by`ReprType=2`a system of diophantine equations is used to compute the representation.@param

*SubAlgRepr*A boolean value. The default value is FALSE. If`SubAlgRepr=FALSE`only the normal form will be returned, otherwise a list with two entries will be returned: The first one is the normal form`NFS(F)`of`F`, the second one is the subalgebra representation of the polynomial`F - NFS(F)`which always lies in the given subalgebra.

#### Example

Use R::=QQ[x,y]; G:=[x-y,x+y]; SB.NFS(G,x^2-y^2); SB.NFS(G,x^2-y^2,TRUE); -- Interpretation: -- x^2-y^2 - (-2xy-2y^2) = x^2+2xy+y^2 = 1*(x+y)^2 is in K[G] -2xy - 2y^2 ------------------------------- [-2xy - 2y^2, [[0, 2, 1]]] ------------------------------- -- Done. -------------------------------

#### Example

Use R::=QQ[x,y], DegLex; F:=x^4y^2+x^2y^4; G:=[x^2-1,y^2-1]; SB.NFS(G,F); SB.NFS(G,F,TRUE); -- Interpretation: -- F is in K[G] with -- F = 1*G[1]^2G[2] + 1*G[1]G[2]^2 + 1*G[1]^2 + 4*G[1]G[2] + 1*G[2]^2 -- + 3*G[1] + 3*G[2] + 2. 0 ------------------------------- [0, [[2, 1, 1], [1, 2, 1], [2, 0, 1], [1, 1, 4], [0, 2, 1], [1, 0, 3], [0, 1, 3], [0, 0, 2]]] ------------------------------- -- Done. -------------------------------