grscheller.boring-math


Namegrscheller.boring-math JSON
Version 0.4.9 PyPI version JSON
download
home_pageNone
Summary### Mathematical Libraries Package
upload_time2025-01-17 05:11:07
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords math mathematics lcm gcd primes comb combinations pythagorean triples ackermann fibonacci
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Daddy's boring math library

WARNING: This project was ARCHIVED!

It was becoming a mono-repo and was split up into four namespace
projects:

* bm.integer-math
* bm.probability-distributions
* bm.pythagorean-triples
* bm.recursive-functions

Python package of modules of a mathematical nature. The project
name was suggested by my then 13 year old daughter Mary.

* **Repositories**
  * [grscheller.boring-math][1] project on *PyPI*
  * [Source code][2] on *GitHub*
* **Detailed documentation**
  * [Detailed API documentation][3] on *GH-Pages*

## Overview

Here are the [modules](#library-modules) and
[executables](#cli-applications) which make up the
grscheller.boring-math PyPI project.

## Library Modules

### Integer Math Module

* Number Theory
  * Function **gcd**(int, int) -> int
    * greatest common divisor of two integers
    * always returns a non-negative number greater than 0
  * Function **lcm**(int, int) -> int
    * least common multiple of two integers
    * always returns a non-negative number greater than 0
  * Function **coprime**(int, int) -> tuple(int, int)
    * make 2 integers coprime by dividing out gcd
    * preserves signs of original numbers
  * Function **iSqrt**(int) -> int
    * integer square root
    * same as math.isqrt
  * Function **isSqr**(int) -> bool
    * returns true if integer argument is a perfect square
  * Function **primes**(start: int, end: int) -> Iterator[int]
    * now using *Wilson's Theorem*
  * Function **legendre_symbol**(a: int, p: int) -> int
    * where `p > 2` is a prime number
  * Function **jacobi_symbol**(a: int, n: int) -> int
    * where `n > 0`
* Combinatorics
  * Function **comb**(n: int, m: int) -> int
    * returns number of combinations of n items taken m at a time
    * pure integer implementation of math.comb

---

### Pythagorean Triple Module

* Pythagorean Triple Class
  * Method **Pythag3.triples**(a_start: int, a_max: int, max: Optional[int]) -> Iterator[int]
    * Returns an iterator of tuples of primitive *Pythagorean* triples
  * A Pythagorean triple is a tuple in positive integers (a, b, c)
    * such that `a² + b² = c²`
    * `a, b, c` represent integer sides of a right triangle
    * a *Pythagorean* triple is primitive if gcd of `a, b, c` is `1`
  * Iterator finds all primitive Pythagorean Triples
    * where `0 < a_start <= a < b < c <= max` where `a <= a_max`
    * if `max = 0` find all theoretically possible triples with `a <= a_max`

---

### Recursive Function Module

#### Ackermann's Function

* Function **ackermann_list**(m: int, n: int) -> int
  * an example of a total computable function that is not primitive recursive
  * becomes numerically intractable after `m=4`
  * see CLI section below for mathematical definition

#### Fibonacci Sequences

* Function **fibonacci**(f0: int=0, f1: int=1) -> Iterator[int]
  * returns a *Fibonacci* sequence iterator where
    * `f(0) = f0` and `f(1) = f1`
    * `f(n) = f(n-1) + f(n-2)`
  * yield defaults to `0, 1, 1, 2, 3, 5, 8, 13, 21, ...`

* Function **rev_fibonacci**(f0: int=0, f1: int=1) -> Iterator[int]
  * returns a *Reverse Fibonacci* sequence iterator where
    * `rf(0) = f0` and `rf(1) = f1`
    * `rf(n) = rf(n-1) - rf(n-2)`
      * `rf(0) = fib(-1) = 1`
      * `rf(1) = fib(-2) = -1`
      * `rf(2) = fib(-3) = 2`
      * `rf(3) = fib(-4) = -3`
      * `rf(4) = fib(-5) = 5`
  * yield defaults to `1, -1, 2, -3, 5, -8, 13, -21, ...`

---

## CLI Applications

Implemented in an OS and package build tool independent way via the
project.scripts section of pyproject.toml.

### Ackermann's function CLI scripts

Ackermann, a student of Hilbert, discovered early examples of totally
computable functions that are not primitively recursive.

A [fairly standard][4] definition of the Ackermann function is
recursively defined for `m,n >= 0` by

```
   ackermann(0,n) = n+1
   ackermann(m,0) = ackermann(m-1,1)
   ackermann(m,n) = ackermann(m-1, ackermann(m, n-1))
```

#### CLI program **ackermann_list**

* Given two non-negative integers, evaluates Ackermann's function
* Implements the recursion via a Python array
* **Usage:** `ackerman_list m n`

---

### Pythagorean triple CLI script

Geometrically, a *Pythagorean* triangle is a right triangle with
positive integer sides.

#### CLI program **pythag3**

* Generates primitive Pythagorean triples
  * A primitive Pythagorean triple is a 3-tuple of integers `(a, b, c)` such that
    * `a³ + b³ = c³` where `a,b,c > 0` and `gcd(a,b,c) = 1`
  * The integers `a, b, c` represent the sides of a right triangle
* **Usage:** `pythag3 [m [n [max]]`
  * 3 args print all triples with `m <= a <= n` and `a < b < c <= max`
  * 2 args print all triples with `m <= a <= n`
  * 1 arg prints all triples with `a <= m`
  * 0 args print all triples with `3 <= a <= 100`

---

[1]: https://pypi.org/project/grscheller.boring-math/
[2]: https://github.com/grscheller/boring-math/
[3]: https://grscheller.github.io/grscheller-pypi-namespace-docs/boring-math/
[4]: https://mathworld.wolfram.com/AckermannFunction.html

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "grscheller.boring-math",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "math, mathematics, lcm, gcd, primes, comb, combinations, pythagorean triples, ackermann, fibonacci",
    "author": null,
    "author_email": "\"Geoffrey R. Scheller\" <geoffrey@scheller.com>",
    "download_url": "https://files.pythonhosted.org/packages/82/c8/dea881e78b706e6097997e59f5fb4dbf91e189d62dd7e25863d426996910/grscheller_boring_math-0.4.9.tar.gz",
    "platform": null,
    "description": "# Daddy's boring math library\n\nWARNING: This project was ARCHIVED!\n\nIt was becoming a mono-repo and was split up into four namespace\nprojects:\n\n* bm.integer-math\n* bm.probability-distributions\n* bm.pythagorean-triples\n* bm.recursive-functions\n\nPython package of modules of a mathematical nature. The project\nname was suggested by my then 13 year old daughter Mary.\n\n* **Repositories**\n  * [grscheller.boring-math][1] project on *PyPI*\n  * [Source code][2] on *GitHub*\n* **Detailed documentation**\n  * [Detailed API documentation][3] on *GH-Pages*\n\n## Overview\n\nHere are the [modules](#library-modules) and\n[executables](#cli-applications) which make up the\ngrscheller.boring-math PyPI project.\n\n## Library Modules\n\n### Integer Math Module\n\n* Number Theory\n  * Function **gcd**(int, int) -> int\n    * greatest common divisor of two integers\n    * always returns a non-negative number greater than 0\n  * Function **lcm**(int, int) -> int\n    * least common multiple of two integers\n    * always returns a non-negative number greater than 0\n  * Function **coprime**(int, int) -> tuple(int, int)\n    * make 2 integers coprime by dividing out gcd\n    * preserves signs of original numbers\n  * Function **iSqrt**(int) -> int\n    * integer square root\n    * same as math.isqrt\n  * Function **isSqr**(int) -> bool\n    * returns true if integer argument is a perfect square\n  * Function **primes**(start: int, end: int) -> Iterator[int]\n    * now using *Wilson's Theorem*\n  * Function **legendre_symbol**(a: int, p: int) -> int\n    * where `p > 2` is a prime number\n  * Function **jacobi_symbol**(a: int, n: int) -> int\n    * where `n > 0`\n* Combinatorics\n  * Function **comb**(n: int, m: int) -> int\n    * returns number of combinations of n items taken m at a time\n    * pure integer implementation of math.comb\n\n---\n\n### Pythagorean Triple Module\n\n* Pythagorean Triple Class\n  * Method **Pythag3.triples**(a_start: int, a_max: int, max: Optional[int]) -> Iterator[int]\n    * Returns an iterator of tuples of primitive *Pythagorean* triples\n  * A Pythagorean triple is a tuple in positive integers (a, b, c)\n    * such that `a\u00b2 + b\u00b2 = c\u00b2`\n    * `a, b, c` represent integer sides of a right triangle\n    * a *Pythagorean* triple is primitive if gcd of `a, b, c` is `1`\n  * Iterator finds all primitive Pythagorean Triples\n    * where `0 < a_start <= a < b < c <= max` where `a <= a_max`\n    * if `max = 0` find all theoretically possible triples with `a <= a_max`\n\n---\n\n### Recursive Function Module\n\n#### Ackermann's Function\n\n* Function **ackermann_list**(m: int, n: int) -> int\n  * an example of a total computable function that is not primitive recursive\n  * becomes numerically intractable after `m=4`\n  * see CLI section below for mathematical definition\n\n#### Fibonacci Sequences\n\n* Function **fibonacci**(f0: int=0, f1: int=1) -> Iterator[int]\n  * returns a *Fibonacci* sequence iterator where\n    * `f(0) = f0` and `f(1) = f1`\n    * `f(n) = f(n-1) + f(n-2)`\n  * yield defaults to `0, 1, 1, 2, 3, 5, 8, 13, 21, ...`\n\n* Function **rev_fibonacci**(f0: int=0, f1: int=1) -> Iterator[int]\n  * returns a *Reverse Fibonacci* sequence iterator where\n    * `rf(0) = f0` and `rf(1) = f1`\n    * `rf(n) = rf(n-1) - rf(n-2)`\n      * `rf(0) = fib(-1) = 1`\n      * `rf(1) = fib(-2) = -1`\n      * `rf(2) = fib(-3) = 2`\n      * `rf(3) = fib(-4) = -3`\n      * `rf(4) = fib(-5) = 5`\n  * yield defaults to `1, -1, 2, -3, 5, -8, 13, -21, ...`\n\n---\n\n## CLI Applications\n\nImplemented in an OS and package build tool independent way via the\nproject.scripts section of pyproject.toml.\n\n### Ackermann's function CLI scripts\n\nAckermann, a student of Hilbert, discovered early examples of totally\ncomputable functions that are not primitively recursive.\n\nA [fairly standard][4] definition of the Ackermann function is\nrecursively defined for `m,n >= 0` by\n\n```\n   ackermann(0,n) = n+1\n   ackermann(m,0) = ackermann(m-1,1)\n   ackermann(m,n) = ackermann(m-1, ackermann(m, n-1))\n```\n\n#### CLI program **ackermann_list**\n\n* Given two non-negative integers, evaluates Ackermann's function\n* Implements the recursion via a Python array\n* **Usage:** `ackerman_list m n`\n\n---\n\n### Pythagorean triple CLI script\n\nGeometrically, a *Pythagorean* triangle is a right triangle with\npositive integer sides.\n\n#### CLI program **pythag3**\n\n* Generates primitive Pythagorean triples\n  * A primitive Pythagorean triple is a 3-tuple of integers `(a, b, c)` such that\n    * `a\u00b3 + b\u00b3 = c\u00b3` where `a,b,c > 0` and `gcd(a,b,c) = 1`\n  * The integers `a, b, c` represent the sides of a right triangle\n* **Usage:** `pythag3 [m [n [max]]`\n  * 3 args print all triples with `m <= a <= n` and `a < b < c <= max`\n  * 2 args print all triples with `m <= a <= n`\n  * 1 arg prints all triples with `a <= m`\n  * 0 args print all triples with `3 <= a <= 100`\n\n---\n\n[1]: https://pypi.org/project/grscheller.boring-math/\n[2]: https://github.com/grscheller/boring-math/\n[3]: https://grscheller.github.io/grscheller-pypi-namespace-docs/boring-math/\n[4]: https://mathworld.wolfram.com/AckermannFunction.html\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "### Mathematical Libraries Package",
    "version": "0.4.9",
    "project_urls": {
        "Changelog": "https://github.com/grscheller/boring-math/blob/main/CHANGELOG.md",
        "Documentation": "https://grscheller.github.io/grscheller-pypi-namespace-docs/boring-math",
        "Source": "https://github.com/grscheller/boring-math"
    },
    "split_keywords": [
        "math",
        " mathematics",
        " lcm",
        " gcd",
        " primes",
        " comb",
        " combinations",
        " pythagorean triples",
        " ackermann",
        " fibonacci"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fa7bd7f32cc3f00abceaf1be66b7e0a544090318bbec70d960891e647a156e3d",
                "md5": "ef0fcd23405f496fe4e2725c74d6c588",
                "sha256": "fbc5f39e518323b53998200cc88b6e2fe990c437b68c4c14d43d6dea2115f9f0"
            },
            "downloads": -1,
            "filename": "grscheller_boring_math-0.4.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ef0fcd23405f496fe4e2725c74d6c588",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 28291,
            "upload_time": "2025-01-17T05:11:04",
            "upload_time_iso_8601": "2025-01-17T05:11:04.893548Z",
            "url": "https://files.pythonhosted.org/packages/fa/7b/d7f32cc3f00abceaf1be66b7e0a544090318bbec70d960891e647a156e3d/grscheller_boring_math-0.4.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "82c8dea881e78b706e6097997e59f5fb4dbf91e189d62dd7e25863d426996910",
                "md5": "4f0263f07640557a54baf6ae086b1b12",
                "sha256": "aa03067357644e5a7f6dab908999f8a97286c40cb6ada60a614621f8132ef79e"
            },
            "downloads": -1,
            "filename": "grscheller_boring_math-0.4.9.tar.gz",
            "has_sig": false,
            "md5_digest": "4f0263f07640557a54baf6ae086b1b12",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 24739,
            "upload_time": "2025-01-17T05:11:07",
            "upload_time_iso_8601": "2025-01-17T05:11:07.204112Z",
            "url": "https://files.pythonhosted.org/packages/82/c8/dea881e78b706e6097997e59f5fb4dbf91e189d62dd7e25863d426996910/grscheller_boring_math-0.4.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-17 05:11:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "grscheller",
    "github_project": "boring-math",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "grscheller.boring-math"
}
        
Elapsed time: 0.59883s