Skip to content

Commit

Permalink
Added code to lift reflexive polytopes to higher dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasSchachner committed Jun 2, 2024
1 parent 6f02678 commit 9f0a2da
Show file tree
Hide file tree
Showing 2 changed files with 182 additions and 0 deletions.
161 changes: 161 additions & 0 deletions Andreas/lifting_polytopes.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "1f2045c7-217c-42f1-917a-dd624c8af173",
"metadata": {},
"source": [
"**What's in this notebook?** This notebook contains code to lift reflexive polytopes to new reflexive polytopes in one higher dimension.\n",
"\n",
"(*Created:* Andreas Schachner, June 2, 2024)"
]
},
{
"cell_type": "markdown",
"id": "9e386a71-addc-4338-a6fe-24598b52bf7b",
"metadata": {},
"source": [
"# Import"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "9651f0ce-ced3-4810-b210-739aa6c1626f",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/cytools/cytools-venv/lib/python3.11/site-packages/cytools/config.py:142: UserWarning: \n",
"**************************************************************\n",
"Warning: You have enabled experimental features of CYTools.\n",
"Some of these features may be broken or not fully tested,\n",
"and they may undergo significant changes in future versions.\n",
"**************************************************************\n",
"\n",
" warnings.warn(\"\\n**************************************************************\\n\"\n"
]
}
],
"source": [
"import os, sys, warnings, tqdm, time, glob\n",
"from cytools import Polytope, Cone, private, read_polytopes, fetch_polytopes\n",
"import scipy as sp\n",
"import numpy as np\n",
"\n",
"from cytools import Polytope, private\n",
"from cytools.utils import gcd_list\n",
"from itertools import combinations\n",
"import cytools\n",
"cytools.config.enable_experimental_features()\n",
"\n",
"from lifting_reflexive_polytopes import trivial_lift"
]
},
{
"cell_type": "markdown",
"id": "357ec74d-cc16-4375-bb25-2ed9a487c0c1",
"metadata": {},
"source": [
"# Constructing 5D polytopes"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "c8a97124-e26a-49fa-96ae-b8e15e67c90b",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"g = fetch_polytopes(h11=2,limit=100,lattice=\"N\",as_list=True)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "cd81fc82-b5e7-4ded-bb8e-150e448b30bc",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"A 5-dimensional reflexive lattice polytope in ZZ^5"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"p = g[0]\n",
"p5 = trivial_lift(p)\n",
"p5"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "d2f7a580-a759-4e8d-b8a3-7bf8bec3e3fa",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"A Calabi-Yau 4-fold hypersurface with h11=3, h12=0, h13=94, and h22=432 in a 5-dimensional toric variety"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t5 = p5.triangulate()\n",
"cy4 = t5.get_cy()\n",
"cy4"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9f7a43b5-a651-4d34-9e48-1afdedfa7353",
"metadata": {
"tags": []
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
21 changes: 21 additions & 0 deletions Andreas/lifting_reflexive_polytopes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from cytools import Polytope
import numpy as np


def trivial_lift(poly):

starting_dim = poly.dim()

pts = poly.points()

origin = np.zeros(starting_dim)

new_pts = np.array([np.append(origin,1),np.append(origin,-1)])

pts_lifted = np.append(pts,np.zeros((len(pts),1)),axis=1)

pts_lifted = np.append(pts_lifted,new_pts,axis=0).astype(int)

p_lifted = Polytope(pts_lifted)

return p_lifted

0 comments on commit 9f0a2da

Please sign in to comment.