Subject: "depends" problem of variables with subscripts
From: Evan
Date: Tue, 10 Jul 2007 10:54:45 +0800
On 7/9/07, Vadim <vadim at vkonovalov.ru> wrote:
> I think this is quite often a need that such output hacks to become
> implemented, once and for all.
>
> IMO quite often it is desireable to have Maxima output to be in line
> with some mathematical paper.
>
> For example, yesterday I had a need to have greek psi with some lower
> index prefixed with italic 'd' with lower index, (partial field
> derivative) but acting as independant variable.
>
> I wrote such variables as d_0_psi_3 and read accordingly, but this is
> not convenient.
>
> It is very desireable for me to have, for example, some kind of
> declaration, so to have special TeX sequence for my given variable
>
> something like
>
> declare_output_tex(d_0_psi_3, "\partial _0 \psi^3");
I think this would be a better implementation because all manipulation
on the variable would have the same behavior as other usual variables,
the only exception is displaying
>
> also optionally following:
>
> declare_output_ascii(d_0_psi_3, "subsup d 0 psi 3");
>
> (using subsup function further defined by you)
>
> so whenever said variable occured, it will be shown appropriately in TeX
> (read: TeXmacs)
>
> This could fulfill many requests, IMHO.
>
> Is it reasonable to implement?
>
> >
> >You can define x[n,m]:= concat(subsup," " ,x," ",n," ",m); This means that
> >x[3,4] is changed to "subsup x 3 4".
> >
> >Then some display hack would be needed so that subsup x 3 4 would display
> >just like x[3]^4
> >
> >This could be done by adding a clause to nformat to check for atoms of the
> >form you have in mind..
> >
> >Here is most of what is needed
> >
> >(defun subsuper(h)
> > ;; convert an atom "$subsup x n m" into a triple, (x n m)
> > ;; other atoms result in nil
> > (setf h (symbol-name h))
> > (if (and (>(length h) 10)(string= (subseq h 0 8) "$subsup "))
> > (let ((pos 9))
> > (multiple-value-setq (name pos)
> > (read-from-string h nil nil :start pos))
> > (multiple-value-setq (sub pos)
> > (read-from-string h nil nil :start pos))
> > (multiple-value-setq (super pos)
> > (read-from-string h nil nil :start pos))
> > (list name sub super))
> > nil)) (list name sub super))
> > nil))
> >
> >There was some effort for "extensions" to nformat; I don't know if it was
> >put in, finally.
> >This could be fit in there.
> >RJf
> >
> >
> >
>
>
>