det_maxdegree:=proc(a::Matrix,n::integer)::integer; local vlist0,n0,d0,r0,row,colm,row0,colm0: local j,k,l: row:=Vector(n): colm:=Vector(n): vlist0:=indets(a): n0:=nops(vlist0): r0:=0: for l from 1 to n0 do for j from 1 to n do for k from 1 to n do d0:=degree(a[j,k],vlist0[l]): if d0>row[j] then row[j]:=d0: end if: if d0>colm[k] then colm[k]:=d0: end if: end do: end do: row0:=0: colm0:=0: for j from 1 to n do row0:=row0+row[j]: colm0:=colm0+colm[j]: end do: if row00 do k:=1: for j from 1 to n do if x[j]=1 then q[k]:=j: k:=k+1: end if: end do: sig0:=sig0s: sum0:=userzero: for j from 1 to l do u:=1: v:=l-1: b1:=n-1: for k from l by -1 to j+1 do for b2 from b1 by -1 to q[k] do u:=u+ct[b2,v]: end do: b1:=b2-1: v:=v-1: end do: for k from j-1 by -1 to 1 do for b2 from b1 by -1 to q[k] do u:=u+ct[b2,v]: end do: b1:=b2-1: v:=v-1: end do: if sig0=1 then sum0:=sum0,sdmp:-Multiply(a[l,q[j]],p[u]): else sum0:=sum0,sdmp:-Multiply(sdmp:-Multiply(usermone,a[l,q[j]]),p[u]): end if: sig0:=-sig0: end do: p0[r-m+1]:=sdmp:-Add(sum0): m:=m+1: for k from 1 to n do if x[k]<>0 then break: end if: end do: small:=k: c:=1: k:=small: while c<>0 and k<=n do if x[k]=1 and c=1 then x[k]:=0: else if x[k]=0 and c=1 then x[k]:=1: c:=0: end if: end if: k:=k+1: end do: for k from 1 to n do if x[k]<>0 then break: end if: end do: new_small:=k: if new_small<=n then ones:=new_small-small-1: for k from 1 to ones do if x[k]=0 then x[k]:=1: end if: end do: end if: for k from n by -1 to 1 do if x[k]<>y[k] then break: end if: end do: end do: p:=p0: sig0s:=-sig0s: end do: return(p[1]): end proc: with(LinearAlgebra): with(MTM): p:=x^12+x^11+a10*x^10+a9*x^9+a8*x^8+a7*x^7+a6*x^6+a5*x^5+a4*x^4+a3*x^3+a2*x^2+a1*x+a0: q:=diff(p,x): m12:=BezoutMatrix(p,q,x): m12:=map(expand,m12): n12:=max(degree(p,x),degree(q,x)): d0:=det_maxdegree(m12,n12); d1:=ceil(log2(d0+1.0)); d2:=floor(64/d1); if d2=0 then print("error"): quit: end if: vlist:=indets(m12): nv:=nops(vlist): if d2>nv then d2:=nv: end if: exp0:=seq(vlist[i],i=1..nv): m12sdmp:=map(sdmp:-Import,m12,plex(exp0),pack=d2): userzero:=sdmp:-Import(0,plex(exp0),pack=d2): usermone:=sdmp:-Import(-1,plex(exp0),pack=d2): p:=userdet(m12sdmp,n12,userzero,usermone); quit: