Skip to content

Fix mean_second_derivative_central docstring formula (was double the computed value) - #1131

Open
AlejandroCoronadoN wants to merge 1 commit into
blue-yonder:mainfrom
AlejandroCoronadoN:fix-msdc-docstring
Open

Fix mean_second_derivative_central docstring formula (was double the computed value)#1131
AlejandroCoronadoN wants to merge 1 commit into
blue-yonder:mainfrom
AlejandroCoronadoN:fix-msdc-docstring

Conversation

@AlejandroCoronadoN

Copy link
Copy Markdown

The mean_second_derivative_central docstring's LaTeX formula does not match what the function computes. The formula carries an extra inner factor of 1/2, so the documented expression evaluates to exactly half of the returned value.

For x = [1, 3, 7, -3] the function returns -3.0 (asserted in test_feature_calculations.py), while the docstring's formula evaluates to -1.5.

The code is correct and covered by that test; only the docstring is stale. The extra 1/2 is a leftover from the 2019 refactor (#587) that rewrote the outer denominator to 1/(2(n-2)) but left the old inner 1/2 in place. This removes the redundant 1/2 and tightens the sum's upper index from n-1 to n-2, the number of valid central-difference terms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant