Logarithmic Roots¶
- logarithmic_roots(first_constant, second_constant, precision=4)¶
Calculates the roots of a logarithmic function
- Parameters
first_constant (int or float) – Coefficient of the logarithmic term of the original logarithmic function; if zero, it will be converted to a small, non-zero decimal value (e.g., 0.0001)
second_constant (int or float) – Coefficient of the constant term of the original logarithmic 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 two 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
- Return type
list of float
See also
logarithmic_equation(),logarithmic_derivatives(),logarithmic_integral(),logarithmic_model()Notes
Standard form of a logarithmic function: \(f(x) = a\cdot{\ln{x}} + b\)
Logarithmic formula: \(x = \text{e}^{-\frac{b}{a}}\)
Examples
- Import logarithmic_roots function from regressions library
>>> from regressions.analyses.roots.logarithmic import logarithmic_roots
- Calculate the roots of a logarithmic function with coefficients 2 and 3
>>> roots_first = logarithmic_roots(2, 3) >>> print(roots_first) [0.2231]
- Calculate the roots of a logarithmic function with coefficients -2 and 3
>>> roots_second = logarithmic_roots(-2, 3) >>> print(roots_second) [4.4817]
- Calculate the roots of a logarithmic function with all inputs set to 0
>>> roots_zeroes = logarithmic_roots(0, 0) >>> print(roots_zeroes) [0.3679]