simp_assuming (was Re: mydefint2)



 
> I'd like some discussion on whether with_assumptions should resimplify the result or not.

Uses new and old have reason to be confused between simplification or evaluation:

 (%i4) :lisp($integrate (list (list 'mtimes) 5 (list (list '$f) 'x)) 'x))
 ((%INTEGRATE) ((MTIMES) 5 (($F) X)) X)
 
 (%i4) :lisp(take '(%integrate) (list (list 'mtimes) 5 (list (list '$f) 'x)) 'x)
 ((MTIMES SIMP) 5 ((%INTEGRATE SIMP) (($F SIMP) X) X))

Further:

(%i1) load(abs_integrate)$

(%i2) assume(a>0)$

Bogus answer + spurious asksign:

 (%i3) integrate(1/(1+abs(x)),x,-a,a);
     "Is  "a-1"  positive, negative, or zero?"pos;
    Principal Value
  (%o3) log(a+1)-log(1-a)+%i*%pi

Oops...same problem different variables: OK answer + spurious asksign:

 (%i4) assume(aa > 0)$
 (%i5) integrate(1/(1+abs(x)),x,-aa,aa);
  "Is  "aa"  positive, negative, or zero?"pos;
  (%o5) 2*log(aa+1)

Cut the expand(e,0,0) out of simp_assuming:

 (%i6) simp_assuming (e, [fcts]) ::= buildq ([e, fcts],
     unwind_protect((apply('supcontext, [gensym("cntxt")]), apply('assume, fcts),e),
         killcontext (context)));
 (%o6) simp_assuming(e,[fcts])::=buildq([e,fcts],unwind_protect((apply('supcontext,   [gensym("cntxt")]),apply('assume,fcts),e),killcontext(context)))

OK:

 (%i7) integrate(1/(1+abs(x)),x,-a,a);
 (%o7) 2*log(a+1)

Maybe all this is due to the way abs_integrate extends integration by tellsimp:

matchdeclare(x, symbolp, [q,a,b], lambda([s], true));
block([simp : false], tellsimpafter('integrate(q,x), extra_integrate(q,x)),
	     	      tellsimpafter('integrate(q,x,a,b), extra_definite_integrate(q,x,a,b)));

Maybe it's something else. The macro in my simp_assuming made debugging challenging. My 
simp_assuming-less version fixes this bug--debugging is a easier without the macro, at least for me.

--bw