#2708 defint fails if a limit has the same name as an array

None
open
nobody
5
2014-05-16
2014-03-27
Sergey Litvinov
No

With "branch_5_32_base_93_g33a7882" I have

(%i1) a[1]: 42$
(%i2) defint(1, x, a, b);
defint: lower limit of integration must be real; found a
-- an error. To debug this try: debugmode(true);
(%i3) defint(1, x, 'a, b);
defint: lower limit of integration must be real; found a
-- an error. To debug this try: debugmode(true);
(%i4) kill(a)$
(%i5) a: %i$
(%i6) defint(1, x, a, b);
defint: lower limit of integration must be real; found %i
-- an error. To debug this try: debugmode(true);
(%i7) defint(1, x, 'a, b);
(%o7)                                b - a

And with an older version "branch_5_30_base_126_g90a78ff" it was

(%i1) a[1]: 42$
(%i2) defint(1, x, a, b);
(%o2)                                b - a
(%i3) defint(1, x, 'a, b);
(%o3)                                b - a
(%i4) kill(a)$
(%i5) a: %i$
(%i6) defint(1, x, a, b);
defint: lower limit of integration must be real; found %i
 -- an error. To debug this try: debugmode(true);
(%i7) defint(1, x, 'a, b);
(%o7)                                b - a

I think the last transcript is how it should be (one can argue about
(%i2)).

The behavior changed after this commit which introduced
`lenient-extended-realp' and consequently a test ($member e $arrays)
for the limits of integration.

867b2548c6ac1f46d024730599ae53eb76d8985d: Switch to using
lenient-extended-realp to test $defint limits

:::lisp
src/maxima.lisp
(defun lenient-extended-realp (e)
  (and ($freeof '$infinity '$%i '$und '$ind '$false '$true t nil e) ;; what else?
       (not (mbagp e))
       (not ($featurep e '$nonscalarp))
       (not (mrelationp e))
       (not ($member e $arrays))))

Discussion

  • Hmm. Well I'm responsible for that commit, so it's my fault :-)

    I'm trying to work out why on earth I added the arrays test at all. I'm sure there was a good reason... I'll probably get rid of that bit of the test tomorrow or on Sunday, unless I think of something cleverer.