Menu

#1408 opproperties

closed
5
2010-05-15
2008-05-02
No

This is a bug from share_testsuite:

(%i1) load(multiadditive)$
(%i2) declare(myabs, idempotent, myabs, multiplicative)$
(%i3) myabs(xp * myabs(z));
(%o3) myabs(xp)*myabs(myabs(z))

(%o3) should be myabs(xp)*myabs(z)

Andrej

Discussion

  • Robert Dodier

    Robert Dodier - 2008-05-04

    Logged In: YES
    user_id=501686
    Originator: NO

    Looks like the result is not maximally simplified --- reevaluating %o3 => myabs(xp)*myabs(z) as expected.

     
  • Barton Willis

    Barton Willis - 2008-05-07

    Logged In: YES
    user_id=895922
    Originator: NO

    ...with GCL it's OK:

    (%i1) load(multiadditive);
    (%o1) C:/PROGRA~1/MAXIMA~2.0/share/maxima/5.15.0/share/contrib/multiadditive.lisp
    (%i2) declare(myabs, idempotent, myabs, multiplicative);
    (%o2) done
    (%i3) myabs(xp)*myabs(myabs(z));
    (%o3) myabs(xp)*myabs(z)
    (%i4) build_info();
    Maxima version: 5.15.0
    Maxima build date: 17:36 4/20/2008
    host type: i686-pc-mingw32
    lisp-implementation-type: GNU Common Lisp (GCL)
    lisp-implementation-version: GCL 2.6.8

    Is this a noun / verb problem?

     
  • Barton Willis

    Barton Willis - 2008-05-07

    Logged In: YES
    user_id=895922
    Originator: NO

    Try this experiment with non-GCL Maxima

    (%i7) :lisp(trace eq idempotent);
    Warning:
    EQ is being redefined.
    Warning:
    EQ is being redefined.
    (EQ IDEMPOTENT)

    myabs(xp)*myabs(myabs(z));

    <junk>

    1> (IDEMPOTENT (($MYABS) $XP) NIL)
    <1 (IDEMPOTENT (($MYABS SIMP) $XP))
    1> (IDEMPOTENT (($MYABS) $Z) NIL)
    <1 (IDEMPOTENT (($MYABS SIMP) $Z))
    1> (IDEMPOTENT (($MYABS) (($MYABS SIMP) $Z)) NIL)
    2> (EQ $MYABS $MYABS)
    <2 (EQ T)
    <1 (IDEMPOTENT (($MYABS SIMP) $Z))

     
  • Robert Dodier

    Robert Dodier - 2008-05-14

    Logged In: YES
    user_id=501686
    Originator: NO

    Barton, I think you have tried the wrong example. You have myabs(xp)*myabs(myabs(z)) as the test case, but the original report has myabs(xp * myabs(z)). I see the bug when I try the original test case with GCL (on Windows). How about you?

     
  • Barton Willis

    Barton Willis - 2008-06-23
    • assigned_to: nobody --> willisbl
     
  • Barton Willis

    Barton Willis - 2008-06-23

    Logged In: YES
    user_id=895922
    Originator: NO

    Yes, I did try the wrong example.

    Changing the order of *opers-list fixes this problem. Specifically,
    in contrib/multiadditive.lisp, change

    (setq opers (cons '$idempotent opers)
    *opers-list (cons '($idempotent . idempotent) *opers-list))

    to

    (setq opers (cons '$idempotent opers)
    *opers-list `(,@*opers-list ($idempotent . idempotent)))

    Then

    (%i10) declare(myabs, multiplicative, myabs,idempotent)$
    (%i11) myabs(xp * myabs(z));
    (%o11) myabs(xp)*myabs(z)

    After testing and collecting comments, I'll commit this fix. It's unfortunate
    that the *opers-list scheme is order dependent. But that's the way it is
    intended to work, I think.

     
  • Barton Willis

    Barton Willis - 2008-06-23

    Logged In: YES
    user_id=895922
    Originator: NO

    There are other problems with the ordering of *opers-list:

    (%i1) declare(f, multiplicative, f, additive)$

    Not OK:

    (%i2) f(a*b+c);
    (%o2) f(c)+f(a*b)
    (%i3) expand(%,0,0);
    (%o3) f(c)+f(a)*f(b)

    Change the order of *opers-list --- no more bug:

    (%i4) :lisp(setq *opers-list (reverse *opers-list));

    (%i4) f(a*b+c);
    (%o4) f(c)+f(a)*f(b)

     
  • Barton Willis

    Barton Willis - 2008-07-15

    Logged In: YES
    user_id=895922
    Originator: NO

    fixed by contrib/multiadditive CVS version 1.8. As noted below, there are other
    problems with the ordering of *opers-list.

     
  • Dieter Kaiser

    Dieter Kaiser - 2010-05-15
    • status: open --> closed
     
  • Dieter Kaiser

    Dieter Kaiser - 2010-05-15

    The reported problems of this bug report are no longer present:

    (%i2) load(multiadditive)$
    (%i3) declare(myabs,idempotent,myabs,multiplicative)$

    (%i4) myabs(xp*myabs(z));
    (%o4) myabs(xp)*myabs(z)

    And:

    (%i5) declare(f, multiplicative, f, additive)$

    (%i6) f(a*b+c);
    (%o6) f(c)+f(a)*f(b)

    This has been fixed in asum.lisp revision 1.37.
    Closing this bug report as fixed.
    Dieter Kaiser

     

Log in to post a comment.