|
From: David S. <tom...@us...> - 2026-10-25 09:01:28
|
- Description has changed: Diff: ~~~~ ~~~~ - **status**: open --> closed - **Priority**: --> 5 - **Comment**: Fixed by commit [30638c]. --- **[bugs:#5294] diff\(struve\_h\(v,t\),t\) and diff\(struve\_l\(v,t\),t\) contain x^v instead of t^v** **Status:** closed **Group:** Includes\_proposed\_fix **Labels:** Claude trivial bug bessel.lisp **Created:** Sun Sep 27, 2026 08:34 AM UTC by David Scherfgen **Last Updated:** Sun Sep 27, 2026 12:31 PM UTC **Owner:** nobody This bug was discovered by Claude Opus 5.5 and reproduced on Maxima Git commit c62924c (2026-09-26) with SBCL 2.2.9. **Where:** `src/bessel.lisp`, DEFGRAD %STRUVE\_H, DEFGRAD %STRUVE\_L The derivative templates use x^v, but the DEFGRAD placeholders are $v and $z, so x is a literal free symbol instead of the argument. The result is only right when the variable happens to be named x; struve\_l has the same error. ### Steps 1. Verify that the existing behavior is incorrect: run the reproducer below; it gives the result under "Before the fix". Judge for yourself that this is wrong instead of relying on the ticket: where the bug allows it, try some related inputs of your own, or check the result another way, for example numerically or against the documentation. 2. Edit the file `src/bessel.lisp` as described under "Fix". 3. Rebuild Maxima. 4. Verify that the behavior is now correct: the reproducer gives the result under "Correct result". Judge for yourself that this is right, not only that it matches: where the bug allows it, try some related inputs of your own, including some that the fix should leave unchanged. 5. Add the test case(s) under "Test cases" to `tests/rtest16.mac`, just before the block "Leave this at the end of the file!" at its end. 6. Run the complete test suite, share tests included (`make check`, or `run_testsuite(share_tests=true);` in `./maxima-local`), and check that the change breaks no test. Failures that also occur without the change (a run on the unchanged build shows which) are pre-existing and can be ignored. 7. Add the line `* \#5294 diff(struve_h(v,t),t) and diff(struve_l(v,t),t) contain x^v instead of t^v` to `ChangeLog`, under "Bug fixes for numbered bugs:". 8. Commit the fix; a proposed Git commit message is under "Commit message". 9. Push the commit. Then set this ticket's status to "closed" and add a comment naming the commit, for example `Fixed by commit [1a2b3c].`, with the first six characters of the commit's SHA in the brackets (`git rev-parse HEAD | cut -c1-6` prints them). SourceForge links this to the commit. ### Reproducer ``` diff(struve_h(v,t),t); ``` Before the fix: ``` (x^v/(2^v*sqrt(%pi)*gamma(v+3/2))-struve_h(v+1,t)+struve_h(v-1,t))/2 ``` Correct result: ``` (t^v/(2^v*sqrt(%pi)*gamma(v+3/2))-struve_h(v+1,t)+struve_h(v-1,t))/2 ``` ### Fix In `src/bessel.lisp` (DEFGRAD %STRUVE\_H, search for "-struve\_h(v+1,z)+struve\_h(v-1,z))/2$"), replace ``` #$$ (x^v/(2^v*sqrt(%pi)*gamma(v+3/2))-struve_h(v+1,z)+struve_h(v-1,z))/2$ ``` with ``` #$$ (z^v/(2^v*sqrt(%pi)*gamma(v+3/2))-struve_h(v+1,z)+struve_h(v-1,z))/2$ ``` In `src/bessel.lisp` (DEFGRAD %STRUVE\_L, search for "+struve\_l(v+1,z)+struve\_l(v-1,z))/2$"), replace ``` #$$ (x^v/(2^v*sqrt(%pi)*gamma(v+3/2))+struve_l(v+1,z)+struve_l(v-1,z))/2$ ``` with ``` #$$ (z^v/(2^v*sqrt(%pi)*gamma(v+3/2))+struve_l(v+1,z)+struve_l(v-1,z))/2$ ``` ### Test cases Add these lines to `tests/rtest16.mac`, separated from the tests before them by two empty lines: ``` /* Bug #5294: "diff(struve_h(v,t),t) and diff(struve_l(v,t),t) contain x^v instead of t^v" */ diff(struve_h(v,t),t); (t^v/(2^v*sqrt(%pi)*gamma(v+3/2))-struve_h(v+1,t)+struve_h(v-1,t))/2$ diff(struve_l(v,t),t); (t^v/(2^v*sqrt(%pi)*gamma(v+3/2))+struve_l(v+1,t)+struve_l(v-1,t))/2$ ``` ### Commit message ``` bessel.lisp: fix derivatives of struve_h and struve_l The derivative templates of struve_h and struve_l wrote the power term as x^v, but the DEFGRAD placeholders are v and z, so x was a free symbol instead of the argument. They now use z^v. This fixes bug #5294. Found and fixed by Claude Opus 5.5. ``` --- Sent from sourceforge.net because max...@li... is subscribed to https://sourceforge.net/p/maxima/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/maxima/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |