{"id":28212958,"url":"https://github.com/cgomesu/bash-logistic-function","last_synced_at":"2026-05-21T05:02:27.720Z","repository":{"id":118214986,"uuid":"310624353","full_name":"cgomesu/bash-logistic-function","owner":"cgomesu","description":"Implementation of the logistic function in GNU bash and bc","archived":false,"fork":false,"pushed_at":"2020-11-11T19:16:01.000Z","size":1400,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-11T12:45:29.367Z","etag":null,"topics":["bash","basic-calculator","gnu","logistic","mathematical-modelling","mathematics"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/cgomesu.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,"zenodo":null}},"created_at":"2020-11-06T14:47:50.000Z","updated_at":"2022-12-07T15:22:05.000Z","dependencies_parsed_at":"2023-04-13T16:02:46.532Z","dependency_job_id":null,"html_url":"https://github.com/cgomesu/bash-logistic-function","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/cgomesu/bash-logistic-function","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgomesu%2Fbash-logistic-function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgomesu%2Fbash-logistic-function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgomesu%2Fbash-logistic-function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgomesu%2Fbash-logistic-function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cgomesu","download_url":"https://codeload.github.com/cgomesu/bash-logistic-function/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgomesu%2Fbash-logistic-function/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265512270,"owners_count":23779896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["bash","basic-calculator","gnu","logistic","mathematical-modelling","mathematics"],"created_at":"2025-05-17T19:10:24.852Z","updated_at":"2026-05-21T05:02:27.241Z","avatar_url":"https://github.com/cgomesu.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bash-logistic-function\nAn implementation of the [**logistic function**](https://en.wikipedia.org/wiki/logistic_function) written in [**GNU bash**](https://www.gnu.org/software/bash/) and [**GNU basic calculator** (bc)](https://www.gnu.org/software/bc/). It requires four parameters (`-x`, `-m`, `-L`, `-k`) to output the value of *f(x)*. If there is an error, the function exits with `status 1`; otherwise, it exists with `status 0`. (Errors won't generate any message unless the function is called in debug mode with the argument `-d`.)\n\nThis code was meant to be used programatically to output values of a given logistic model across values of a random variable *X*.  See [**Examples**](#examples).\n\n# Usage\n```\n./logistic-function -h\n\nUsage:\n  ./logistic-function -x VALUE -m VALUE -L VALUE -k VALUE [OPTIONS]\n\n  Logistic function:\n    -x  real*  value of a variable X\n    -m  real*  m = x0: Midpoint of X\n    -L  real*  max value of f(x)\n    -k  real*  growth rate\n\n  * acceptable inputs:\n    integers:       ..., -1, 0, 1, ...\n    fractions:      ..., -1/2, -.25, 0, .25, 1/2, ...\n    positive exps:  ..., \"-(2^2)\", 0, 2^2, ...\n    natural exps:   \"e(VALUE)\"\n    natural logs:   \"l(VALUE)\"\n    square roots:   \"sqrt(VALUE)\"\n    sines:          \"s(VALUE)\"\n    cosines:        \"c(VALUE)\"\n    arctangents:    \"a(VALUE)\"\n\n  Options:\n    -d       enable debug messages.\n    -h       show this help message.\n    -s  int  # of decimals to compute f(x). default: 20.\n    -S  int  # of decimals in the output. default: 2.\n\n  Example:\n    logistic-function -x .5 -m 0 -L 1 -k 1 -s 10 -S 4\n\nAuthor: cgomesu\nRepo: https://github.com/cgomesu/bash-logistic-function\n```\n\n# Demo\n\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"img/demo-logistic.gif\"\u003e\n\u003c/p\u003e\n\n# Examples\nFor the examples below, it was assumed that `logistic-function` is in the current user's `$PATH` (e.g., `/usr/local/bin`).  In addition, the logistic model was always the **standard logistic sigmoid function** with parameters *m* = 0, *L* = 1, and *k* = 1:\n\u003cp align=\"center\"\u003e\n\t\u003cimg width=\"400\" src=\"https://upload.wikimedia.org/wikipedia/commons/8/88/Logistic-curve.svg\"\u003e\n\u003c/p\u003e\n\n## If test\nTest if a value of *X* (provided as the first argument) returns a valid status \n```\n#!/bin/bash\nif logistic-function -x \"$1\" -m 0 -L 1 -k 1 \u0026\u003e/dev/null; then\n  # do something if valid\nelse\n  # do something else\nfi\nexit 0\n```\n\n## For loop\nOutput values of *f(x)* for *x* = -1 to *x* = 1 in .1 increments\n```\n#!/bin/bash\n# in GNU systems, make use of seq to handle non-integers in a sequence\nfor x in $(seq '-1' .1 1); do logistic-function -x \"$x\" -m 0 -L 1 -k 1; done\nexit 0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcgomesu%2Fbash-logistic-function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcgomesu%2Fbash-logistic-function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcgomesu%2Fbash-logistic-function/lists"}