While we're on the plot window...



My overview of an implementation is this:

Maxima computes a result.  a/b.  Internally this is

((mtimes simp) $a ((mexpt simp) $b -1)).  Let's abbreviate this
to  
 (* a (^ b -1))

The formatting program changes this to 
 (quotient a b) and the display program  (DISPLA) prints it
as
 A
---
 B

I do not know much about Texmacs, but perhaps one could work at
this...
after running through format, and then through mactex, we get
something like
 {a \over b}    or maybe \frac...  [I don't really care]

The new version would be 
(\tag 1 {\tag 2 {\frac  {\tag 3 a} {\tag 4 b}}}}

where internal to maxima we have a hash table that has, for every
expression sent to the front end, an index into the formatted (not
the internal) form.  That is, hashing
(1 2 3) or maybe just 3
  would be a pointer to the location of the "a" in expression
1.
(1 2) or just 2 would be the whole fraction.

calling the simplifier on the formatted form produces a simplified
internal form.  It is not the same tree as we started with, but should
be pretty close.

Anyway, selecting terms 20 to 24 of a 100 term polynomials would
(I guess) require communicating 2 or more index sets to the back end,
where the pieces would be assembled.  

On the Texmacs side, you would have to strip off the tags and save
the index numbers, and support pointing/selection.  This is now
supported by commercial macsyma and mathematica, as well as the
very nice interactive systems http://www.livemath.com/
by Allan Bonadio.
 ( In fact, a nice solution to the user interface
but not free) would be to take Bonadio's
system and attach Maxima to it. You should in any case
take a long look at Bonadio's design!)

RJF





Joris van der Hoeven wrote:
> 
> On Thu, 17 May 2001, William Schelter wrote:
> 
> >
> >
> >    The idea would be that Maxima sends "labeled output" to TeXmacs:
> >    each subexpression which you might want to select is given a label.
> >    TeXmacs may send this label back when the expression is selected,
> >
> > The problem I see with labeling input is one has no idea what the user
> > might select.  He selects a form on the texmacs side with the mouse.
> > It might be terms 20-24 of a polynomial 100 terms long.  Or that might
> > be in the numerator or exponent or matrix entry.  As you parse it into
> > the internal TexMacs tree formula, you could just record as you start
> > a tree what character index you were at in the input string -- or else
> > perhaps better have a subsequent parse pass compute the range in case
> > the user moused some box ...  In this latter method there is no extra
> > storage associated either on the maxima or texmacs side, just a cost
> > of running thru the display code a second time.
> >
> > I once constructed something like texmacs where I did the display myself,
> > and this is what I did.
> 
> Once again, the problem is that there is not just one parsing algorithm
> involved : you have at least three parsing algorithms followed by several
> tree rewriting passes in order to upgrade to the current TeXmacs version.
> It would be very difficult in this stage to associate string locations to
> each cursor position.
> 
> On the other hand, what you say is not necessarily a problem and
> we may inspire ourselves by the way XML handles portions of a document.
> In order to specify an entry of a matrix, we might use
> something like [Label matrix]/[x,y-position], for a range of terms
> [Label polynomial]/[start position]-[end position].
> 
> Joris
> 
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima