// compute a factorization via maple proc maple_factorize(poly p) { int saveshort=short; short=0; string in="maple-in."+string(system("pid")); string out="maple-out."+string(system("pid")); link l=in; write(l,"res:=factor("+string(p)+");"); write(l,"writeto("+out+");"); write(l,"lprint(`ideal res=`);"); write(l,"for i to nops(F) do"); write(l," if i>1 then lprint(`,`) fi;"); write(l," lprint(``+op(i,res));"); write("l,"od;"); write(l,"writeto(terminal);"); write(l,"quit;"); system("sh","maple <"+in+" > dummy"); string r=read(out); execute(r); return(res); }