I have come up with a fix to the leaking problem in simp_given() that fixes
these two bugs and I don't think it can get any better than this even if you
use contexts, but I am not sure of that.
(%i19) kill(all);
(out0) done
(%i1) load(pw);
(out1)
C:/Maxima-5.27.0/share/maxima/5.27.0/share/contrib/pw.mac
(%i2) assume(c>0);
(out2) [c > 0]
(%i3) facts();
(out3) [kind(sinh, one_to_one), kind(log, one_to_one), kind(tanh,
one_to_one), kind(log, increasing), c > 0]
(%i4) c:-1;
(out4) - 1
(%i5) facts();
(out5) [kind(sinh, one_to_one), kind(log, one_to_one), kind(tanh,
one_to_one), kind(log, increasing), c > 0]
(%i6) simp_given(c,c>1);
(out6) - 1
(%i7) facts();
(out7) [kind(sinh, one_to_one), kind(log, one_to_one), kind(tanh,
one_to_one), kind(log, increasing), c > 0]
(%i8) simp_given(signum(c),c>1);
(out8) 1
(%i9) facts();
(out9) [kind(sinh, one_to_one), kind(log, one_to_one), kind(tanh,
one_to_one), kind(log, increasing), c > 0]
(%i10) d:c;
(out10) - 1
(%i11) facts();
(out11) [kind(sinh, one_to_one), kind(log, one_to_one), kind(tanh,
one_to_one), kind(log, increasing), c > 0]
(%i12) simp_given(signum(c),c>d);
(out12) 1
(%i13) simp_given(signum(c),d>0);
(out13) 1
(%i14) facts();
(out14) [kind(sinh, one_to_one), kind(log, one_to_one), kind(tanh,
one_to_one), kind(log, increasing), c > 0]
(%i15) simp_given(signum(d),d>0);
(out15) - 1
(%i16) facts();
(out16) [kind(sinh, one_to_one), kind(log, one_to_one), kind(tanh,
one_to_one), kind(log, increasing), c > 0]
(%i17)
This is better but still wrong in some ways but there is no way to fix
Maxima if it allows inconsistent facts to be present at the same time, which
it does.
Rich
PS Here is the new improved and better simp_given().
simp_given(__e, [__fcts]) ::=
buildq
(
[__e,__fcts],
block
(
[_fct, _otherfacts:facts()],
unwind_protect
(
(
apply(assume, __fcts),
expand(__e, 0, 0)
),
for _fct in facts() do
(
if not member(_fct, _otherfacts) then
apply('forget, ['_fct])
)
)
)
);
I have updated pw.mac on www.sourceforge.net with this fix. I changed the
version number to 6.5.
-----Original Message-----
From: Richard Hennessy
Sent: Saturday, June 02, 2012 7:34 PM
To: Barton Willis ; Stavros Macrakis
Cc: maxima at math.utexas.edu
Subject: Re: [Maxima] pw.mac
Oops, your both right. I didn't catch these cases. It is a bug. Contexts
should fix that.
-----Original Message-----
From: Barton Willis
Sent: Saturday, June 02, 2012 5:25 PM
To: Stavros Macrakis ; Richard Hennessy
Cc: maxima at math.utexas.edu
Subject: RE: [Maxima] pw.mac
A crazy chained assignment:
(%i3) (a : b, b : c, c : d, d : e)$
No facts:
(%i4) facts();
(%o4) []
Call simp_given on 1 with one fact a < b
(%i5) simp_given(1,a<b);
(%o5) 1
And oops--a fact leaked out:
(%i6) facts();
(%o6) [d>c]
Isn't this a bug?
--Barton
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima