[Maxima] defint1 abs trouble

Edwin Woollett woollett at charter.net
Sat Mar 17 16:10:16 CDT 2012

```I have found a definite integral  which integrate
can do but mydefint1 (revised to see what
is going on)  cannot do, leading to a
defint complaint. The example involves
the abs function.
---------------------------------------------------

(%i1) integrate (exp (-abs (x)), x, minf, 0);
(%o1)                                  1

(%i2) assume(x < 0);
(%o2)                               [x < 0]

(%i3) integrate (exp (-abs (x)), x, minf, 0);
(%o3)                                  1

(%i4) forget(x<0);
(%o4)                               [x < 0]
(%i5) facts();
(%o5)                                 []

(%i6) mydefint1 (e78, x78, a78, b78) :=
block  ( [domain : complex, xmin, xmax,
assumeL : [],  res1,  _ans],
xmin : min (a78, b78),
xmax : max (a78, b78),
if xmin  #  minf then assumeL : cons ( x78 > xmin, assumeL),
if xmax # inf then assumeL : cons (x78 < xmax, assumeL),
if debug then display (xmin, xmax, assumeL),
_ans : apply ( 'assume,  assumeL ),
res1 : ratsimp (integrate (e78, x78, a78, b78 ) ),
apply ( 'forget,  _ans),
res1)\$

(%i7) debug:true\$

(%i8) mydefint1 ( exp (-abs (x)), x, minf, 0);

xmin = minf

xmax = 0

assumeL = [x < 0]

defint: integral is divergent.

#0: mydefint1(e78=%e^-abs(x),x78=x,a78=minf,b78=0)
-- an error. To debug this try: debugmode(true);

(%i9) facts();
(%o9)                               [0 > x]

----------------------------------------------------------
I don't see what difference there is in terms of
assumptions between calling integrate directly
and using mydefint1 in the above example.

If I remove the abs(x) part, both methods work:
-------------------------------------------------------
(%i10) forget(x<0);
(%o10)                              [x < 0]
(%i11) facts();
(%o11)                                []

(%i13) integrate(exp(x),x,minf,0);
(%o13)                                 1

(%i14) mydefint1(exp(x),x,minf,0);
xmin = minf

xmax = 0

assumeL = [x < 0]

(%o14)                                 1

(%i15) facts();
(%o15)                                []
-------------------------------------------------------------
So something about the presence of abs in the
integrand prevents mydefint1 from working
as expected.

Ted

```