Critical Values of Derivatives¶
- critical_points(equation_type, coefficients, derivative_level, precision=4)¶
Calculates the critical points of a specific function at a certain derivative level
- Parameters
equation_type (str) – Name of the type of function for which critical points must be determined (e.g., ‘linear’, ‘quadratic’)
coefficients (list of int or float) – Coefficients to use to generate the equation to investigate
derivative_level (int) – Integer corresponding to which derivative to investigate for critical points (1 for the first derivative and 2 for the second derivative)
precision (int, default=4) – Maximum number of digits that can appear after the decimal place of the results
- Raises
ValueError – First argument must be either ‘linear’, ‘quadratic’, ‘cubic’, ‘hyperbolic’, ‘exponential’, ‘logarithmic’, ‘logistic’, or ‘sinusoidal’
TypeError – Second argument must be a 1-dimensional list containing elements that are integers or floats
ValueError – Third argument must be one of the following integers: [1, 2]
ValueError – Last argument must be a positive integer
- Returns
points – Values of the x-coordinates at which the original function’s derivative either crosses the x-axis or does not exist; if the function is sinusoidal, then only five results within a two-period interval will be listed, but a general form will also be included; if the derivative has no critical points, then it will return a list of None
- Return type
list of float or str
See also
Roots for key functions:
linear_roots(),quadratic_roots(),cubic_roots(),hyperbolic_roots(),exponential_roots(),logarithmic_roots(),logistic_roots(),sinusoidal_roots()Graphical analysis:
sign_chart(),key_coordinates()
Notes
Domain of a function: \(x_i = \{ x_1, x_2, \cdots, x_n \}\)
Potential critical points of the derivative of the function: \(x_c = \{ c \mid c \in x_i, f'(c) = 0 \cup f'(c) = \varnothing \}\)
Examples
- Import critical_points function from regressions library
>>> from regressions.analyses.criticals import critical_points
- Calulate the critical points of the second derivative of a cubic function with coefficients 2, 3, 5, and 7
>>> points_cubic = critical_points('cubic', [2, 3, 5, 7], 2) >>> print(points_cubic) [-0.5]
- Calulate the critical points of the first derivative of a sinusoidal function with coefficients 2, 3, 5, and 7
>>> points_sinusoidal = critical_points('sinusoidal', [2, 3, 5, 7], 1) >>> print(points_sinusoidal) [5.5236, 6.5708, 7.618, 8.6652, 9.7124, '5.5236 + 1.0472k']