Skip to content

[6.40] [math] Add test and improve doxygen of finite difference methods#22840

Merged
dpiparo merged 5 commits into
root-project:v6-40-00-patchesfrom
root-project-bot:BP_6.40_pull_22823
Jul 18, 2026
Merged

[6.40] [math] Add test and improve doxygen of finite difference methods#22840
dpiparo merged 5 commits into
root-project:v6-40-00-patchesfrom
root-project-bot:BP_6.40_pull_22823

Conversation

@root-project-bot

Copy link
Copy Markdown

Backport of #22823, requested by @hageboeck.

dpiparo and others added 5 commits July 17, 2026 09:48
(cherry picked from commit 2cebd26)
The standard second-order central, backward and forward differences
contained a mistake: a factor-of-4 error.
See finite different coefficients here: https://en.wikipedia.org/wiki/Finite_difference_coefficient

(cherry picked from commit 99c7a96)
Use a polynomial and its known derivatives to check the correctness of
the finite difference methods.

(cherry picked from commit 9851599)
The test failed without any consequences because it was always returning
0. Other "tests" in this file will need to be updated to check their
   outputs in the future.

Furthermore:
- The second derivatives are unstable with short, so remove it from the
  test.
- The targets for the second derivatives were wrong by a factor 4; fix.
- Due to rounding, finite differences on integers don't exactly hit the
  target. Allow a delta of 1.

(cherry picked from commit f3d03cb)
@github-actions

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 15h 24m 0s ⏱️
 3 862 tests  3 862 ✅ 0 💤 0 ❌
76 266 runs  76 266 ✅ 0 💤 0 ❌

Results for commit a068d3a.

@dpiparo
dpiparo merged commit 7397997 into root-project:v6-40-00-patches Jul 18, 2026
33 of 34 checks passed
@dpiparo
dpiparo deleted the BP_6.40_pull_22823 branch July 18, 2026 06:12
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.

TMath::Laplacian computes wrong finite differences

3 participants