rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

integrate: "failed to order limits of integration" when it should know #3324

Open rtoy opened 4 months ago

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-07 20:52:42 Created by glorieul on 2019-03-18 20:00:51 Original: https://sourceforge.net/p/maxima/bugs/3541


Maxima's integrate function returns "failed to order limits of integration" although it knows enough to order them.

The program is the following:

kill(all);
assume(R>0, 1 - 1/(R^2) > 0);
L : sqrt(1 - 1/(R^2));
integrate(1/(1-x^2),x,0,L);

From the predicates learned it is clear that the left limit of integration is 0, and the right limit of integration is sqrt(1 - 1/(R^2))

wxMaxima 18.02.0 Maxima 5.41.0-3 (Default packages on Ubuntu 18.04.2 LTS as of Mon 18th March 2019)

rtoy commented 4 months ago

Imported from SourceForge on 2024-07-07 20:52:42 Created by robert_dodier on 2019-03-20 19:47:50 Original: https://sourceforge.net/p/maxima/bugs/3541/#8d73


rtoy commented 4 months ago

Imported from SourceForge on 2024-07-07 20:52:46 Created by robert_dodier on 2019-03-20 19:47:51 Original: https://sourceforge.net/p/maxima/bugs/3541/#4519


This is mostly a failure in of asksign which is called somewhere downstream from defint to figure out whether to reorder the limits of integration. asksign seems to conclude that it can't figure out the sign of 1 - 1/R^2 given that R > 0. Which is true, stricly speaking, but instead of asking for a stronger condition, asksign just gives up. Perhaps that is to be expected; I haven't thought it through yet.

Aside from the trouble with asksign, maybe defint should try to use the limits as they are without reordering, if asksign fails. I haven't thought that through either.

In this example I find that assume(R > 1) helps Maxima figure out a result, although the result I get is apparently spuriously complex. Trying some numerical examples suggests that the result that Maxima outputs is equal to the correct result minus pi/2 times the imaginary unit. The spuriously complex result presumably originates from the logarithm in the result. There might be a separate bug to report about that.

Here's what I get:

(%i4) assume(R>1);
(%o4)                               [R > 1]
(%i5)     integrate(1/(1-x^2),x,0,L);
         2
Is sqrt(R  - 1) - R - 1 positive, negative or zero?

n;
                           2                       2
                     sqrt(R  - 1) + R        sqrt(R  - 1) - R
                 log(----------------)   log(----------------)
                            R                       R
(%o5)            --------------------- - ---------------------
                           2                       2
rtoy commented 4 months ago

Imported from SourceForge on 2024-07-07 20:52:49 Created by glorieul on 2019-03-21 13:07:50 Original: https://sourceforge.net/p/maxima/bugs/3541/#310e


asksign seems to conclude that it can't figure out the sign of 1 - 1/R^2

Hmm… That's strange since I did define predicate 1 - 1/(R^2) > 0