{"id":23920497,"url":"https://github.com/justinshenk/normaliz-notebook","last_synced_at":"2026-06-11T01:31:42.813Z","repository":{"id":68948255,"uuid":"78551056","full_name":"JustinShenk/normaliz-notebook","owner":"JustinShenk","description":"Testing repository for Normaliz Tutorial","archived":false,"fork":false,"pushed_at":"2017-05-02T13:29:51.000Z","size":489,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-23T21:31:24.477Z","etag":null,"topics":["basis","cone","hilbert","linear-algebra","matrix","vector"],"latest_commit_sha":null,"homepage":"https://www.normaliz.uni-osnabrueck.de/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JustinShenk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-10T16:19:25.000Z","updated_at":"2023-09-08T17:19:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"7b86bede-2a97-463a-81a8-a10f78ff461a","html_url":"https://github.com/JustinShenk/normaliz-notebook","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JustinShenk/normaliz-notebook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JustinShenk%2Fnormaliz-notebook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JustinShenk%2Fnormaliz-notebook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JustinShenk%2Fnormaliz-notebook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JustinShenk%2Fnormaliz-notebook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JustinShenk","download_url":"https://codeload.github.com/JustinShenk/normaliz-notebook/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JustinShenk%2Fnormaliz-notebook/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34178819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["basis","cone","hilbert","linear-algebra","matrix","vector"],"created_at":"2025-01-05T15:49:39.952Z","updated_at":"2026-06-11T01:31:42.805Z","avatar_url":"https://github.com/JustinShenk.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyNormaliz Web\n\nRun `api.py`. It will start a web server listening at `localhost:8090`. Requests are expected to `localhost:8091/normaliz/:v1/:v2` where `v1` and `v2` are each comma seperated tuples of the vector's respective x and y values. E.g. `localhost:8091/normaliz/1.4,1.0/2,3`.\n\nFor local development you will also want to run `web.py` which serves the web app at `localhost:8091`.\n\n\n## PyNormaliz\n\nNormaliz is a tool for computing the Hilbert bases and enumerative data of rational cones and, more generally, sets of lattice points in rational polyhedra.\n\n### Example 1: A cone in dimension 2\n\nWe want to investigate the cone ![gif](/interact_files/CodeCogsEqn.gif):\n\nThis cone is defined in the input file 2cone.in:\n\n\u003cpre\u003e\namb_space 2 \ncone 2\n1 3\n2 1\n\u003c/pre\u003e\n\nThe input tells Normaliz that the ambient space is R2, and then a cone with 2 generators is defined, namely the cone C from above.\nThe figure indicates the Hilbert basis, and this is our first computation goal.\nIf you prefer to consider the columns of a matrix as input vectors (or have got a matrix in this format from another system) you can use the input\n\nCalculate the Hilbert basis from finite vectors.\n\n\n```python\n%pylab inline\nfrom __future__ import print_function\nimport PyNormaliz\nfrom ipywidgets import interact, interactive, fixed\nfrom IPython.display import display\nimport ipywidgets as widgets\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom fractions import Fraction\n\nvectors = [[2,1],[1,4]]\ncone = PyNormaliz.NmzCone(\"cone\",vectors)\nHB = PyNormaliz.NmzResult(cone,\"HilbertBasis\")\n    \n# Draw background lattice.\nxLattice = np.arange(-1,8)\nyLattice = np.arange(-1,8)\n\ndef pltHilbertBasis(theta=np.pi/10):\n    fig,ax = plt.subplots()\n    plt.ylim([-0.5,8])\n    plt.xlim([-0.5,8])\n    ax.axis('off')\n    vectors[0][0],vectors[0][1] = np.cos(theta)*2, np.sin(theta)*2\n    ratio = vectors[0][0] / vectors[0][1]\n    integers = Fraction.from_float(ratio).limit_denominator(100)\n    # TODO: Solve for \u003e2 dimensions.\n    # for ind,d in enumerate(vectors[0]): \n    #     integers = Fraction.from_float(d).limit_denominator(100)\n\n    vectors[0][0] = integers.numerator\n    vectors[0][1] = integers.denominator\n    for x in xLattice:\n        for y in yLattice:\n            plt.plot(x,y,'ko')\n\n    # Plot bounding vectors.\n    for v in vectors:\n        ax.plot([0,v[0]*2],[0,v[1]*2],'k-')\n    \n    cone = PyNormaliz.NmzCone(\"cone\",vectors)\n    HB = PyNormaliz.NmzResult(cone,\"HilbertBasis\")\n    xList = [x for x,y in HB]\n    yList = [y for x,y in HB]\n\n    # TODO: Complete fill_between function.\n    # x = np.arange(0,0.1,2)\n    # y1 = x*2\n    # y2 = x*3\n    # ax.fill_between(x,y1,y2,where=y2\u003e=y1,facecolor='green', interpolate=True)\n    # Plot Hilbert basis.\n    ax.plot(xList,yList,'ro')\n    ax.annotate(str(0), (-.5,-.5))\n    plt.show()\n    return \"Hilbert Bases:\", HB\n\nw = interactive(pltHilbertBasis, theta=(0.01,np.pi/2,np.pi/40))\ndisplay(w)\n```\n\n\n![png](interact_files/interact_1_0.png)\n\n\n\n    ('Hilbert Bases:',\n     [[1L, 1L],\n      [1L, 2L],\n      [1L, 3L],\n      [1L, 4L],\n      [2L, 1L],\n      [3L, 1L],\n      [40L, 13L],\n      [277L, 90L]])\n\n\n\n```python\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinshenk%2Fnormaliz-notebook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustinshenk%2Fnormaliz-notebook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinshenk%2Fnormaliz-notebook/lists"}