next | previous | forward | backward | up | top | index | toc | packages | Macaulay2 website
Macaulay2Doc > chain complexes > free resolutions of modules > computing resolutions

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 0.97845 seconds
-- computation interrupted
-- continuing the computation
     -- used 0.984881 seconds
-- computation interrupted
-- continuing the computation
     -- used 1.0044 seconds
-- computation interrupted
-- continuing the computation
     -- used 0.988355 seconds
-- computation interrupted
-- continuing the computation
     -- used 0.979277 seconds
-- computation interrupted
-- continuing the computation
     -- used 0.983278 seconds
-- computation interrupted
-- continuing the computation
     -- used 0.99629 seconds
-- computation interrupted
-- continuing the computation
     -- used 0.993567 seconds
-- computation interrupted
-- continuing the computation
     -- used 1.04186 seconds
-- computation interrupted
-- continuing the computation
     -- used 0.987538 seconds
-- computation interrupted
-- continuing the computation
     -- used 0.978787 seconds
-- computation interrupted
-- continuing the computation
     -- used 0.980119 seconds
-- computation interrupted
-- continuing the computation
     -- used 0.986454 seconds
-- computation interrupted
-- continuing the computation
     -- used 0.99248 seconds
-- computation interrupted
-- continuing the computation
     -- used 1.11531 seconds
-- computation interrupted
-- continuing the computation
     -- used 1.11926 seconds
-- computation interrupted
-- continuing the computation
     -- used 1.0255 seconds
-- computation interrupted
-- continuing the computation
     -- used 1.07061 seconds
-- computation interrupted
-- continuing the computation
     -- used 1.02829 seconds
-- computation interrupted
-- continuing the computation
     -- used 1.00524 seconds
-- computation interrupted
-- continuing the computation
     -- used 1.03063 seconds
-- computation interrupted
-- continuing the computation
     -- used 1.01664 seconds
-- computation interrupted
-- continuing the computation
     -- used 0.799449 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.