Franz,

> On Fri, Oct 23, 2009 at 12:10:51AM -0400, Bill Page wrote:
>> I am sorry that this took me a little longer than I had hoped. As
>> usual some other activities interfered with my time available for
>> FriCAS programming... :-(

On Fri, Oct 23, 2009 at 5:28 AM,  you wrote:
> thank you very much, this would have taken me a lot of time to
> figure out.

No problem. I don't know who's "bright idea" it was to try and collect
all properties into a single file and not leave any hints behind in
the original source code but I think it was a mistake. It makes it
especially hard to understand the code in 'i-output.boot' at first
glance.

> It did not work rightaway due to a few typos (?)
>

Yes, sorry. You can tell I was in a hurry and a little too tired.

>> @@ -53,8 +53,9 @@
>> -   (+ " + ")
>> +   (+ " ++ ")
> this one is a typo I guess?
>

Yes, it was a left-over from an earlier test that I forgot to cleanup.

>> +      opString:= GETL("TENSOR","INFIXOP") or '"(*)"
> I don't understand this one.

The point was to allow a choice of symbol by a simple change to the
'property.lisp'. This is used elsewhere in 'i-output.boot' but not
consistently.

> Using this, I get output like
>  a2(*) + a2(*) + a1(*) + a1(*)b1
>
>  instead of
>  a2(*)b2 + a2(*)b1 + a1(*)b2 + a1(*)b1
>

Sorry. As you can tell I really didn't have enough time to do more
than a simple test.

> However changing this and the following line to
>      opString:= '"#"
>      d:= APP(opString,x,y,d)
>      x:= x+1
>
> and also
>   (TENSOR "#")
> in the other file instead of   (TENSOR "(*)")
> it works as expected.

Great.

> I could not get "(*)" to work along these lines.

Another thing I forgot I think.  If the symbol is more than a single
character a few more changes are required. E.g.

  (TENSOR WIDTH |tensorWidth|)
  (TENSOR SUBSPAN |tensorSub|)
  (TENSOR SUPERSPAN |tensorSuper|)

> Anyways it takes too much space and sage people also decided
> to use "#".

I really dislike the use of the symbol '#' for this purpose. For one
thing, # is a very common prefix operator that usually denotes the
"size" or "length" of something in FriCAS/Axiom. Second # just doesn't
seem to me "tensor" to me. Third, I do not think that what the Sage
people are doing constitutes a particularly good model for FriCAS
(except perhaps in terms of the functionality). I think FriCAS should
focus on greater rigor and consistency.

In ASCII output I would much rather live with a symbol that takes more
space but sort of looks like \otimes

> (i-output.boot can be read in "live" without compilation,
> this saves a lot of time).
>

What command do you use to compile "live" boot code? I use something
like this on the axiom-wiki but I do not believe that it is optimal.
Did you also try

  )lisp (compile-file "property.lisp")

to make "live" changes to the properties? It seems to me that that did
not work for me and I was not sure why.

I have attached a complete patch file that adds the tensor package to
the FriCAS build system. One needs to apply this patch plus add the
file 'tensor.spad.pamhlet' to the 'algebra' subdirectory.  (Renamed
from 'tensor.spad.nw'. Note: I also would prefer to use the '.nw'
extension instead of '.pamphlet' - maybe we can petition Waldek and
other FriCAS developers to adopt this change?)

Regards,
Bill Page.

--~--~---------~--~----~------------~-------~--~----~
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: src/algebra/boo-cat.input
===================================================================
--- src/algebra/boo-cat.input	(revision 704)
+++ src/algebra/boo-cat.input	(working copy)
@@ -207,6 +207,9 @@
 )compile "SPACEC.spad"
 )compile "SRAGG.spad"
 )compile "STRICAT.spad"
+)compile "TENSCAT.spad"
+)compile "TENSPC.spad"
+)compile "TENSPRP.spad"
 )compile "UPSCAT.spad"
 )compile "ULSCAT.spad"
 )compile "ULSCCAT.spad"
Index: src/algebra/boo-pack2.input
===================================================================
--- src/algebra/boo-pack2.input	(revision 704)
+++ src/algebra/boo-pack2.input	(working copy)
@@ -207,6 +207,7 @@
 )compile "TANEXP.spad"
 )compile "TBCMPPK.spad"
 )compile "TEMUTL.spad"
+)compile "TENSPO2.spad"
 )compile "TEX1.spad"
 )compile "TOOLSIGN.spad"
 )compile "TOPSP.spad"
Index: src/algebra/outform.spad.pamphlet
===================================================================
--- src/algebra/outform.spad.pamphlet	(revision 704)
+++ src/algebra/outform.spad.pamphlet	(working copy)
@@ -325,6 +325,8 @@
           ++ "f super \spad{iv}".
         binomial: (%, %) -> %
           ++ binomial(n,m) creates a form for the binomial coefficient of n and m.
+        tensor:  (%, %) -> %
+          ++ tensor(a,b) creates a form for a tensor b
 
         --% Scripts
         sub:     (%, %) -> %
@@ -655,6 +657,7 @@
         int(a)     == convert [eform INTSIGN,empty(), empty(), a]
         int(a,b)   == convert [eform INTSIGN,b, empty(), a]
         int(a,b,c) == convert [eform INTSIGN,b, c, a]
+        tensor(a,b) == convert [eform TENSOR,a,b]
 
 @
 
Index: src/algebra/tex.spad.pamphlet
===================================================================
--- src/algebra/tex.spad.pamphlet	(revision 704)
+++ src/algebra/tex.spad.pamphlet	(working copy)
@@ -156,9 +156,9 @@
     binaryPrecs   : L I := [0,0,900, 700,400,400,400,   700]$(L I)
 
     naryOps       : L S := ["-","+","*",blank,",",";"," ","ROW","",
-       " \cr ","&"," \\ "]$(L S)
+       " \cr ","&"," \\ ","TENSOR"]$(L S)
     naryPrecs     : L I := [700,700,800,  800,110,110,  0,    0, 0,
-             0,  0,   0]$(L I)
+             0,  0,   0,850]$(L I)
     naryNGOps     : L S := ["ROW","&"]$(L S)
 
 <<product(product(i*j,i=a..b),j=c..d) fix>>
@@ -558,6 +558,7 @@
         op = "*"     => blank
         op = " "     => " \ "
         op = "ROW"   => " & "
+        op = "TENSOR" => " \otimes "
         op
       l : L S := nil
       opPrec := naryPrecs.p
Index: src/algebra/boo-dom2.input
===================================================================
--- src/algebra/boo-dom2.input	(revision 704)
+++ src/algebra/boo-dom2.input	(working copy)
@@ -15,6 +15,8 @@
 )compile "SYMTAB.spad"
 )compile "TABLE.spad"
 )compile "TABLEAU.spad"
+)compile "TENSOR.spad"
+)compile "TENSPOW.spad"
 )compile "TEX.spad"
 )compile "TEXTFILE.spad"
 )compile "TREE.spad"
Index: src/algebra/exposed.lsp.pamphlet
===================================================================
--- src/algebra/exposed.lsp.pamphlet	(revision 704)
+++ src/algebra/exposed.lsp.pamphlet	(working copy)
@@ -814,7 +814,7 @@
   (|NonLinearSolvePackage| . NLINSOL)
   (|NormRetractPackage| . NORMRETR)
   (|NPCoef| . NPCOEF)
-  (|NumberFormats| . NUMFMT)
+;;  (|NumberFormats| . NUMFMT)
   (|NumberFieldIntegralBasis| . NFINTBAS)
   (|NumericTubePlot| . NUMTUBE)
   (|ODEIntegration| . ODEINT)
Index: src/algebra/Makefile.in
===================================================================
--- src/algebra/Makefile.in	(revision 704)
+++ src/algebra/Makefile.in	(working copy)
@@ -63,7 +63,7 @@
      ssolve stream string sttaylor sttf \
      sturm suchthat suls sum sups supxs \
      suts symbol syssolp system tableau table \
-     taylor tex transsolve tree trigcat \
+     taylor tensor tex transsolve tree trigcat \
      triset tube twofact u32vec unifact updecomp updivp \
      utsode variable vector view2D view3D viewDef \
      vecrec viewpack void weier wtpol xlpoly xpoly \
@@ -263,7 +263,9 @@
      SUMFS SUMRF SUP2 SUPFRACF SUP SUPXS \
      SUTS SWITCH SYMBOL SYMFUNC SYMPOLY SYMS \
      SYMTAB SYSSOLP TABLBUMP TABLEAU TABLE TANEXP \
-     TBAGG TBCMPPK TEMUTL TEX1 TEX TEXTFILE \
+     TBAGG TBCMPPK TEMUTL \
+     TENSCAT TENSOR TENSPC TENSPOW TENSPO2 TENSPRP \
+     TEX1 TEX TEXTFILE \
      TOOLSIGN TOPSP TRANFUN TREE TRIGCAT TRIGMNIP \
      TRIMAT TRMANIP TSETCAT TS TUBE TUBETOOL \
      TUPLE TWOFACT TYPE U32VEC UDPO UDVO UFD \
@@ -305,7 +307,8 @@
         PPCURVE PSCURVE VECTCAT PTCAT QFCAT QUATCAT RCFIELD RMATCAT \
         RPOLCAT RRCC SEGCAT SEGXCAT SEXCAT SFRTCAT SMATCAT SNTSCAT \
         SPACEC SRAGG STRICAT UPSCAT ULSCAT ULSCCAT UPOLYC UPXSCAT \
-        UPXSCCA UTSCAT XALG XFALG XPOLYC
+        UPXSCCA UTSCAT XALG XFALG XPOLYC \
+        TENSCAT TENSPRP TENSPC
 
 SPADLIST=${SPADLIST1} ${SPADLIST2} ${SPADLIST3} ${SPADLIST4} \
         ${SPADLIST5} ${SPADLIST6} ${SPADLIST7} ${SPADLIST8}
@@ -329,7 +332,8 @@
         RCAGG RCFIELD RETRACT RING RMATCAT RNS RPOLCAT RRCC RSETCAT \
         SETAGG SETCAT SGROUP SMATCAT SRAGG STAGG TBAGG TRANFUN \
         TRIGCAT TSETCAT UFD ULSCCAT UPOLYC UPSCAT UPXSCCA URAGG \
-        UTSCAT VECTCAT VSPACE XF
+        UTSCAT VECTCAT VSPACE XF \
+        TENSPC
 
 EXTRASPADS=BPADIC BPADICRT COMMONOP GALUTIL MKFLCFN PADIC PADICRAT \
        SET WFFINTBS XPBWPOLY
Index: src/algebra/poly.spad.pamphlet
===================================================================
--- src/algebra/poly.spad.pamphlet	(revision 704)
+++ src/algebra/poly.spad.pamphlet	(working copy)
@@ -236,15 +236,16 @@
     TERM1 ==> Record(k:S, c:R)
 
     public ==> with
-        mapLinear:(S->M2,M1)->M2
-        ++ \spad{mapLinear:(f,x)} returns the linear extension
+        linearExtend:(S->M2,M1)->M2
+        ++ \spad{linearExtend:(f,x)} returns the linear extension
         ++ of a map defined on the basis of M2 applied to a linear combination
 
     private ==> add
         f:S->M2
         x:M1
         t:TERM1
-        mapLinear(f,x) ==
+        linearExtend(f,x) ==
+            zero? x => 0
             res:M2:= 0
             for t in listOfTerms x repeat
                 res := res + (t c)*f(t k)
Index: src/interp/property.lisp
===================================================================
--- src/interp/property.lisp	(revision 704)
+++ src/interp/property.lisp	(working copy)
@@ -53,8 +53,9 @@
    (LET " := ")
    (= "=")
    (|/| "/")
-   (+ "+")
+;;   (+ "+")
    (* "*")
+   (TENSOR "#")
    (** "**")
    (^ "^")
    (|:| ":")
@@ -195,7 +196,9 @@
 (REPEAT (IN X '(
   (+ APP |plusApp|)
   (* APP |timesApp|)
+  (TENSOR APP |tensorApp|)
   (* WIDTH |timesWidth|)
+  (TENSOR WIDTH |timesWidth|)
   (** APP |exptApp|)
   (** WIDTH |exptWidth|)
   (** SUBSPAN |exptSub|)
@@ -281,7 +284,7 @@
   (|NegativeInteger| . (|<| * 0))
   ))
 
-(FLAG '(* + AND OR PROGN) 'NARY)
+(FLAG '(TENSOR * + AND OR PROGN) 'NARY)
 
 (REPEAT (IN X '(
   (|Record| |mkRecordFunList|)
Index: src/interp/i-output.boot
===================================================================
--- src/interp/i-output.boot	(revision 704)
+++ src/interp/i-output.boot	(working copy)
@@ -494,6 +494,25 @@
   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 and (needBlankForRoot(lastOp,op,arg) or
+       needStar(wasSimple,wasQuotient,wasNumber,arg,op) or
+        wasNumber and op = 'ROOT and subspan arg = 1) then
+      opString:= '"#"
+      d:= APP(opString,x,y,d)
+      x:= x+1
+    [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
+
 timesApp(u,x,y,d) ==
   rightPrec:= getOpBindingPower("*","Led","right")
   firstTime:= true

Reply via email to