defint1 abs trouble
- Subject: defint1 abs trouble
- From: Stavros Macrakis
- Date: Sat, 17 Mar 2012 18:22:41 -0400
This is a bug in integrate:
(%i1) expr:exp(-abs(x))$ integrate(expr,'x,minf,0);
(%o2) 1
(%i3) assume(x<0)$ integrate(expr,'x,minf,0);
defint: integral is divergent.
-- an error. To debug this try: debugmode(true);
The user should absolutely not have to fiddle with internal variables like
?dosimp to get this right.
I have filed this as bug
3507277<https://sourceforge.net/tracker/?func=detail&aid=3507277&group_id=4933&atid=104933>
.
-s
On Sat, Mar 17, 2012 at 17:10, Edwin Woollett <woollett at charter.net> wrote:
> 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
>
>
>