// restore "p37.sav";
Attach("unitcomp.m");

p := 37;
printf "p := %o;\n", p;
r := 32;
printf "r := %o;\n", r;

printf "Defining initial objects...\n";
time w,del := KummerExt(p,r);

printf "Computing trace...\n";
time tr := TraceElt(p,r,w,del);
// printf "tr := %o;\n", tr;

save "p37.sav";

printf "Computing minimal polynomial...\n";
time f := MinPoly(p,r,tr);
// printf "f := %o;\n", f;

save "p37.sav";

printf "Computing slightly better polynomial...\n";
time g,a := ImprovePoly(p,f);
// printf "g := %o;\n", g;
// printf "a := %o;\n", a;

save "p37.sav";

printf "Computing maximal order...\n";
time O := MaxOrder(p,g);
// printf "O := %o;\n",O;

save "p37.sav";

printf "Computing optimized representation...\n";
time Os,test := Optimize(p,O);
assert test;
// printf "Os := %o;\n", Os;

save "p37.sav";

printf "Computing p-unit group...\n";
time U,m := GetUnits(p,Os);
// printf "U := %o;\n", U;
// printf "m := %o;\n", m;

save "p37.sav";

printf "Computing expansion of p-unit...\n";
time u := ExpandUnit(p,U,O,g,a,m);
// printf "u := %o;\n", u;

save "p37.sav";

printf "Computing p-adic root of element...\n";
t := pAdicDefs(p);
time wp1 := pAdicRoot(p,r,t);
// printf "wp1 := %o;\n", wp1;

save "p37.sav";

printf "Computing better choice of element...\n";
time wp := pAdicElt(p,wp1,t,w,del);
// printf "wp := %o;\n", wp;

save "p37.sav";

printf "Computing various embeddings of trace...\n";
time v := EmbedTrace(p,tr,t,wp);
// printf "v := %o;\n", v;

save "p37.sav";

printf "Computing local embedding of operator applied to p-unit...\n";
time ans,ss,N1,N1t := Answer(p,u,v,t);
printf "N1 := %o;\n", N1t;
printf "ans := %o;\n", ans;

save "p37.sav";
