Macaulay2 » Documentation
Packages » Macaulay2Doc > chain complexes > free resolutions of modules > computing resolutions
next | previous | forward | backward | up | index | toc

computing resolutions

Use the function resolution, often abbreviated as res, to compute a free resolution of a module.
i1 : R = QQ[x..z];
i2 : M = cokernel vars R

o2 = cokernel | x y z |

                            1
o2 : R-module, quotient of R
i3 : C = res M

      1      3      3      1
o3 = R  <-- R  <-- R  <-- R  <-- 0
                                  
     0      1      2      3      4

o3 : ChainComplex
See chain complexes for further details about how to handle and examine the result.

A reference to the result is stored within the module M, so that requesting a computation of res M a second time yields the formerly computed result immediately.

If the computation is interrupted or discontinued after the skeleton has been successfully computed, then the partially completed resolution is available as M.cache.resolution, and can be examined with status. The computation can be continued with res M. Here is an example, with an alarm interrupting the computation several times before it's complete. (On my machine, the computation takes a total of 14 seconds.) (Example code, such as the code below, is run in such a way that interrupts stop the program, so to prevent that, we set handleInterrupts to true.)

i4 : R = ZZ/2[a..d];
i5 : M = coker random(R^4, R^{5:-3,6:-4});
i6 : handleInterrupts = true

o6 = true
i7 : (<< "-- computation started: " << endl;
      while true do try (
          alarm 1;
          time res M;
          alarm 0;
          << "-- computation complete" << endl;
          status M.cache.resolution;
          << res M << endl << endl;
          break;
          ) else (
          << "-- computation interrupted" << endl;
          status M.cache.resolution;
          << "-- continuing the computation" << endl;
          ))
-- computation started: 
     -- used 1.0027 seconds
-- computation interrupted
-- continuing the computation
     -- used 0.403964 seconds
-- computation complete
 4      11      89      122      40
R  <-- R   <-- R   <-- R    <-- R   <-- 0
                                         
0      1       2       3        4       5
If the user has a chain complex in hand that is known to be a projective resolution of M, then it can be installed with M.cache.resolution = C.

There are various optional arguments associated with res which allow detailed control over the progress of the computation.