incr-set prlevel 1
if #0=3 START
incr-set prlevel -1
;;; Usage:
;;; 	<wedge_cokernel  m e n
;;;
;;; Sets n to the matrix presenting the 
;;; eth exterior power
;;; of the cokernel of m.  
;;;
incr-set prlevel 1
jump END
;;; Parameters:
;;;         m a module
;;;         e>=0 and integer
;;; Output values:
;;;         n a module
;;;
;;; If m: R --> R^a is the dual of an ideal, then
;;; the eth exterior power of coker m is the cokernel
;;; of the dual of the eth matrix in the Koszul complex.
;;; The general case is done here by concatenating the 
;;; presentation matrices for the eth exterior powers of 
;;; the columns of the given m (right exactness of the
;;; exterior power functor makes this correct.)
;;;    The command koszul i e n, where i is an ideal,
;;; requires that i be a map to the ring (no twist!)
;;; so some twisting and untwisting must be done.
;;; 
;;;
; created 11/19/89 DE
START:
;initialize the answer
nrows #1 @nrows
<binomial @nrows #2 @nrows
<zeromat @nrows 0 @wedge

;initialize the variable used to keep count of the cols:
ncols #1 @colnumber

loop:
submat #1 @col
      ;     take all rows
      @colnumber ;take one column
transpose @col @row
row-deg @row 1 @d

dshift @row -@d 
koszul @row #2 @kosz
dshift @kosz (#2)*@d

transpose @kosz @kosz
concat @kosz  @wedge
copy @kosz @wedge

int @colnumber @colnumber-1
if @colnumber>0 loop

copy @wedge #3
kill @col @row @colnumber @kosz @wedge @nrows @d

END:
incr-set prlevel -1

$;;;;;;;; EXAMPLE SECTION ;;;;;;;;;;;;;;;;;;;;;;;;;
reset
<ring 3 a-z r
mat m
2
2
a2
ab
ac
b2
type m

dshift m 5

set prlevel 0
<wedge_cokernel  m 1 n
type n
betti n

<wedge_cokernel  m 2 n
type n
betti n

<wedge_cokernel  m 3 n
type n
betti n

; ;;;;;;
<ideal i a3 b5 c7
jacob i j
betti j
transpose j j
betti j
type j

<wedge_cokernel  j 1 n
type n
betti n

<wedge_cokernel  j 2 n
type n
betti n

<wedge_cokernel  j 3 n
type n
betti n

listvars

<ideal i a2 0 0
transpose i i
setdegs i
	1
	3
type i
betti i
<wedge_cokernel  i 1 n
type n
betti n

<wedge_cokernel  i 2 n
type n
betti n

<wedge_cokernel  i 3 n
type n
betti n
