(*File for the video of the torus for 5x5 matrices with the r paramter scaled and R=0.9. This file generated the stills for the paper.  Chop was used to help simplify and plot.
increase step to make the video, and compless in linux using
ffmpeg -i C5scale.avi-vcodec msmpeg4v2-q:v 6 C5scale_cmprsd.avi.avi
 *)
n=5;
Iden = IdentityMatrix[n];
w=E^((2*Pi*I)/n);
R=0.9; (*change to 8/10, 4/10 to run symbolicly (numeric was much faster for me)*)
(*r=(0.6);*)
(u = {{0,0,0,0,1},{1,0,0,0,0},{0,1,0,0,0},{0,0,1,0,0},{0,0,0,1,0}}) // MatrixForm;
(v= {{w,0,0,0,0},{0,(w)^2,0,0,0},{0,0,(w)^3,0,0},{0,0,0,(w)^4,0},{0,0,0,0,(w)^5}}) // MatrixForm ;
(a=((1/2)*(R*Iden+(r/2)*ConjugateTranspose[u]+(r/2)*u)).ConjugateTranspose[v]+(1/2)*v.(R*Iden+(r/2)*ConjugateTranspose[u]+(r/2)*u)) // MatrixForm 
(b= ((1/2)*I*(R*Iden+(r/2)*ConjugateTranspose[u]+(r/2)*u)).ConjugateTranspose[v]-(1/2)*I*v.(R*Iden+(r/2)*ConjugateTranspose[u]+(r/2)*u))// MatrixForm 
(c=(r*I/2)*ConjugateTranspose[u]-u*(r*I/2)) //MatrixForm
sigma1 = {{0,1}, {1,0}};
sigma2 = {{0,-I},{I,0}};
sigma3 = {{1,0},{0,-1}};
loclzr = KroneckerProduct[sigma1, a - x*Iden] + 
KroneckerProduct[sigma2, b-y*Iden]+ 
KroneckerProduct[sigma3, c-z*Iden] ;
MatrixForm[loclzr]
charpoly = Simplify[Det[loclzr]]
charpoly=Chop[charpoly]

step = 1/10;

plots2 = ParallelTable[ContourPlot3D[-0.34867844010000004`-0.023437500000000003` (r^10)+1.1809799999999997` (x^5)-1.0000000000000002` (x^10)-11.809799999999997` (x^3) (y^2)+5.904900000000001` x (y^4)-1.0000000000000002` (y^10)+(r^9) (-0.060054044501930894`+0.18575322583889714` z)-2.152336050000001` (z^2)-2.657205` (y^2) (z^2)-3.2805000000000044` (y^4) (z^2)-4.050000000000002` (y^6) (z^2)-5.` (y^8) (z^2)-5.314410000000001` (z^4)-9.841500000000003` (y^2) (z^4)-12.150000000000007` (y^4) (z^4)-10.` (y^6) (z^4)-6.561000000000001` (z^6)-12.150000000000004` (y^2) (z^6)-10.` (y^4) (z^6)-4.05` (z^8)-5.` (y^2) (z^8)-1.0000000000000002` (z^10)+(x^8) (-5.` (y^2)-5.` (z^2))+(r^8) (0.32034904515521356` +0.3217214053710856` (x^2)+0.32172140537108557` (y^2)-0.7611252850722215` z+0.12070976342771383` (z^2))+(r^7) (1.0975157552328203` +(x^2) (-0.4116165445019309`-0.579429241524403` z)+(y^2) (-0.4116165445019309`-0.579429241524403` z)+0.2286015049475555` z-2.409645222509655` (z^2)+0.4174271745131439` (z^3))+(x^6) (-10.` (y^4)-4.0500000000000025` (z^2)-20.` (y^2) (z^2)-10.` (z^4))+(r^6) (0.7187004609066464` -0.5354767161132569` (x^4)-0.5354767161132568` (y^4)+0.3431051301118586` z+2.6187025366494203` (z^2)+0.3696546882087657` (z^3)+0.3906250000000001` (z^4)+(y^2) (2.837076620413903` -3.1225521078773855` z+1.133326391308454` (z^2))+(x^2) (2.837076620413903` -1.0709534322265128` (y^2)-3.122552107877386` z+1.1333263913084548` (z^2)))+(r^5) (-0.003327778130289217`+0.12499999999999999` (x^5)-1.25` (x^3) (y^2)+0.625` x (y^4)+(x^4) (-0.5625000000000002`-1.145458996708665` z)+(y^4) (-0.5625000000000002`-1.1454589967086646` z)-4.130088045440522` z+0.5964208680620854` (z^2)+6.4296310077250425` (z^3)-1.5800720593359074` (z^4)-0.5944103226844709` (z^5)+(x^2) (0.36860836806208536` +(y^2) (-1.1250000000000002`-2.290917993417329` z)+4.2847125494111715` z+1.6875000000000009` (z^2)+0.27040618866195265` (z^3))+(y^2) (0.3686083680620855` +4.284712549411172` z+1.6875` (z^2)+0.27040618866195293` (z^3)))+(x^4) (-10.` (y^6)-3.280500000000002` (z^2)-30.000000000000004` (y^4) (z^2)-12.150000000000004` (z^4)-10.` (z^6)+(y^2) (-12.150000000000007` (z^2)-30.000000000000004` (z^4)))+(x^2) (-5.` (y^8)-2.6572050000000016` (z^2)-20.` (y^6) (z^2)-9.841500000000003` (z^4)-12.150000000000004` (z^6)-5.` (z^8)+(y^4) (-12.150000000000013` (z^2)-30.000000000000004` (z^4))+(y^2) (-6.561000000000001` (z^2)-24.300000000000008` (z^4)-20.` (z^6)))+(r^4) (-0.4048408096446578`+0.5625000000000002` (x^5)-2.3806356214843434` (x^6)-5.624999999999999` (x^3) (y^2)+2.8124999999999996` x (y^4)-2.3806356214843425` (y^6)-2.9103652912052547` z-4.0337360312088615` (z^2)-4.790724759185604` (z^3)-4.928884413609268` (z^4)-1.478618752835064` (z^5)-0.698771242968684` (z^6)+(x^4) (2.747444560206951` -7.141906864453027` (y^2)-3.365917677673142` z-1.2218218925782893` (z^2))+(y^4) (2.7474445602069513` -3.365917677673142` z-1.221821892578289` (z^2))+(y^2) (3.0939564062793856` -3.087273299415729` z+3.543750000000001` (z^2)-1.0699385808320474` (z^3)+0.4600424859373682` (z^4))+(x^2) (3.0939564062793856` -7.141906864453026` (y^4)-3.087273299415728` z+3.5437499999999997` (z^2)-1.0699385808320487` (z^3)+0.4600424859373689` (z^4)+(y^2) (5.494889120413902` -6.731835355346286` z-2.443643785156578` (z^2))))+(r^2) (0.7436138164720766` -1.8225000000000005` (x^5)-2.5` (x^8)+18.224999999999994` (x^3) (y^2)-9.112500000000002` x (y^4)-2.5` (y^8)+2.2744369173438574` z+2.7541252461928765` (z^2)+8.423840434606882` (z^3)+3.400154624929478` (z^4)+10.399803005687508` (z^5)+1.3992405863907322` (z^6)+4.2797543233281905` (z^7)+(x^6) (-0.6257594136092682`-10.` (y^2)-4.279754323328192` z-7.500000000000001` (z^2))+(y^6) (-0.6257594136092683`-4.279754323328192` z-7.5` (z^2))+(y^4) (1.326990125023508` -2.142477244606064` z-3.902278240827805` (z^2)-4.2797543233281905` (z^3)-7.500000000000001` (z^4))+(y^2) (1.0748620012690413` +1.7354065681309112` z+1.4466447499529849` (z^2)+5.609078246501902` (z^3)-1.8772782408278064` (z^4)+4.279754323328192` (z^5)-2.5` (z^6))+(x^4) (1.3269901250235068` -15.000000000000002` (y^4)-2.142477244606064` z-3.902278240827805` (z^2)-4.279754323328192` (z^3)-7.500000000000001` (z^4)+(y^2) (-1.877278240827809`-12.83926296998458` z-22.499999999999996` (z^2)))+(x^2) (1.0748620012690413` -10.` (y^6)+1.7354065681309139` z+1.4466447499529849` (z^2)+5.609078246501902` (z^3)-1.8772782408278057` (z^4)+4.279754323328192` (z^5)-2.5` (z^6)+(y^4) (-1.8772782408278106`-12.83926296998458` z-22.499999999999996` (z^2))+(y^2) (2.6539802500470135` -4.28495448921213` z-7.8045564816556166` (z^2)-8.559508646656385` (z^3)-15.000000000000002` (z^4))))== 0, {x,-1.25,1.25}, {y,-1.25, 1.25}, {z, -1.25, 1.25},Contours->{{1,LightBlue}},PlotPoints->50],{r,step,1,step}]

Export["T5_step1.eps",plots2[[4]],ImageSize->3.2*72];

Export["T5_step2.eps",plots2[[6]],ImageSize->3.2*72];

Export["T5_step3.eps",plots2[[7]],ImageSize->3.2*72];

Export["T5_step4.eps",plots2[[10]],ImageSize->3.2*72];

plotsall=Join[plots2,Reverse[plots2]];

Export["C5scale.avi",plotsall,ImageResolution->300,"FrameRate"->10]