Logistic Equation¶
- logistic_equation(first_constant, second_constant, third_constant, precision=4)¶
Generates a logistic function to provide evaluations at variable inputs
- Parameters
first_constant (int or float) – Carrying capacity of the resultant 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 resultant 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 resultant 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
evaluation – Function for evaluating a logistic equation when passed any integer or float argument
- Return type
func
Notes
Standard form of a logistic function: \(f(x) = \frac{a}{1 + \text{e}^{-b\cdot(x - c)}}\)
Examples
- Import logistic_equation function from regressions library
>>> from regressions.analyses.equations.logistic import logistic_equation
- Create a logistic function with coefficients 2, 3, and 5, then evaluate it at 10
>>> evaluation_first = logistic_equation(2, 3, 5) >>> print(evaluation_first(10)) 2.0
- Create a logistic function with coefficients 100, 5, and 11, then evaluate it at 10
>>> evaluation_second = logistic_equation(100, 5, 11) >>> print(evaluation_second(10)) 0.6693
- Create a logistic function with all inputs set to 0, then evaluate it at 10
>>> evaluation_zero = logistic_equation(0, 0, 0) >>> print(evaluation_zero(10)) 0.0001