Sign Charts of Derivatives¶
- sign_chart(equation_type, coefficients, derivative_level, precision=4)¶
Creates a sign chart for a given derivative
- Parameters
equation_type (str) – Name of the type of function for which the sign chart must be constructed (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 sign chart (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
chart – Strings describing the sign (e.g., ‘positive’, ‘negative’) of the derivative between its critical points; as a result, its elements will alternate between strings (indicating the signs) and floats (indicating the end points); if the function is sinusoidal, then only the initial results within a two-period interval will be listed, but a general form to determine other end points will also be included
- Return type
list of str and float
See also
Roots for key functions:
linear_roots(),quadratic_roots(),cubic_roots(),hyperbolic_roots(),exponential_roots(),logarithmic_roots(),logistic_roots(),sinusoidal_roots()Graphical analysis:
critical_points(),key_coordinates()
Notes
Critical points for the derivative of a function: \(c_i = \{ c_1, c_2, c_3, \cdots, c_{n-1}, c_n \}\)
Midpoints and key values of the intervals demarcated by the critical points: \(m_i = \{ c_1 - 1, \frac{c_1+c_2}{2}, \frac{c_2+c_3}{2}, \cdots, \frac{c_{n-1}+c_n}{2}, c_n + 1 \}\)
Values of the derivative within the intervals: \(v_i = \{ v_1, v_2, v_3, v_4 \cdots, v_{n-1}, v_n, v_{n+1} \}\)
Sign chart: \(s = ( v_1, c_1, v_2, c_2, v_3, c_3, v_4, \dots, v_{n-1}, c_{n-1}, v_n, c_n, v_{n+1} )\)
\(v_j = negative\) if \(f'(m_j) < 0\)
\(v_j = constant\) if \(f'(m_j) = 0\)
\(v_j = positve\) if \(f'(m_j) > 0\)
Examples
- Import sign_chart function from regressions library
>>> from regressions.analyses.intervals import sign_chart
- Create the sign chart for the first derivative of a cubic function with coefficients 1, -15, 63, and -7
>>> chart_cubic = sign_chart('cubic', [1, -15, 63, -7], 1) >>> print(chart_cubic) ['positive', 3.0, 'negative', 7.0, 'positive']
- Create the sign chart for the second derivative of a sinusoidal function with coefficients 2, 3, 5, and 7
>>> chart_sinusoidal = sign_chart('sinusoidal', [2, 3, 5, 7], 2) >>> print(chart_sinusoidal) ['positive', 5.0, 'negative', 6.0472, 'positive', 7.0944, 'negative', 8.1416, 'positive', 9.1888, 'negative', '5.0 + 1.0472k']