func real[int] rand(int h){ real[int] vec(h); for(int i = 0;i1e-10){ border poly(t=0,1; i){ x=(1-t)*xx[i]+t*xx[ind3(i)]; y=(1-t)*yy[i]+t*yy[ind3(i)]; label=i; } mesh Th = buildmesh (poly(NC)); //Th= adaptmesh(Th,1./50,IsMetric=1); //plot(Th); fespace Vh(Th,P1); // variables on the mesh Vh u1,u2; int[int] BC = 0:1:n-1; // label indexes for each disk // used for the boundary condition // Define the problem in weak form varf a(u1,u2) = int2d(Th) (dx(u1)*dx(u2) + dy(u1)*dy(u2))+on(1,u1=0)//on(C1,C2,C3,C4,u1=1) +on(BC,u1=0); varf b([u1],[u2]) = int2d(Th)( u1*u2 ) ; // define matrices for the eigenvalue problem matrix A= a(Vh,Vh,solver=Crout,factorize=1); matrix B= b(Vh,Vh,solver=CG,eps=1e-20); // we are interested only in the first eigenvalue int eigCount = k+1; real[int] ev(eigCount); // Holds eigenvalues Vh[int] eV(eigCount); // holds eigenfunctions // Solve Ax=lBx int numEigs = EigenValue(A,B,sym=true,sigma=0,value=ev,vector=eV); if(int2d(Th)(eV[k])<0){ eV[k] = -eV[k]; } real[int] derx(n); real[int] dery(n); real[int] ax(n); real[int] ay(n); mesh Eh = emptymesh(Th); fespace Wh(Eh,P1); real l1,l2; Wh av,ap; real val1,val2; Vh ff = 1; real ar = int2d(Th)(ff); real[int] diffs(n); real[int] dots(n); for(int i=0;i1000) break; }