defint1 abs trouble



 
-----maxima-bounces at math.utexas.edu 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.

After the assumptions and before integration, the integrand needs to be simplified. 
To fix this, either insert e78 : expand(e78,0,0) before res1 : integrate (e78, x78, a78, b78) or
try  res1 : block([?dosimp : t], integrate (e78, x78, a78, b78)). (Maybe using ?dosimp this way
in Maxima code is bad form.)
  
Also, a context version might look like

(%i2) mydefinite_integrate(e,x,a,b) := block([contx : gensym("contx")],
  unwind_protect((
    supcontext(contx),
    assume(min(a,b)<x, x < max(a,b)),
    integrate(expand(e,0,0),x,a,b)), killcontext(context)))$

(%i3) load(unwind_protect)$

(%i5) mydefinite_integrate(exp(-abs(x)), x, minf,0);
(%o5) 1

(%i6) mydefinite_integrate(exp(-abs(x)), x, 0, minf);
(%o6) -1