Re: problems in cvs maxima



Valery Pipin <pip@iszf.irk.ru> writes:

> I've just checked whether the issues written in my previous message

[ defint(cos(t)^2*sin(t)/sqrt(a^2*sin(t)^2+1),t,0,%pi); returns the
noun form for CVS Maxima ]

> persist under stable version of maxima-5.9.0.  The issue with
> integral persists for clisp and cmucl.

This seems to be a fine specimen of the UNSPECIAL declarations bug.

Here is what I think happens.

Eventually, the integrand is passed to TRIGINT, which tries to match
it with various patterns, in particular

(M2
 '((MTIMES SIMP) ((MEXPT SIMP) COS* 2) SIN*
   ((MEXPT SIMP)
    ((MPLUS SIMP) 1 ((MTIMES SIMP) ((MEXPT SIMP) $A 2) ((MEXPT SIMP) SIN* 2)))
    ((RAT SIMP) -1 2)))
 '((COEFFPT) (C RAT1) ((MEXPT) SIN* (N ODD1))) 'NIL)

That is, it attempts to match an odd power of SIN* times some term
which matches a pattern computed by RAT1.  This match should succeed
and return

((C (MTIMES SIMP) ((MEXPT SIMP) COS* 2)
  ((MEXPT SIMP)
   ((MPLUS SIMP) 1 ((MTIMES SIMP) ((MEXPT SIMP) $A 2) ((MEXPT SIMP) SIN* 2)))
   ((RAT SIMP) -1 2)))
 (N . 1))

In order to compute the pattern, RAT1 needs some information from
TRIGINT (both of these functions are in sin.lisp), which is passed as
value of the global variable B.

RAT1 is called by TESTA* (via (APPLY (CADR ALA)...) if you look at the
definition in schatc.lisp), which is called by TESTA, which binds B.

Now, schatc.lisp is loaded after sin.lisp and somewhere in between
(in risch.lisp) B is declared UNSPECIAL.

So, in GCL TESTA binds B lexically, while in other implementations the
UNSPECIAL declaration does nothing, and thus TESTA shadows B's global
binding and RAT1 retrieves the wrong value.

This said, I am somewhat puzzled by the fact that the integral works
at telnet://maxima.franz.com.  It is true that DECLARE-TOP has some
#+excl code but I thought it was meant for the old Franz.  Does it
really work with the ACL file compiler?

I think the lazy fix of renaming the B in schatc.lisp doesn't hurt.
On the other hand, The Right Thing, I guess, is to get rid of the
UNSPECIAL declarations (by renaming special variables if necessary).

Wolfgang