Hyperbolic Derivatives

hyperbolic_derivatives(first_constant, second_constant, precision=4)

Calculates the first and second derivatives 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

  • derivatives[‘first’][‘constants’] (list of float) – Coefficients of the resultant first derivative

  • derivatives[‘first’][‘evaluation’] (func) – Function for evaluating the resultant first derivative at any float or integer argument; if zero inputted as argument, it will be converted to a small, non-zero decimal value (e.g., 0.0001)

  • derivatives[‘second’][‘constants’] (list of float) – Coefficients of the resultant second derivative

  • derivatives[‘second’][‘evaluation’] (func) – Function for evaluating the resultant second derivative at any float or integer argument; if zero inputted as argument, it will be converted to a small, non-zero decimal value (e.g., 0.0001)

Notes

  • Standard form of a hyperbolic function: \(f(x) = a\cdot{\frac{1}{x}} + b\)

  • First derivative of a hyperbolic function: \(f'(x) = -a\cdot{\frac{1}{x^2}}\)

  • Second derivative of a hyperbolic function: \(f''(x) = 2a\cdot{\frac{1}{x^3}}\)

  • Basic Differentiation Forumulas

Examples

Import hyperbolic_derivatives function from regressions library
>>> from regressions.analyses.derivatives.hyperbolic import hyperbolic_derivatives
Generate the derivatives of a hyperbolic function with coefficients 2 and 3, then display the coefficients of its first and second derivatives
>>> derivatives_constants = hyperbolic_derivatives(2, 3)
>>> print(derivatives_constants['first']['constants'])
[-2.0]
>>> print(derivatives_constants['second']['constants'])
[4.0]
Generate the derivatives of a hyperbolic function with coefficients -2 and 3, then evaluate its first and second derivatives at 10
>>> derivatives_evaluation = hyperbolic_derivatives(-2, 3)
>>> print(derivatives_evaluation['first']['evaluation'](10))
0.02
>>> print(derivatives_evaluation['second']['evaluation'](10))
-0.004
Generate the derivatives of a hyperbolic function with all inputs set to 0, then display the coefficients of its first and second derivatives
>>> derivatives_zeroes = hyperbolic_derivatives(0, 0)
>>> print(derivatives_zeroes['first']['constants'])
[-0.0001]
>>> print(derivatives_zeroes['second']['constants'])
[0.0002]