Logistic Roots¶
- logistic_roots(first_constant, second_constant, third_constant, precision=4)¶
Calculates the roots of a logistic function
- Parameters
first_constant (int or float) – Carrying capacity of the original logistic function; if zero, it will be converted to a small, non-zero decimal value (e.g., 0.0001)
second_constant (int or float) – Growth rate of the original logistic function; if zero, it will be converted to a small, non-zero decimal value (e.g., 0.0001)
third_constant (int or float) – Value of the sigmoid’s midpoint of the original logistic function; if zero, it will be converted to a small, non-zero decimal value (e.g., 0.0001)
precision (int, default=4) – Maximum number of digits that can appear after the decimal place of the resultant roots
- Raises
TypeError – First three arguments must be integers or floats
ValueError – Last argument must be a positive integer
- Returns
roots – List of the x-coordinates of all of the x-intercepts of the original function; if the function never crosses the x-axis, then it will return a list of None
- Return type
list of float
Notes
Standard form of a logistic function: \(f(x) = \frac{a}{1 + \text{e}^{-b\cdot(x - c)}}\)
Logistic formula: \(x = \varnothing\)
Examples
- Import logistic_roots function from regressions library
>>> from regressions.analyses.roots.logistic import logistic_roots
- Calculate the roots of a logistic function with coefficients 2, 3, and 5
>>> roots_first = logistic_roots(2, 3, 5) >>> print(roots_first) [None]
- Calculate the roots of a logistic function with coefficients 100, 5, and 11
>>> roots_second = logistic_roots(100, 5, 11) >>> print(roots_second) [None]
- Calculate the roots of a logistic function with all inputs set to 0
>>> roots_zeroes = logistic_roots(0, 0, 0) >>> print(roots_zeroes) [None]