Lisp stack overflow



On 6/6/10 2:17 PM, Raymond Toy wrote:
> On 6/5/10 1:32 PM, Robert Dodier wrote:
>> On 6/4/10, Barton Willis <willisb at unk.edu> wrote:
>>
>>   
>>> This is a bug; here is a related example:
>>>
>>>  (%i1) dpart(sin(a+b),1);
>>>  Maxima encountered a Lisp error:
>>>     
>> Seems to be a bug of recent origin; works OK in Maxima 5.20.0,
>> not in 5.21.0.
>>
>> The problem might or might not be in dpart, I can't tell;
>> I can't get a useful stack trace out of GCL (no relevant info),
>> Clisp (crash), or Clozure CL (crash).
>>   
> FWIW, I tested this with cmucl and pressed C-c to stop it.  The back
> trace appears to indicate that the problem is in simp-%sin which calls
> apply-reflection-simp which calls odd-reflection-select which calls
> simp-%sin.  The argument to simp-%sin appears to alternate between
> 
> (SIMP-%SIN ((%SIN) ((MTIMES SIMP) -1 ((MBOX SIMP) (# $A $B))))
>                ((MTIMES SIMP) -1 ((MBOX SIMP) ((MPLUS SIMP) $A $B)))
>                MTIMES)
> 
> and
> 
> (SIMP-%SIN ((%SIN) ((MBOX SIMP) ((MPLUS SIMP) $A $B)))
>                ((MBOX SIMP) ((MPLUS SIMP) $A $B))
>                MBOX)
> 
> I guess the mbox is confusing odd-reflection-select.
> 

Ah, the problem, as hinted in the comments for apply-reflection-simp, is
that (great (neg x) x) and (great x (neg x)) both return T.  Applying
the suggested solution fixes this issue.

Perhaps Barton can weigh on this since he wrote this and knows far
better than I do about how and what this is supposed to do.

Ray