{"id":20231439,"url":"https://github.com/andrew-lei/intervals","last_synced_at":"2026-05-13T02:31:38.315Z","repository":{"id":142077074,"uuid":"131114030","full_name":"andrew-lei/intervals","owner":"andrew-lei","description":"Interval arithmetic for Python using algebraic data types","archived":false,"fork":false,"pushed_at":"2018-04-26T15:10:52.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-03T13:47:41.521Z","etag":null,"topics":["algebraic-data-types","interval-arithmetic"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrew-lei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-04-26T07:03:59.000Z","updated_at":"2018-04-26T15:10:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"bf5f4e83-c565-4b9a-ab7e-bd72596226f5","html_url":"https://github.com/andrew-lei/intervals","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andrew-lei/intervals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrew-lei%2Fintervals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrew-lei%2Fintervals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrew-lei%2Fintervals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrew-lei%2Fintervals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrew-lei","download_url":"https://codeload.github.com/andrew-lei/intervals/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrew-lei%2Fintervals/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32965213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T23:30:32.555Z","status":"online","status_checked_at":"2026-05-13T02:00:07.132Z","response_time":115,"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":["algebraic-data-types","interval-arithmetic"],"created_at":"2024-11-14T07:48:14.126Z","updated_at":"2026-05-13T02:31:38.300Z","avatar_url":"https://github.com/andrew-lei.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Interval arithmetic in Python using Algebraic Data Types\n\nMore or less based on [a Haskell package](https://hackage.haskell.org/package/intervals-0.8.1/docs/Numeric-Interval.html).\n\nContains an [infix class](https://github.com/ActiveState/code/tree/master/recipes/Python/384122_Infix_operators) released under PSF License.\n\nRequires uxadt\n\n```bash\nsudo pip3 install uxadt\n```\n\nSupports arithmetic (add,sub,mul,div) and comparison. \n\nComparison using forall by default.\n\nUse e.g., ltSome or leSome if x \u003c y for some values of x and y\n\nEquality is weird for intervals.\n\nAddition:\n```python3\n\u003e\u003e\u003e Interval(-1,3) + Interval(4,5)\nInterval(3,8)\n\u003e\u003e\u003e Interval(1,3) + Empty()\nEmpty()\n\u003e\u003e\u003e Empty() + Interval(1,3)\nEmpty()\n```\n\nMultiplication:\n```python3\n\u003e\u003e\u003e Interval(-1,3) * Interval(4,5)\nInterval(-5,15)\n\u003e\u003e\u003e Interval(-3,3) * Interval(-5,2)\nInterval(-15,15)\n\u003e\u003e\u003e Interval(1,3) * Empty()\nEmpty()\n\u003e\u003e\u003e Empty() * Interval(1,3)\nEmpty()\n```\n\nUnary minus operator\n```python3\n\u003e\u003e\u003e -Interval(-1,3)\nInterval(-3,1)\n\u003e\u003e\u003e -Empty()\nEmpty()\n```\n\nBinary minus operator\n```python3\n\u003e\u003e\u003e Interval(3,6) - Interval(-4,2)\nInterval(1,10)\n\u003e\u003e\u003e Empty() - Interval(1,2)\nEmpty()\n```\n\nDivision\n```python3\n\u003e\u003e\u003e Interval(1,3) / Interval(3,5)\nInterval(0.2,1.0))\n\u003e\u003e\u003e Interval(1,3) / Interval(-1,1)\nInterval(-inf,inf)\n\u003e\u003e\u003e Interval(1,3) / Interval(0,3)\nInterval(0.3333333333333333, inf)\n```\n\nInclusion\n```python3\n\u003e\u003e\u003e 1 in Interval(0,2)\nTrue\n\u003e\u003e\u003e -1 in Interval(0,2)\nFalse\n\u003e\u003e\u003e 1 in Empty()\nFalse\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrew-lei%2Fintervals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrew-lei%2Fintervals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrew-lei%2Fintervals/lists"}