Re: [Maxima] name clashes in Maxima



hi all

willisb's idea of wart is almost good.I think,

A function written with the maxima language is treated as virtual one,
or as nearly temporary one.

for example 
(C1) ghelp(f,labmda,k):=block([z],subst(labmda,z,diff(f(z),z,k)/k!))$
(C2):lisp (symbol-function '|$ghelp|);
    NIL
(C3):lisp (symbol-plist '|$ghelp|);
     (MPROPS (NIL MEXPR
             ((LAMBDA) ((MLIST) $f $labmda $k)
              ((MPROG) ((MLIST) $z)
               (($SUBSTITUTE) $labmda $z
                ((MQUOTIENT) (($DIFF) (($f) $z) $z $k)
                 ((MFACTORIAL) $k)))))))

after compile(ghelp),|$ghelp| is written at symbol-function list.
This style is the best,because we write some functions with maxima and throw
away after useing them.
on the other hand  a function written with lisp or compiled one is put to
symbol-function list.
It's thouht permanent use.

(C4) ghelp(sin,x,3);
(D4) cos(x)
   - ------
      6
but (C5) f(x):=x^3$
    (C6) ghelp(f,x,3);
(D6) 1
(C7) ghelp(sin,x,3);
(D7)1
(C7) kill(f)$

After all  ghelp caused not to use name f(x).
if f(x)and ghelp are temporary,never mind. but if not ........
At this function,f must be a global or special variable.
Nevertheless wart is available.(only change f(x)to %f(x),but
if all user know prohibition of useing %hoge.) 


ghelp2(%f,labmda,k):=block([z,k],declare(k,fixnum),subst(labmda,z,diff(%f(z),z,k)/k!))$
OK,unless %f(x)is not defined.

On lisp,this wart is available.|$%f|is work,well binds gloval variable
at toplevel environment.


(PROGN
  (DEFPROP |$ghelp2| T TRANSLATED)
  (ADD2LNC '|$ghelp2| $PROPS)
  (DEFMTRFUN (|$ghelp2| $ANY MDEFINE NIL NIL) (|$%f| |$labmda| |$k|)
      (DECLARE (SPECIAL |$k| |$labmda| |$%f| ) (FIXNUM |$k| |$labmda|))
      ((LAMBDA (|$z|)
         (DECLARE (SPECIAL |$z|))
         NIL
         (SIMPLIFY
             (MFUNCTION-CALL $SUBSTITUTE |$labmda| |$z|
                 (DIV (SIMPLIFY
                          (MFUNCTION-CALL $DIFF
                              (simplify (mfunction-call |$%f| |$z|)) |$z| |$k|))
                      (FACTORIAL |$k|)))))
       '|$z|)))

Let's define wart.
Gosei Furuya (go_furuya@infoseek.co.jp)