Rev 18401 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
18401 | bpr | 1 | !set slib_header_coxaff=\ |
2 | \\ Polynome minimal de 2*cos(Pi/n)\ |
||
3 | real_cyclo(n)={\ |
||
4 | if(n==1,return(x+2));\ |
||
5 | my(p=polcyclo(2*n),nn=eulerphi(2*n)/2,res=0,c);\ |
||
6 | forstep(j=nn,0,-1,\ |
||
7 | c = polcoeff(p,nn+j);\ |
||
8 | res += c*x^j;\ |
||
9 | p -= c*x^(nn-j)*(x^2+1)^j);\ |
||
10 | res\ |
||
11 | };\ |
||
12 | \ |
||
13 | \\ p(2*cos(t)) = 2*cos(n*t)\ |
||
14 | cheby(n)=2*subst(polchebyshev(n),x,x/2);\ |
||
15 | \ |
||
16 | \\ m est une matrice de Coxeter\ |
||
17 | \\ renvoie les generateurs\ |
||
18 | cox_base(m)={\ |
||
19 | my(n=#m,nn=1);\ |
||
20 | for(i=1,n,for(j=i+1,n,if(m[i,j],nn=lcm(nn,m[i,j]))));\ |
||
21 | xx=Mod(x,real_cyclo(nn));\ |
||
22 | module=xx.mod;\ |
||
23 | racine=2*cos(Pi/nn);\ |
||
24 | gram=matrix(n,n,i,j,if(m[i,j],-cos(Pi/m[i,j]),-1));\ |
||
25 | v=vector(n,k,matrix(n,n,i,j,\ |
||
26 | (i==j)+(i==k)*lift(subst(if(m[k,j],cheby(nn/m[k,j]),2),x,xx))));\ |
||
27 | Set(v)\ |
||
28 | };\ |
||
29 | \ |
||
30 | longer(shorter,current,cb)={\ |
||
31 | my(l=List());\ |
||
32 | foreach(current,w,foreach(cb,s,\ |
||
33 | listput(l,simplify((w*s)%module))));;\ |
||
34 | setminus(Set(l),shorter)\ |
||
35 | };\ |
||
36 | \ |
||
37 | \\ Sous l'hypothese 1/p+1/q+1/r=1\ |
||
38 | \\ imprime le source tikz d'un pavage d'une partie\ |
||
39 | \\ du plan avec des triangles d'angles Pi/p, etc.\ |
||
40 | aff3(p,q,r,limite)={\ |
||
18542 | bpr | 41 | my(g,t=matrix(3,3),u,v,acc,cb=cox_base([1,p/2,q/2;p/2,1,r/2;q/2,r/2,1]),\ |
18401 | bpr | 42 | sh=Set(),cr=Set(matid(3)),tmp,h,res,xmin,xmax,ymin,ymax,xm,ym);\ |
43 | for(i=1,3,\ |
||
44 | g=subst(cb[i]*cb[1+(i%3)],x,racine);\ |
||
45 | \\point fixe de g, moyenne des iteres : intersection de la droite de points fixes, puis z=1\ |
||
18542 | bpr | 46 | u=if(i==1,p/2,if(i==2,r/2,q/2));\ |
18401 | bpr | 47 | v=[0,0,1];\ |
48 | acc=vector(3);\ |
||
49 | for(i=1,u,acc+=v;v=v*g);\ |
||
50 | t[i,]=acc/u);\ |
||
51 | \\printf("p: %d, q: %d, r: %d\n",p, q, r);\ |
||
52 | res=matrix(0,7);\ |
||
53 | \\printf("\\begin{tikzpicture}[scale=%.3f]\n",7/limite);\ |
||
54 | for(i=1,limite, tmp=longer(sh,cr,cb); sh=cr; cr=tmp;\ |
||
18542 | bpr | 55 | foreach(sh,g,h=t*subst(g,x,racine)*[1,0;cos(2*Pi/p),sin(2*Pi/p);0,0];\ |
18401 | bpr | 56 | \\printf("\\%s(%.4f,%.4f)--(%.4f,%.4f)--(%.4f,%.4f)--cycle;\n",\ |
57 | \\if(i%2,"fill","draw"),h[1,1],h[1,2],h[2,1],h[2,2],h[3,1],h[3,2]);\ |
||
58 | res=matconcat([res,[h[1,1],h[1,2],h[2,1],h[2,2],h[3,1],h[3,2],i%2]]~)\ |
||
59 | ));\ |
||
60 | \\print("\\end{tikzpicture}\n");\ |
||
61 | for(i=1,matsize(res)[1],for(j=1,3,xm=res[i,2*j-1];ym=res[i,2*j];\ |
||
62 | if(xm<xmin,xmin=xm);\ |
||
63 | if(xm>xmax,xmax=xm);\ |
||
64 | if(ym<ymin,ymin=ym);\ |
||
65 | if(ym>ymax,ymax=ym)));\ |
||
66 | [[xmin,xmax,ymin,ymax],res];\ |
||
67 | };\ |
||
68 | /*\ |
||
69 | \p3\ |
||
70 | print("\nAffines\n");\ |
||
18542 | bpr | 71 | aff3(4,8,8,20);\ |
72 | aff3(6,6,6,20);\ |
||
73 | aff3(4,6,12,20);\ |
||
18401 | bpr | 74 | */\ |
75 | \ |