axiom-developer
[Top][All Lists]

## [Axiom-developer] RE: [#8 (Savannah bug #9297) output misses some parent

 From: Bill Page Subject: [Axiom-developer] RE: [#8 (Savannah bug #9297) output misses some parenthesis] Why? Date: Fri, 21 Jan 2005 10:20:55 -0500

Martin,

I am taking this discussion back over to axiom-developer
to avoid extending the issuetracker page for now.

On Friday, January 21, 2005 5:38 AM you wrote:
>
> did you read my latest comment rearding this bug?
>

Yes.

> I really don't understand why you think that it could be
> improved. (OK, certainly it can be improved, but only with
> *a lot* of work, including possibly a rewrite of the way
> OUTFORM works.

Why is it that the LaTeX output for this example:
\begin{axiom}
product(summation(i*j, i=a..b),j=c..d)
\end{axiom}

gets the parenthesis right but the text output version does
not?

>
> Currently, OUTFORM is coded in a decentral fashion: every
> object "knows" how to display itself, by setting the property
> '%specialDisp'::
>
>     setProperty(opdsum,  SPECIALDISP,  ddsum@(List F -> O)
> pretend None)
>     setProperty(opdprod, SPECIALDISP, ddprod@(List F -> O)
> pretend None)
>
> Only some common operations, such as '+' are coded in OUTFORM
> itself. However, the routine displaying '+' does not know
> anything about the semantics of its arguments anymore, since
> they are already in OUTFORM then. So, you could only
> introduce an ugly *hack*, parsing the first argument of
> '+\$OUTFORM' and looking wether it is a sum or a product or a > limit or ... Well, any time a new operator is introduced, > '+\$OUTFORM' (and of course, also '-\$OUTFORM', '*\$OUTFORM',
> ...)  would have to be readjusted.
>

In order to properly decide when parenthesis are required, it
is necessary for Axiom to know something about the conventions
for precedence of known operations. This is determined in

Surely COMBF.spad can be written to use operator precedence
information to determin when paren() is required?

> Currently the design is very clean, hacking this would be a
> nightmare, and on top of all, what for?
>

For what? That seems like a strange question to me.

> Please provide an example where you dislike the result using
> the patched version! I find
>
> $$> \left( > \sum \sb{\displaystyle {i=1}} \sp{\displaystyle n} {{f > \left( > {i} > \right)}+1} > \right) > \leqno(4) >$$
>
> perfectly alright.
>

No, it looks silly to me. But I agree this is at least in part
subjective. The point is that everytime we have a problem like
this, it is the wrong approach to solve it in a one-off fashion
that detracts from Axiom's apparent "intellegence" about
mathematical conventions.

But you are right to ask for more examples. I will work this
a little more and perhaps add some examples on MathAction.

Regards,
Bill Page.