#reads in lambdalist.txt then calculates bm for each lambda #bm is the ratio of the actual integral of your eigenfunction to its approximate (discrete) integral at the specified level. #bm is calculated using the formula to get _m+1 from _m for an eigenfunction f. read "itall.txt": lvl:=1: path:=cat("../data/level",lvl,"/"): #lambdatol: tolerance for deleting repeated lambdas lambdatol:=.0000000001: #bmtol: tolerance for covergence of bm bmtol:=.0000000001: numvertices:=(3^(lvl+1)-3)/2: lambdalist:=[]; fd:=fopen(cat(path,lvl,"lambdalist.txt"),READ): for i from 1 to numvertices do lambdalist:=[op(lambdalist),fscanf(fd,"%g\n")[1]]; end do; fclose(fd); l:=nops(lambdalist); i:=1; while (i < l) do badlist:=[]; for j from (i+1) to nops(lambdalist) do if (abs(lambdalist[j]-lambdalist[i]) < lambdatol) then badlist:=[op(badlist),j=NULL]; end if; end do; lambdalist:=subsop(op(badlist),lambdalist); l:=nops(lambdalist); i:=i+1; end do; fd:=fopen(cat(path,lvl,"bm.txt"),WRITE); fprintf(fd,"lambda,\t\t\t\tbm\t(level %d)\n",lvl); for i from 1 to nops(lambdalist) do fprintf(fd,"%20.20g\t\t%20.20g\n",lambdalist[i],calcbm(lambdalist[i],[],bmtol)); end do; fclose(fd);