Pfaffer


pffunc := proc (M,V)
 local sum,W,i;
 if nops(V)=0 then RETURN(1);
 elif nops(V)=2 then RETURN(M[op(1,V),op(2,V)]);
 elif nops(V) mod 2 = 1 then RETURN(0);
 else
  sum:=0;
  for i from 2 to nops(V) do;
   W:=subsop(1=NULL,subsop(i=NULL,V));
   sum:=sum+(-1)^i*M[op(1,V),op(i,V)]*pffunc(M,W);
   od;
  RETURN(sum);
  fi;
 end;

pfaffer := proc(M)
 local i;
 RETURN(simplify(pffunc(M,[seq(i,i=1..rowdim(M))])));
 end;


Tilbake til hjemmesiden

Created 23 February 1996 by Einar Andreas Rødland: einara@math.uio.no