TeX output under derivabbrev : true



Dear Wolfgang,

I am extremely thankful to you for your precious help with respect
to the TeX output for derivatives under derivabbrev : true$

I do not know LISP, but I have been able to attach your code at
the end of the mactex.lisp file. Then I received the TeX output for 
the derivatives exactly as I would like it to be both for symbols 
((C6) below) and for functions (u(x,r,s,t) in (C7) below).

(C1) pde : 'diff(u,x,2)+'diff(u,y,2) = 0$
(C2) tex(pde)$
$${{d^2}\over{d\,y^2}}\,u+{{d^2}\over{d\,x^2}}\,u=0$$
(C3) derivabbrev : true$
(C4) tex(pde)$
$${{d^2}\over{d\,y^2}}\,u+{{d^2}\over{d\,x^2}}\,u=0$$
(C5) load(mactex)$
(C6) tex(pde)$
$$u_{y\,y}+u_{x\,x}=0$$
(C7) tex(diff(u(x,r,s,t),x,4))$
$$\left(u\left(x,r,s,t\right)\right)_{x\,x\,x\,x}$$
(C12) tex('diff(u[0],x,2));
$$\left(u_{0}\right)_{x\,x}$$

I will also study in more detail Barton Willis' so useful pdiff 
package I am already frequently using, but not for TeX output.

Now my present sole question is why I have to explicitly load the
mactex.lisp package, load(mactex)$ in (C5) above. This was not 
necessary before this change I proceeded. Do you know why,
please? (Surely, this is a very naive question!)

To be sincere, I am now writing few examples on the derivabbrev
option variable for my notes distributed to some of my students 
and, naturally, I expect the TeX output for derivatives to be
different when derivabbrev option variable is false or true.
Otherwise, this variable cannot be described in TeX documents.

Naturally, your code may be of interest to several other users of
Maxima too including the authors of "The Maxima Book" when 
they will describe the derivabbrev option variable in their book .

Do you feel that you could incorporate this addition (TeX output 
implementation of the derivabbrev variable) into the mactex.lisp
Maxima file in the CVS so that it could be already there for
Maxima 5.9.1? Even if you believe that your code below is simple, 
it is surely preferable that it be present in mactex.lisp than absent.

Please accept again my sincere thanks for your prompt reply and 
so kind help. Naturally, otherwise, essentially I could not proceed 
with the description and use of the derivabbrev option variable,
which is quite frequently useful especially in differential equations.

With my kindest regards from Patras,

Nikos

"Wolfgang Jenkner" <wjenkner@inode.at> wrote:

>>> I think it's not implemented.  

> > Thinking about it...
> 
> This version here should be more robust.  Please note, however, that
> my approach is quite simple-minded (I just adapted a few lines from
> mactex.lisp).
> 
> If you need more sophisticated things I suggest you take a look at
> Barton Willis's pdiff package (in share/contrib), which also contains
> examples of getting TeX output in various notations.
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> (in-package "MAXIMA")
> 
> (defun tex-derivative (x l r)
>   (tex (if $derivabbrev
>    (tex-dabbrev x)
>    (tex-d x '$|d|)) l r lop rop ))
> 
> (defun tex-dabbrev (x)
>   ;; Format diff(f,x,1,y,1) so that it looks like
>   ;; f
>   ;;  x y
>   (let*
>       ((arg (cadr x)) ;; the function being differentiated
>        (difflist (cddr x)) ;; list of derivs e.g. (x 1 y 2)
>        (ords (odds difflist 0)) ;; e.g. (1 2)
>        (vars (odds difflist 1))) ;; e.g. (x y)
>     (append
>      (if (symbolp arg)
> `((,arg array))
> `((mqapply array) ,arg))
>      (if (and (= (length vars) 1)
>       (= (car ords) 1))
> vars
> `(((mtimes) ,@(mapcan #'(lambda (var ord)
>    (make-list ord :initial-element var))
>        vars ords)))))))
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Wolfgang