Martin, I am far from an expert but I am beginning to understand this code a little better.
Please try the attached patch and let me know if it produces the results you expect. Note: You really only need chunk @@ -1073,7 +1107,11 @@ in 'i-output.boot' but the rest of the patch which concerns the output for tensor product should not cause any trouble. With this patch I get: (1) -> guess([factorial i for i in 0..10]) n - 1 ++-++ (1) [ | | (p + 1)] | | 11 p = 0 11 Type: List(Expression(Integer)) I have not tried to look at the TEX output yet. Regards, Bill Page. On Mon, Oct 26, 2009 at 2:35 AM, Martin Rubey wrote: > > since you are an expert of i-output now, could you have a look at > > http://axiom-wiki.newsynthesis.org/8SavannahBug9297OutputMissesSomeParenthesis > > I admit, I do not know the current state of affairs, except that the > output of > > (6) -> guess([factorial i for i in 0..10]) > > n - 1 > ++-++ > (6) [ | | p + 1] > | | 11 > p = 0 > 11 > > is incorrect in both TeX and algebra. > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To post to this group, send email to fricas-devel@googlegroups.com To unsubscribe from this group, send email to fricas-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/fricas-devel?hl=en -~----------~----~----~----~------~----~------~--~---
Index: property.lisp =================================================================== --- property.lisp (revision 704) +++ property.lisp (working copy) @@ -51,10 +51,9 @@ (REPEAT (IN X '( (LET " := ") - (= "=") (|/| "/") - (+ "+") (* "*") + (TENSOR " # ") (** "**") (^ "^") (|:| ":") @@ -78,12 +77,15 @@ (JOIN " JOIN ") (EQUATNUM " ") (IQUOTIENT "//") - (= "= ") +;; (= "=") +;; (= "= ") + (= " = ") (|>=| " >= ") (|>| " > ") (|<=| " <= ") (|<| " < ") (\| " \| ") +;; (+ "+") (+ " + ") (- " - ") (WHERE " WHERE ") @@ -101,7 +103,6 @@ )) (MAKEPROP (CAR X) 'PREFIXOP (CADR X))) (REPEAT (IN X '( - (+ WIDTH |sumWidth|) (- APP |appneg|) (- WIDTH |minusWidth|) (/ APP |appfrac|) @@ -194,8 +195,11 @@ (REPEAT (IN X '( (+ APP |plusApp|) + (+ WIDTH |sumWidth|) (* APP |timesApp|) (* WIDTH |timesWidth|) + (TENSOR APP |tensorApp|) + (TENSOR WIDTH |tensorWidth|) (** APP |exptApp|) (** WIDTH |exptWidth|) (** SUBSPAN |exptSub|) @@ -281,7 +285,7 @@ (|NegativeInteger| . (|<| * 0)) )) -(FLAG '(* + AND OR PROGN) 'NARY) +(FLAG '(TENSOR * + AND OR PROGN) 'NARY) (REPEAT (IN X '( (|Record| |mkRecordFunList|) Index: i-output.boot =================================================================== --- i-output.boot (revision 704) +++ i-output.boot (working copy) @@ -494,6 +494,40 @@ argl => [superSub,:argl] superSub +tensorApp(u,x,y,d) == + rightPrec:= getOpBindingPower("*","Led","right") + firstTime:= true + for arg in rest u repeat + op:= keyp arg + if not firstTime then + opString:= GETL('TENSOR,"INFIXOP") or '"#" + d:= APP(opString,x,y,d) + x:= x + #opString + [d,x]:= appInfixArg(arg,x,y,d,rightPrec,"left",nil) --app in a right arg + wasSimple:= atom arg and not NUMBERP arg or isRationalNumber arg + wasQuotient:= isQuotient op + wasNumber:= NUMBERP arg + lastOp := op + firstTime:= nil + d + +tensorWidth u == + rightPrec:= getOpBindingPower("*","Led","right") + firstTime:= true + w:= 0 + for arg in rest u repeat + op:= keyp arg + if not firstTime then + opString:= GETL('TENSOR,"INFIXOP") or '"#" + w:= w + #opString + if infixArgNeedsParens(arg, rightPrec, "left") then w:= w+2 + w:= w+WIDTH arg + wasSimple:= atom arg and not NUMBERP arg --or isRationalNumber arg + wasQuotient:= isQuotient op + wasNumber:= NUMBERP arg + firstTime:= nil + w + timesApp(u,x,y,d) == rightPrec:= getOpBindingPower("*","Led","right") firstTime:= true @@ -1073,7 +1107,11 @@ 3 maxWidth := MAX(opWidth,botWidth,topWidth) xCenter := (maxWidth-1)/ 2 + x - d:=APP(arg,x+2+maxWidth,y,d) + + --d:=APP(arg,x+2+maxWidth,y,d) + prec := 1002 -- binding power of ELT + [d,x1]:=appInfixArg(arg,x+maxWidth,y,d, prec,"left",nil) + d:= atom bot and SIZE atom2String bot = 1 => APP(bot,xCenter,y-2,d) APP(bot,x + (maxWidth - botWidth)/2,y-2-superspan bot,d)