bm.recursive-functions


Namebm.recursive-functions JSON
Version 0.6.0 PyPI version JSON
download
home_pageNone
SummaryRecursive Functions Package
upload_time2025-07-14 18:02:34
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords ackermann fibonacci recursive recursive functions
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Boring Math Library - Recursive functions

The purpose of this project is to explore different ways to efficiently
implement recursive functions in Python.

## Repos and Documentation

### Repositories

- [bm.recursive-functions][1] project on *PyPI*
- [Source code][2] on *GitHub*

### Detailed documentation

- [Detailed API documentation][3] on *GH-Pages*

## Overview

- Recursive functions
  - [Ackermann Function](#ackermanns-function)
  - [Fibonacci Sequences](#fibonacci-sequences)
- CLI applications
  - [Ackermann CGI programs](#ackermann-cli-programs)

This project is part of the [Boring Math][4] **bm.** namespace project.

### Recursive functions

Computable recursive functions can be defined with previously defined or not yet
defined values. Functions defined using previously defined values having
"base cases" are called "primitively recursive functions." Not all
computable functions are primitively recursive.

#### Ackermann's Function

- Function **ackermann_list**(m: int, n: int) -> int
  - is a total computable function that is not primitive recursive
  - becomes numerically intractable after `m=4`
  - see [CLI section](#ackermann-cli-programs) below for a 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 CLI programs

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

A [fairly standard][5] 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`

______________________________________________________________________

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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "bm.recursive-functions",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "ackermann, fibonacci, recursive, recursive functions",
    "author": null,
    "author_email": "\"Geoffrey R. Scheller\" <geoffrey@scheller.com>",
    "download_url": "https://files.pythonhosted.org/packages/53/93/efc9dfc1908ababc90a2518cc14dfc56eb1dd28ca7e0d440371b0daec7b9/bm_recursive_functions-0.6.0.tar.gz",
    "platform": null,
    "description": "# Boring Math Library - Recursive functions\n\nThe purpose of this project is to explore different ways to efficiently\nimplement recursive functions in Python.\n\n## Repos and Documentation\n\n### Repositories\n\n- [bm.recursive-functions][1] project on *PyPI*\n- [Source code][2] on *GitHub*\n\n### Detailed documentation\n\n- [Detailed API documentation][3] on *GH-Pages*\n\n## Overview\n\n- Recursive functions\n  - [Ackermann Function](#ackermanns-function)\n  - [Fibonacci Sequences](#fibonacci-sequences)\n- CLI applications\n  - [Ackermann CGI programs](#ackermann-cli-programs)\n\nThis project is part of the [Boring Math][4] **bm.** namespace project.\n\n### Recursive functions\n\nComputable recursive functions can be defined with previously defined or not yet\ndefined values. Functions defined using previously defined values having\n\"base cases\" are called \"primitively recursive functions.\" Not all\ncomputable functions are primitively recursive.\n\n#### Ackermann's Function\n\n- Function **ackermann_list**(m: int, n: int) -> int\n  - is a total computable function that is not primitive recursive\n  - becomes numerically intractable after `m=4`\n  - see [CLI section](#ackermann-cli-programs) below for a mathematical definition\n\n#### Fibonacci Sequences\n\n- Function **fibonacci**(f0: int=0, f1: int=1) -> Iterator[int]\n\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\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 CLI programs\n\nAckermann, a student of Hilbert, discovered early examples of totally\ncomputable functions that are not primitively recursive.\n\nA [fairly standard][5] 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[1]: https://pypi.org/project/bm.recursive-functions/\n[2]: https://github.com/grscheller/bm-recursive-functions/\n[3]: https://grscheller.github.io/boring-math-docs/recursive-functions/\n[4]: https://github.com/grscheller/boring-math-docs\n[5]: https://mathworld.wolfram.com/AckermannFunction.html\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Recursive Functions Package",
    "version": "0.6.0",
    "project_urls": {
        "Changelog": "https://grscheller.github.io/bm-recursive-functions/html/changelog.html",
        "Documentation": "https://grscheller.github.io/bm-recursive-functions/html/",
        "Homepage": "https://github.com/grscheller/bm-docs/blob/main/README.md",
        "Source": "https://github.com/grscheller/bm-recursive-functions"
    },
    "split_keywords": [
        "ackermann",
        " fibonacci",
        " recursive",
        " recursive functions"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "65bcf4f7d307471ae7488709eca38a00109298e79d89894628a54124429e4de7",
                "md5": "1d7ce658c83a4238ef970cbd65fe45f2",
                "sha256": "86223fe6a5662e855378bc15932bc1181c5d37319d99599d2d7f6d8f304c3b68"
            },
            "downloads": -1,
            "filename": "bm_recursive_functions-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1d7ce658c83a4238ef970cbd65fe45f2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 11099,
            "upload_time": "2025-07-14T18:02:33",
            "upload_time_iso_8601": "2025-07-14T18:02:33.896521Z",
            "url": "https://files.pythonhosted.org/packages/65/bc/f4f7d307471ae7488709eca38a00109298e79d89894628a54124429e4de7/bm_recursive_functions-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5393efc9dfc1908ababc90a2518cc14dfc56eb1dd28ca7e0d440371b0daec7b9",
                "md5": "ae1d898841b50eeeb035baf2da57049d",
                "sha256": "30e5c6cff2156c33568e39680dba6bf5e41abbef44cbbd3831619ce4426c8602"
            },
            "downloads": -1,
            "filename": "bm_recursive_functions-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ae1d898841b50eeeb035baf2da57049d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 8472,
            "upload_time": "2025-07-14T18:02:34",
            "upload_time_iso_8601": "2025-07-14T18:02:34.824727Z",
            "url": "https://files.pythonhosted.org/packages/53/93/efc9dfc1908ababc90a2518cc14dfc56eb1dd28ca7e0d440371b0daec7b9/bm_recursive_functions-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-14 18:02:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "grscheller",
    "github_project": "bm-docs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "bm.recursive-functions"
}
        
Elapsed time: 2.10632s