From: Robert D. <rob...@us...> - 2024-08-18 01:45:49
|
I think the idea with the `declare(..., even)` is that the integral is zero when the exponent is an odd positive integer. It wouldn't hurt to test both odd and even, I guess. The test for the result being positive seems like a pretty weak test -- seems much more informative to test for a specific result. Aside from that, we could test with a variable declared even or odd, and also with specific even or odd values -- those should come out the same, of course. I see from looking at the original bug report (https://sourceforge.net/p/maxima/bugs/2726/) that the declaration is said to be a workaround -- maybe we want to test with and, especially, without the declaration. --- **[bugs:#4339] rtest16 #538** **Status:** open **Group:** None **Labels:** testsuite rtest16 **Created:** Mon Aug 05, 2024 12:44 PM UTC by Barton Willis **Last Updated:** Sun Aug 18, 2024 01:38 AM UTC **Owner:** nobody Test 538 in rtest16 is ``` /* #2726: Integrate produces wrong answer for Gaussian Moments */ (declare(m2726, even), block([tmp: integrate(exp(-x^2/2)/sqrt(2*%pi) * x^m2726, x, -1/4, 1/4)], sign (subst(m2726 = 4, tmp)))); pos$ ``` First, I don't think that `m2767` should need to be declared to be even; and second, the integral diverges when `m2726 <= -1`. I think the test should be modified to ``` /* #2726: Integrate produces wrong answer for Gaussian Moments */ block([tmp, m2726], assume(m2726+1 > 0), tmp : integrate(exp(-x^2/2)/sqrt(2*%pi) * x^m2726, x, -1/4, 1/4), tmp : sign(subst(m2726 = 4, tmp)), forget(m2726+1 > 0), tmp); ``` Now Maxima 5.47 passes this test OK. But if `domain` is complex, the test will ask if `m2726` is an integer. Actually, with Maxima 5.47, we have ``` (%i9) integrate(exp(-x^2/2)/sqrt(2*%pi) * x^m2726, x, -1/4, 1/4); (%o9) (-(2^(m2726/2-1/2)*(-1)^m2726*gamma_incomplete((m2726+1)/2,1/32)) -2^(m2726/2-1/2)*gamma_incomplete((m2726+1)/2,1/32) +2^((m2726-1)/2)*(-1)^m2726*gamma_incomplete((m2726+1)/2,0) +gamma_incomplete(m2726/2+1/2,0)*2^(m2726/2-1/2)) /(sqrt(2)*sqrt(%pi)) ``` The definite integral is OK, I think, but it's undefined when `m2726 <= -1`. --- 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. |