Test 265 of rtest_integrate has a comment saying that "The expand(XXX,0,0) is due to a bug--the antiderivative is unsimplified." No, I think it's worse than that--the problem is that 'simplifya' isn't idempotent. Observe how the factor of 'd' changes position in the denominator:
(%i1) XXX : integrate(a^(d*z) * h^(c*z),z);
"Is "(c*log(h))/(log(a)*d)" equal to "-1"?"n;
(XXX) (a^(d*z))^((c*log(h))/(log(a)*d)+1)/(log(a)*d*((c*log(h))/(log(a)*d)+1))
(%i2) expand(XXX,0,0);
(%o2) (a^(d*z))^((c*log(h))/(log(a)*d)+1)/(log(a)*((c*log(h))/(log(a)*d)+1)*d)
(%i3) expand(%,0,0);
(%o3) (a^(d*z))^((c*log(h))/(log(a)*d)+1)/(log(a)*d*((c*log(h))/(log(a)*d)+1))
(%i4) expand(%,0,0);
(%o4) (a^(d*z))^((c*log(h))/(log(a)*d)+1)/(log(a)*d*((c*log(h))/(log(a)*d)+1))
(%i5) expand(%,0,0);
(%o5) (a^(d*z))^((c*log(h))/(log(a)*d)+1)/(log(a)*((c*log(h))/(log(a)*d)+1)*d)
(%i6) expand(%,0,0);
(%o6) (a^(d*z))^((c*log(h))/(log(a)*d)+1)/(log(a)*d*((c*log(h))/(log(a)*d)+1))
Another example (Maxima 5.47):
Maxima 5.47.0 SBCL 2.4.7 MacOS
Last edit: Stavros Macrakis 2024-10-13
Here is a simpler case of the original problem:
Interestingly, this depends critically on the variable names being in that order. I tried all the permutations of variable orders, and only this order was problematic. The function name didn't matter.
For example,
is unchanged by expand.
So this suggests that the problem is in great/orderlessp, as it was in the Methuselah bug. So I tested orderlessp and found the following cases where it is not transitive:
For each of these cases,
orderlessp(l[1],l[2])andorderlessp(l[2],l[3])are true, butorderlessp(l[1],l[3])is false.This means that the result of sort depends on the order of the inputs:
This of course also breaks other functions that depend on ordering:
Tested in Maxima 5.47.0 SBCL 2.4.7 MacOS
Last edit: Stavros Macrakis 2024-11-07
The bug
is almost surely caused by the function
ordmexpt(defined insimp.lisp). Specifically, the offending function is (with a comment inserted by me about the offending lines)This function is supposed to be a syntactic, not semantic, comparison. For that reason, the way the function compares expressions after applying
simpln1and%logmakes me uncomfortable. There are lots of option variables that alter the waylogexpressions are simplified, so comparing the logarithms of the expressions seems like a potential problem.Also, the function
maxima-constantpdoesn't catch most (any?) non-atomic constants, so using it seems wrong.Other such bugs are not hard to find--just define a list of expressions and test all triples from the list. Using this method, I found 100s of examples of these bugs; here is an example:
~~~
LL : sort([-(1/c^%pi),-(1/(1/c)^%pi),b*c])$
~~~
See proposed solution in [#3072]
Related
Bugs:
#3072Fixed by Commit [227d11]. Closing this ticket.
Related
Commit: [227d11]