Hyperbolic Roots

hyperbolic_roots(first_constant, second_constant, precision=4)

Calculates the roots of a hyperbolic function

Parameters
  • first_constant (int or float) – Coefficient of the reciprocal variable of the original hyperbolic 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 hyperbolic 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; 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 hyperbolic function: \(f(x) = a\cdot{\frac{1}{x}} + b\)

  • Hyperbolic formula: \(x = -\frac{a}{b}\)

Examples

Import hyperbolic_roots function from regressions library
>>> from regressions.analyses.roots.hyperbolic import hyperbolic_roots
Calculate the roots of a hyperbolic function with coefficients 2 and 3
>>> roots_first = hyperbolic_roots(2, 3)
>>> print(roots_first)
[-0.6667]
Calculate the roots of a hyperbolic function with coefficients -2 and 3
>>> roots_second = hyperbolic_roots(-2, 3)
>>> print(roots_second)
[0.6667]
Calculate the roots of a hyperbolic function with all inputs set to 0
>>> roots_zeroes = hyperbolic_roots(0, 0)
>>> print(roots_zeroes)
[-1.0]