# Singular

### 5.1.130 res

Procedure from library `standard.lib` (see standard_lib).

`Syntax:`
`res (` ideal_expression`,` int_expression `[,` any_expression `])`
`res (` module_expression`,` int_expression `[,` any_expression `])`
`Type:`
resolution
`Purpose:`
computes a (possibly minimal) free resolution of an ideal or module using a heuristically chosen method.
The second (int) argument (say `k`) specifies the length of the resolution. If it is not positive then `k` is assumed to be the number of variables of the basering.
If a third argument is given, the returned resolution is minimized.

Depending on the input, the returned resolution is computed using the following methods:

quotient rings:
`nres` (classical method using syzygies) , see nres.

homogeneous ideals and k=0:
`lres` (La'Scala's method), see lres.

not minimized resolution and (homogeneous input with k not 0, or local rings):
`sres` (Schreyer's method), see sres.

all other inputs:
`mres` (classical method), see mres.
`Note:`
Accessing single elements of a resolution may require some partial computations to be finished and may therefore take some time.
See also betti; fres; hres; ideal; lres; minres; module; mres; nres; resolution; sres.

Example:

 ``` ring r=0,(x,y,z),dp; ideal i=xz,yz,x3-y3; def l=res(i,0); // homogeneous ideal: uses lres l; ==> 1 3 2 ==> r <-- r <-- r ==> ==> 0 1 2 ==> print(betti(l), "betti"); // input to betti may be of type resolution ==> 0 1 2 ==> ------------------------ ==> 0: 1 - - ==> 1: - 2 1 ==> 2: - 1 1 ==> ------------------------ ==> total: 1 3 2 ==> l[2]; // element access may take some time ==> _[1]=-x*gen(1)+y*gen(2) ==> _[2]=-x2*gen(2)+y2*gen(1)+z*gen(3) i=i,x+1; l=res(i,0); // inhomogeneous ideal: uses mres l; ==> 1 3 3 1 ==> r <-- r <-- r <-- r ==> ==> 0 1 2 3 ==> resolution not minimized yet ==> ring rs=0,(x,y,z),ds; ideal i=imap(r,i); def l=res(i,0); // local ring not minimized: uses sres l; ==> 1 1 ==> rs <-- rs ==> ==> 0 1 ==> resolution not minimized yet ==> res(i,0,0); // local ring and minimized: uses mres ==> 1 1 ==> rs <-- rs ==> ==> 0 1 ==> ```