#1925 gradef(s) together with vect package


I was surprised with the following behavior:

Maxima 5.20.1 http://maxima.sourceforge.net
using Lisp SBCL 1.0.30
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) gradef(S(x,n,i), C(x,n,i), 0, 0);
(%o1) S(x, n, i)
(%i2) gradefs;
(%o2) [S(x, n, i)]
(%i3) load(vect);
(%o3) /usr/share/maxima/5.20.1/share/vector/vect.mac
(%i4) gradefs;
(%o4) grad efs
(%i5) diff(S(x,n,i), x);
(%o5) C(x, n, i)
(%i6) gradef(C(x,n,i), s(x,n,i), 0, 0);
(%o6) grad ef(C(x, n, i), s(x, n, i), 0, 0)
(%i7) diff(S(x,n,i), x);
(%o7) C(x, n, i)
(%i8) diff(C(x,n,i), x);
(%o8) -- (C(x, n, i))

In other words, after loading 'vect.mac', where the GRAD operator is defined, Maxima starts to intepret GRADEF as GRAD(EF) [and GRADEFS similarly]. I had to edit 'vect.mac' and change all apearances of GRAD to GRAD2 (e.g.) to preserve the original behavior of GRADEF. Is this intended behavior?


  • Dieter Kaiser

    Dieter Kaiser - 2010-05-09

    I think this bug is a general weakness of the parser. We get the problem for both the grad and div operator which is defined in vect.mac:

    (%i2) load(vect)$

    (%i3) gradef(f);
    (%o3) grad ef(f)

    (%i4) divison(f);
    (%o4) div ison(f)

    (%i5) divisor(f);
    (%o5) div isor(f)

    None of the Maxima commands which start with grad or div will work after loading vect.mac. We have no Maxima commands which start with curl. Furthermore, it is very easy for the user to run into this problem when definining literal operators.

    I think we need the possibility to tell the parser to recognize an operator only as a complete word (that is a space char must follow the name of the operator).

    A workaround is to define literal operators with a capital letter, e.g. Grad and not grad. All built in Maxima functions follows the convention to start with a small letter.

    Dieter Kaiser

  • Dieter Kaiser

    Dieter Kaiser - 2010-09-24

    Fixed in nparse.lisp revision 1.60
    Closing this bug report as fixed.
    Dieter Kaiser

  • Dieter Kaiser

    Dieter Kaiser - 2010-09-24
    • status: open --> closed

Log in to post a comment.