mydefint1



On Mar. 13, 2012, Stavros Macrakis wrote
-----------------------------------
> ...
>b) It does *not* necessarily return you to the original state:
>
>assume(x>0)$
>facts() => [x>0]
>block( assume(x>0), forget(x>0) )
>facts() => []   <<< oops, deleted existing fact
---------------------------------------------
On Mar 13, 2012, Richard Hennessy wrote
----------------------------------------
> ....  I  have another variation on it copied from pw.mac
> version 4 which fixes the  problem above.  I
> don't know if it is perfect but it may solve this issue,
> I think.
>
>/* a variation of simp_assuming that fixes a minor bug. */
>simp_given(e, [fcts]) ::=
>  buildq([e,fcts], block([_ans], unwind_protect((_ans:apply(assume, fcts),
>expand(e,0,0)), apply(forget,_ans))));
--------------------------------------------------------
On Mar. 15, 2012, Barton Willis wrote
------------------------------------------------------
> The easiest way to fix simp_assuming is to eliminate it. I've tested
> replacing calls to simp_assuming with things such as:
>  ...
-----------------------------------------

In the spirit of avoiding the versions of simp_assuming or
simp_given,..., I have used Rich's idea to avoid changing the
global facts, in what I call mydefint1

--------------------------------------------------

(%i1) display2d:false$

(%i2) mydefint1 (e78, x78, a78, b78) :=
 block  ( [domain : complex, res1, _ans],
       _ans : apply ( 'assume,
      [ not equal (x78,a78),  x78 > a78,  x78 < b78,
                                 not equal (x78,b78) ] ),
    res1 : ratsimp (integrate (e78, x78, a78, b78 ) ),
    apply ( 'forget,  _ans),
    res1)$


(%i3) assume ( x > 1,  x < 10 );
(%o3) [ x > 1,  x < 10]


(%i4) mydefint1 ( cos (x)/x^6, x, 1, 10 );

(%o4) -(%i*gamma_incomplete(-5,10*%i)-%i*gamma_incomplete(-5,%i)
                                     +%i*gamma_incomplete(-5,-%i)
                                     -%i*gamma_incomplete(-5,-10*%i)) /2

(%i5) facts();

(%o5) [ x > 1, 10 > x ]

-----------------------------------------
Whether this continues to work in 2d version mydefint2
remains to be seen.

Thanks for the suggestions, and I look forward to learning
more about contexts.

Ted