Re: [Maxima] Infix operator definition



hi all 
hi Stravos
Your example for Maxima's handling of strings and operators
is essential to writting pattern match programs on MAXIMA.
This problem  often causes difficulties. We can not write some
special strings from interpreter or The interpreter rewrites it with it's own way. So,I make  MAXIMA to write this strings with interpreter self.
This solution is not elegant but practical,I think.

Example
(C2) sump(f):=not(atom(f)) and part(f,0)='SUM$
sump(f) should return true for expr f, sum(,,,). 
(C3) sump(sum(y^n,n,0,inf));
(D3)             FALSE
(C4) part('sum(x^n,n,0,inf),0)='SUM; //....(1)
(D4)  SUM = SUM
(C5) is(%);
(D5) FALSE
(C6) :lisp (print $d4)
((MEQUAL SIMP) %SUM $SUM) 
I cannot wtite %SUM because if I write %SUM, MAXIMA rewrite $%SUM.
or "SUM"or  '%SUM ,,,not equal %SUM at (1).
Afterall only to write %SUM
(C7) sump(f):=not(atom(f))and part(f,0)=part('sum(_x^_n,_n,0,1),0)$
not elegant but
(C8) sump(sum(x^n,n,0,inf));
(D9)       TRUE
do you think this ? 

Gosei Furuya 





> 
> I can't reproduce this.  On Maxima 5.9.0 gcl 2.5.0 mingw32 Windows2000
> Athlon, I get the correct result:
> 
> (C1) infix("x");
> (D1) 		      "X"
> (C2) part(1 x 2,0);
> (D2) 		       X
> 
> That said, I don't think it's a very good idea to define "x" as an
> operator.
> 
> There are also some inconsistencies in Maxima's handling of strings and
> operators:
> 
> (C1) infix("x");                     -- Note lower case
> (D1) 			        "X"        -- Note upper case
> (C2) is(d1="X");
> (D2) 			       FALSE       -- D1 looks just like "X" but
> isn't the same
> (C3) is(part(1 x 2,0)="X");
> (D3) 			        TRUE       -- OK
> (C4) is(part(1 x 2,0)=d1);
> (D4) 			       FALSE       -- ??
> (C5) is(part(1 x 2,0)="x");
> (D5) 			       FALSE       -- Case issue
> (C6) 
> 
>      -s




------------------------------------------------------------------------
$BBP1~(BTV$B$O;}$C$F$^$9!D(BBS$B%G%8%?%k!!8+$F$^$9$+!)(B by infoseek
http://ap.infoseek.co.jp/tv15.html