run ./functions.py
HTML('<style>{}</style>'.format(open('polydb.css').read()))
from IPython.display import IFrame
IFrame("https://polydb.org", 1200,1000)
info = requests.get('https://polydb.org/rest/current/collection/Polytopes/Lattice/FewLatticePoints3D/')
print_json(info.json(),3)
res = requests.get('https://polydb.org/rest/current/id/Polytopes/Lattice/FewLatticePoints3D/15_09386628')
polytope = res.json()
print_json(polytope,3)
res = requests.get('https://polydb.org/rest/current/schema/Polytopes/Lattice/FewLatticePoints3D')
schema = res.json()
print_json(schema,3)
#schema["required"].append("UNKNOWN_PROPERTY")
#schema["required"].remove("UNKNOWN_PROPERTY")
try:
validate(instance=polytope,schema=schema)
print("data validates")
except ValidationError as e:
print("did not validate")
print(e)
data validates
p = requests.get('https://polydb.org/rest/current/collection/Polytopes/Lattice/FewLatticePoints3D/')
print_json(p.json(),4)
res = requests.get('https://polydb.org/rest/current/find_one/Polytopes/Lattice/FewLatticePoints3D?query={%22N_VERTICES%22%3A14}')
polytope = res.json()
print_json(polytope,4)
query=dict(N_VERTICES=4)
params=dict(
task="count",
collection="Polytopes.Lattice.FewLatticePoints3D",
query=json.dumps(query)
)
res = requests.get(url='https://polydb.org/rest/query.php',params=params)
print(res.json())
6677
query=[
{ "$match" : {"N_LATTICE_POINTS" : {"$lte" : 11}}},
{ "$group" :
{ "_id" : "$N_LATTICE_POINTS",
"MIN_LATTICE_VOLUME" : { "$min" : "$LATTICE_VOLUME" },
"MAX_LATTICE_VOLUME" : { "$max" : "$LATTICE_VOLUME" }
}
}
]
params=dict(
task='aggregate',
collection='Polytopes.Lattice.FewLatticePoints3D',
query=json.dumps(query),
allowDiskUse=1
)
res = requests.get(url='http://localhost:8880/rest/query.php',params=params)
datax = []
datay = []
for a in res.json():
datax.append([a['_id'],a['_id']])
datay.append([a['MIN_LATTICE_VOLUME'],a['MAX_LATTICE_VOLUME']])
plt.scatter(datax, datay)
plt.show()
from IPython.display import IFrame
IFrame("https://doc.sagemath.org/html/en/reference/discrete_geometry/sage/geometry/lattice_polytope.html", 1200,1000)
import json
import requests
query=dict(DIM=int(3))
params=dict(
task="find",
collection="Polytopes.Lattice.SmoothReflexive",
query=json.dumps(query)
)
res = requests.get(url='https://polydb.org/rest/query.php',params=params)
homog_points=res.json()[3]['VERTICES']
points = [r[1:] for r in homog_points]
p = LatticePolytope(points)
p.vertices()
M( 0, -2, 1), M( 0, 1, 1), M( 1, 1, 0), M( 1, 0, 0), M( 1, -1, 1), M( 1, 1, 1), M( 0, 0, -1), M( 0, 1, -1), M(-1, 1, -1), M(-1, -1, -1), M(-1, -2, 0), M(-1, 1, 0) in 3-d lattice M
p.plot3d().show()
$pdb=polyDB();
$pdb->info(collection=>"Polytopes.Lattice.FewLatticePoints3D");
=============== available polydb collections =============== SECTION: Polytopes.Lattice This database contains various classes of lattice polytopes. COLLECTION: FewLatticePoints3D The finite list of 3-dimensional lattice polytopes of width at least 2 and up to 15 lattice points. This classification has been developed by Monica Blanco and Francisco Santos, who also computed the initial classification up to eleven lattice points. See the references for all proofs and more background. Author(s): Monica Blanco, University of Cantabria Francisco Santos, University of Cantabria Contributor(s): Andreas Paffenholz, TU Darmstadt Maintainer(s): Andreas Paffenholz, TU Darmstadt Cite: Blanco, Monica and Santos, Francisco, On the enumeration of lattice 3-polytopes, arxiv 1601.02577 obtain at: arxiv: https://arxiv.org/abs/1601.02577 Cite: Blanco, Monica and Santos, Francisco, Lattice 3-polytopes with six lattice points, arxiv 1501.01055 obtain at: arxiv: https://arxiv.org/abs/1501.01055 Cite: Blanco, Monica and Santos, Francisco, Lattice 3-polytopes with five lattice points, arxiv 1409.6701 obtain at: arxiv: https://arxiv.org/abs/1409.6701 Online Resources: %wp% contains the original data computed by M. Blanco and F. Santos and additional information on the polytopes and the code they used for the computation.: https://personales.unican.es/santosf/3polytopes/ Online Resources: The source code for the computation of the data in this collection can be %wp%.: https://github.com/apaffenholz/polymake_few_lattice_points_3d
$coll=$pdb->get_collection("Polytopes.Lattice.FewLatticePoints3D");
$cursor=$coll->find({"SMOOTH"=>true});
if ( $cursor->has_next()) {
$p=$cursor->next();
print $p->F_VECTOR;
}
4 6 4
while ( my $p = $cursor->next() ) {
print $p->F_VECTOR, "\n";
}
10 15 7 8 12 6
$coll=polyDB()->get_collection("Polytopes.Lattice.FewLatticePoints3D");
@polytopes=$coll->find({"N_LATTICE_POINTS"=>15, "REFLEXIVE"=>true, "TERMINAL"=>true})->all;
print scalar(@polytopes), "\n";
$p=$polytopes[0];
1
print $p->INTERIOR_LATTICE_POINTS;
1 1 1 1
$q=translate($p,new Vector([-1,-1,-1]));
print $q->VERTICES;
1 -1 -1 -1 1 0 -1 -1 1 -1 0 -1 1 0 0 -1 1 -1 -1 0 1 0 -1 0 1 -1 0 0 1 1 0 0 1 0 1 0 1 1 1 0 1 0 0 1 1 1 0 1 1 0 1 1 1 1 1 1
using Oscar
pdb = Polymake.Polydb.get_db()
coll = pdb["Polytopes.Lattice.FewLatticePoints3D"]
Polymake.Polydb.info(coll, 4)
SECTION: Polytopes A collection of families of polytopes SECTION: Polytopes.Lattice This database contains various classes of lattice polytopes. Maintained by Andreas Paffenholz, paffenholz@opt.tu-darmstadt.de, TU Darmstadt COLLECTION: Polytopes.Lattice.FewLatticePoints3D The finite list of 3-dimensional lattice polytopes of width at least 2 and up to 15 lattice points. This classification has been developed by Monica Blanco and Francisco Santos, who also computed the initial classification up to eleven lattice points. See the references for all proofs and more background. Authored by Monica Blanco, University of Cantabria Francisco Santos, https://personales.unican.es/santosf/, University of Cantabria Maintained by Andreas Paffenholz, https://www2.mathematik.tu-darmstadt.de/~paffenholz, TU Darmstadt
Polymake.Polydb.get_fields(coll)
30-element Vector{String}: "VERTICES" "CONE_AMBIENT_DIM" "N_VERTICES" "FEASIBLE" "AFFINE_HULL" "CONE_DIM" "LINEALITY_SPACE" "COMBINATORIAL_DIM" "SIMPLE" "SIMPLICIAL" "H_STAR_VECTOR" "N_LATTICE_POINTS" "N_INTERIOR_LATTICE_POINTS" ⋮ "N_HILBERT_BASIS" "NORMAL" "REFLEXIVE" "GORENSTEIN" "LATTICE_DEGREE" "LATTICE_VOLUME" "FACETS" "N_FACETS" "FACET_WIDTHS" "F_VECTOR" "SMOOTH" "VERY_AMPLE"
query = Dict("SMOOTH"=>true)
cur = Polymake.Polydb.find(coll, query)
p = iterate(cur)[1]
p.F_VECTOR
pm::Vector<pm::Integer> 4 6 4
p = iterate(cur)[1]
p.F_VECTOR
pm::Vector<pm::Integer> 10 15 7
issmooth(NormalToricVariety(normal_fan(Polyhedron(p))))
true