rtoy / maxima

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

integrate((x^2 + x + 2)/(x^2 + x + c), x) misses case #147

Open rtoy opened 2 days ago

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-02 07:13:51 Created by robert_dodier on 2009-03-03 16:47:58 Original: https://sourceforge.net/p/maxima/bugs/1610


integrate((x^2 + x + 2)/(x^2 + x + c), x); => Is 4 c - 1 positive or negative?

integrate misses the case 4*c - 1 = 0 here.

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-02 07:13:52 Created by rtoy on 2009-03-03 17:38:17 Original: https://sourceforge.net/p/maxima/bugs/1610/#e57b


The question comes from npask:

(defun npask (exp) (cond ((freeof '$%i exp) (learn `((mnotequal) ,exp 0) t) (asksign exp)) (t '$positive)))

It seems to tell maxima that exp can't be 0. I don't know why it needs to make that assumption. If the learn statement is removed, maxima will ask if 4c-1 is pos, neg, or zero.

The testsuite runs ok with this change. That's not conclusive evidence that this change is the right thing to do. And based on the name, it seems the intent is to only ask for positive or negative values. Perhaps eprog (which calls npask) should not call npask.

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-02 07:13:54 Created by robert_dodier on 2009-03-04 04:41:17 Original: https://sourceforge.net/p/maxima/bugs/1610/#d775


I'm guessing NPASK = negative or positive ask. Looks like EPROG is making an unjustified assumption that c cannot be zero. Maybe EPROG should just call ASKSIGN directly. (Although that may cause confusion in other cases in which c is known to be zero ... dunno what EPROG should do then.)

NPASK seems like a strange function. It returns '$POSITIVE when the argument contains $%I ??

(LEARN ...) seems it should change the current assume context, although I cannot find evidence that it does. Is the assumption magically undone somewhere else??