Hi,
I didn't think I could stare at info document parsing for any longer
this evening, so I was looking at something else when I came across the
following "bug"(?).
Tracing SIMPLIFYA, SIMPNCT and SIMPTIMES, I get the following two
runs:
MAXIMA> (simplifya '((mtimes) $a ((mnctimes))) t)
0: (SIMPLIFYA ((MTIMES) $A ((MNCTIMES))) T)
1: (SIMPTIMES ((MTIMES) $A ((MNCTIMES))) 1 T)
1: SIMPTIMES returned ((MTIMES SIMP) ((MNCTIMES)) $A)
0: SIMPLIFYA returned ((MTIMES SIMP) ((MNCTIMES)) $A)
((MTIMES SIMP) ((MNCTIMES)) $A)
MAXIMA> (simplifya '((mtimes) $a ((mnctimes))) nil)
0: (SIMPLIFYA ((MTIMES) $A ((MNCTIMES))) NIL)
1: (SIMPTIMES ((MTIMES) $A ((MNCTIMES))) 1 NIL)
2: (SIMPLIFYA $A NIL)
2: SIMPLIFYA returned $A
2: (SIMPLIFYA ((MNCTIMES)) NIL)
3: (SIMPNCT ((MNCTIMES)) 1 NIL)
4: (SIMPLIFYA NIL NIL)
4: SIMPLIFYA returned NIL
4: (SIMPLIFYA NIL NIL)
4: SIMPLIFYA returned NIL
3: SIMPNCT returned 1
2: SIMPLIFYA returned 1
1: SIMPTIMES returned $A
0: SIMPLIFYA returned $A
$A
The second does what I expected. But the first confused me and I wonder
whether I've misunderstood the "flag" argument to simplifya. What I
*thought* it means when true is "Resimplify everything in the
expression, whether or not it has a SIMP flag in its CAR already". But
this clearly isn't what SIMPTIMES is doing, so maybe I've got myself
confused?
The reason I actually came across this is that I was hoping for a
"unitality" property for ncmul:
MAXIMA> (ncmul '$a '((mnctimes)))
0: (SIMPLIFYA ((MNCTIMES) $A ((MNCTIMES))) T)
1: (SIMPNCT ((MNCTIMES) $A ((MNCTIMES))) 1 T)
2: (MUL2 $A ((MNCTIMES)))
3: (SIMPLIFYA ((MTIMES) $A ((MNCTIMES))) T)
4: (SIMPTIMES ((MTIMES) $A ((MNCTIMES))) 1 T)
4: SIMPTIMES returned ((MTIMES SIMP) ((MNCTIMES)) $A)
3: SIMPLIFYA returned ((MTIMES SIMP) ((MNCTIMES)) $A)
2: MUL2 returned ((MTIMES SIMP) ((MNCTIMES)) $A)
1: SIMPNCT returned ((MTIMES SIMP) ((MNCTIMES)) $A)
0: SIMPLIFYA returned ((MTIMES SIMP) ((MNCTIMES)) $A)
((MTIMES SIMP) ((MNCTIMES)) $A)
I was expecting $A as a return value. Note that
MAXIMA> (mul '$a '((mtimes)))
0: (MUL2 $A ((MTIMES)))
1: (SIMPLIFYA ((MTIMES) $A ((MTIMES))) T)
2: (SIMPTIMES ((MTIMES) $A ((MTIMES))) 1 T)
2: SIMPTIMES returned $A
1: SIMPLIFYA returned $A
0: MUL2 returned $A
$A
does do what I expected.
Am I just misunderstanding what's supposed to happen or have I found a
bug in a corner case?
Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20130528/0f000cbf/attachment.pgp>