axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Martin Rubey
Subject: [Axiom-developer] RE: [#8 (Savannah bug #9297) output misses some parenthesis] Why?
Date: Sun, 23 Jan 2005 15:06:41 +0100

Bill Page writes:
 > Martin,
 > 
 > I am taking this discussion back over to axiom-developer to avoid extending
 > the issuetracker page for now.

Hm. I wouldn't do that, but it's ok for me. I think the discussion belongs to
issuetracker. axiom-developer gets a copy anyway. Never mind.

 > > 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?


Ok, I looked at it more closely. Consider the two example-pairs:

-------------------------------------------------------------------------------
(9) -> product(summation(i*j, i=a..b),j=c..d)::OUTFORM::SEX

   (9)  (** (SIGMA2 (= i a) b (** i 2)) (+ d (+ (- c) 1)))
                                                            Type: SExpression
(10) -> summation(i^2^(d-c+1),i=a..b)::OUTFORM::SEX

   (10)  (SIGMA2 (= i a) b (** i (** 2 (+ d (+ (- c) 1)))))
                                                            Type: SExpression
-------------------------------------------------------------------------------

and

-------------------------------------------------------------------------------
 (11) -> sum(operator(f)(i)+1,i=1..n)::OUTFORM::SEX

   (11)  (SIGMA2 (= i 1) n (+ (f i) 1))
                                                            Type: SExpression

(12) -> (sum(operator(f)(i),i=1..n)+1)::OUTFORM::SEX

   (12)  (+ (SIGMA2 (= i 1) n (f i)) 1)
                                                            Type: SExpression
-------------------------------------------------------------------------------

So in both cases, the OUTFORM internally is different. The domain Tex works on
OUTFORM, and in the case of exponentiation "^" it seems to work well, in the
case of "+" this is not the case. I don't understand the algorithm.

I don't really understand how the interpreter converts OUTFORM to something
which is displayed on the screen. Very probably, this is done in
src/interp/i-output.boot, however, I find the code very difficult to read.

So I have to agree that OUTFORM is not simply broken. However, I still think
that my patch is better than none. I would never release Axiom without fixing
this somehow. 

There is another issue. What would you like as output? It seems to me, that the
only exceptional case is, if nothing appears to the right of sum or
product. Only in this case, parenthesis might be unnecessary. On the other
hand, how would you intuitively interpret an output like

   n
  --+
  >     f(i) + 1 ?
  --+
 i= 1

Is it (\sum_{i=1}^n f(i) ) + 1 or \sum_{i=1}^n (f(i) + 1) ?

Could we agree on adopting the quick fix for the first public release, but
leaving the issue open?

It's important to me, since my guessing program will very often produce this
ambigouus output.

Thanks,

Martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]