# EXAMPLE SCRIPT FOR THE POLYMAKE TUTORIAL LEIPZIG 2020 # ----------------------------------------------------- # DOMINIC BUNNETT TU BERLIN # ----------------------------------------------------- # ----------------------------------------------------- # # Upshot: # This script prints and saves tuples (x,y;j) such that # Vol(j*Conv(0,x*e1,y*e2))>50 # for j minimal. # # In this script we loop over steadily growing simplic- # es. For each simplex we define an indexing variable # "j". # # Each iteration of the for loops starts with a 2 simp- # lex defined by \$p = convex_hull(0,x*e1,y*e2). We then # check the volume of this simplex. # # If the volume is less than 51 we dilate the simplex # and check the volume again. We repeat this until the # volume is greater than 50. # # We then record in an array "@ar" the simplex we star- # ted with and the dilation factor which brought us to # volume above 50. # # use application "polytope"; my \$i=1; my \$n=10; # n gives us (roughly) the number of pairs we want to check! my @ar=(); #we open an array where we are going to store data! #we loop over all pairs (x,y): for(my \$x = 2; \$x<\$n-1; \$x++){ for(my \$y = \$x+1; \$y<\$n; \$y++){ #Then we define our simplex called \$p and an indexing number "j": my \$p = new Polytope(POINTS=>[[1,0,0],[1,\$y,0],[1,0,\$x]]); my \$j = 1; if(\$p->VOLUME<51){ my \$small = true; while(\$small){ \$j++; my \$next = new Polytope(POINTS=>[[1,0,0],[1,\$j*\$y,0],[1,0,\$j*\$x]]); \$small = \$next->VOLUME<51; } } push @ar, new Vector([\$x,\$y,\$j]); print "(x,y;j) = (\$x,\$y;\$j) \n"; \$i++; } } my \$mat = new Matrix(@ar); save_data(\$mat,"2simplex_test.mat");