Menu

#4160 LISP error when integrating

None
closed
nobody
5
2023-11-05
2023-07-17
Nils Bruin
No

the following example (it needs domain: complex) yields a LISP error:

(%i1) domain: complex $

(%i2) F : (log((x + 1)^p) + 1)^n $

(%i3) integrate(F,x);

Maxima encountered a Lisp error:

 In function CAR, the value of the first argument is
  0
which is not of the expected type LIST

The behaviour has been observed in 5.45.0/ECL, 5.45.1/SBCL, 5.46.0/ECL, 5.47.0/ECL so it's likely been around for a while. Given that it looks like a blatant type error on a return value, it may be very quick to fix!

(reference: https://github.com/sagemath/sage/issues/35960)

Discussion

  • Raymond Toy

    Raymond Toy - 2023-07-17

    This is happening in the function rischexplog in this bit of code:

    (AND (NOT (FINDINT (CDR RISCH-Y)))
         (NOT RISCH-NOGOOD)
         (EQUAL (#:***HERE*** (CDR YY)) 1)
         (NUMBERP (CAR YY))
         (> (- (CAR YY)) MU))
    

    YY is 0 at this point.

    This appears to be a very old bug. If the domain is not set to complex, maxima returns

                                 p log(x + 1) + 1    - 1/p                   n + 1
            expintegral_e(- n, - ----------------) %e      (p log(x + 1) + 1)
                                        p
    (%o6) - ----------------------------------------------------------------------
                                              p
    

    Don't know if this is right or not.

     
  • Robert Dodier

    Robert Dodier - 2023-11-04
    • labels: --> integrate, risch, complex domain
     
  • Robert Dodier

    Robert Dodier - 2023-11-04

    Looking at src/risch.lisp, I see that (equal (cdr yy) 1) occurs in three places in RISCHEXPLOG, and in one place it's protected by a preceding (not (atom yy)) and in the other two it is not. So if execution goes down a path without (not (atom yy)), it will run into an error with (equal (cdr yy) 1).

    I find that pasting in (not (atom yy)) in the two places it's needed makes the error go away; integrate(F, x) returns a noun expression (when domain: complex as specified in the bug report). That's disappointing, but not incorrect.

    I'll try run_testsuite and commit that as a bug fix if it doesn't break anything else.

     
  • Robert Dodier

    Robert Dodier - 2023-11-05
     
  • Robert Dodier

    Robert Dodier - 2023-11-05

    Fixed by commit [ 182b5c1 ]. Closing this report.

    With domain = complex, integrate((log((x + 1)^p) + 1)^n, x) returns a noun expression, which is disappointing but not incorrect. Even when p, n, and x are all declared real (and domain = complex), it still returns a noun. I didn't investigate that. I suppose the first thing to look at is how domain is used in the Risch code.

    Incidentally the result for domain = real appears to be correct from what I can tell in some brief testing.

     
  • Robert Dodier

    Robert Dodier - 2023-11-05
    • status: open --> closed
     

Log in to post a comment.

Monday.com Logo