Subject: Re: binomial(x,x) => 1, but binomial(-1,-1) => 0
From: Stavros Macrakis
Date: Sun, 24 Aug 2003 16:18:47 -0400
> * fix the bug that the answers don't get killed after use.
> This might be non-trivial
Are you referring to my bug report 626607? That only appears to happen
if there is some sort of error during the evaluation of the integral.
Presumably the asksign database isn't being unwound correctly in that
case.
By the way, there is the *opposite* problem as well (as Fateman has
pointed out): that if you calculate some result based on an assumption,
that assumption does not get attached to the result. To take a trivial
example:
posx: (asksign(x), abs(x)) => x
asksign(posx) => asks the sign of x again, and allows the
possibility of neg
> * generate the exact answer (this is the part which has to be
> implemented first)
One way of doing this would be to wrap existing modules of Maxima with a
layer which intercepts asksigns and calculates all the possible results.
The top level of this layer (call it all_asksign) would keep track of
assumptions which had been tried and evaluate the expression under all
assumptions which hadn't yet been tried. Asksign would be modified so
that if called within all_asksign, instead of asking the user, it would
try one assumption, and add to the list of assumptions to try for the
top level.
For example:
all_asksign( '( limit(x^a,a,inf) ))
limit calls asksign(abs(x)-1)
that isn't known, so it returns pos and notes that the case
abs(x)-1>0 has been tried
limit calls asksign(x)
that isn't known, so it returns pos and notes that the case
(abs(x)-1>0 and x>0) has been tried
limit returns 0
all_asksign now sets up a context where abs(x)-1 <= 0
and calls limit again
limit calls asksign(abs(x)-1)
the case >0 has been tried, so it now tries =0 and notes it
limit calls asksign(x)
etc. etc.
In the end, it gets several different answers, some of which are
identical (in fact, limit asks too many questions about x) and combines
them into
if abs(x)-1>0 then
if x>0 then inf
elseif x<0 then infinity
else error("???")
elseif abs(x)-1=0 then
if x>0 then 1
elseif x<0 then ind
else error("???")
elseif abs(x)-1<0 then 0
else error("???")
(Note that limit currently DOES NOT get all these cases right.... cf my
bug report 660766)
-s