pw.mac



I played around with the context stuff and got frustrated because I could not get it to work.  I am not sure why, the error message I got was useless, something like ?error in errmsg1? or something similar.  So I thought, I don?t know if the context mechanism works or not.  I once posted a question to this list asking if anyone knew if the context system was broken.  I got no reply.  That was probably well over a year ago.  I was trying this method back then and I was having problems.  So I decided to bypass that subsystem and came up with simp_given() instead.  If anyone can get it to work then I would use it. I have doubts, no one replied, makes you wonder.  I have doubts about the new simp_given() but it will do for now.  If someone can do better with contexts then kudos to them.

Rich


From: Stavros Macrakis 
Sent: Sunday, June 03, 2012 6:22 PM
To: Richard Hennessy 
Cc: Barton Willis ; maxima at math.utexas.edu 
Subject: Re: [Maxima] pw.mac

Richard, 


I don't understand why you're building messy wheels within wheels to work around the quirks of assume/forget when the context mechanism was designed precisely to solve the problem you have -- simply and straightforwardly (and if it doesn't, it's a bug in the context system, not your code).


As for

  there is no way to fix Maxima if it allows inconsistent facts to be present at the same time, which it does.


Are you referring to your sequence (assume(c>1), c:-1)?  Yes, it is true that Maxima does not object to this. Not sure how it could. Checking the compatibility of every assignment with the assumption database would make assignments prohibitively expensive.  Anyway, even leaving aside theoretical limits on inference, Maxima's assumption inference engine is pretty weak .


             -s


On Sun, Jun 3, 2012 at 11:38 AM, Richard Hennessy <rich.hennessy at verizon.net> wrote:

  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