mnewton error



Am Donnerstag, den 19.08.2010, 09:06 -0500 schrieb Barton Willis:
> I think declare(h,scalar) in mnewton causes compiled mnewton to not
> run. Of course, compiling mnewton doesn't make it faster (likely most
> users are running uncompiled lu_factor). In general, undeclared
> arrays makes code more breakable, I think.
> 
> --Barton
> 
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima

The declaration declare(h,scalar) was introduced as a workaround to get
the example 

   mnewton([2*a^a-5],[a],[1]);

correct.

I have introduced the problem because of a change of the function
scalarclass in simp.lisp. In the bug report ID: 3034873 "mnewton fails
with cvs maxima" I have argued that the problem is in mnewton and not in
the changed code. 

But this was not a fully correct analysis of the problem. In the routine
scalarclass I had to introduce code to check for an subscripted
variable. This code is not as complete as it should be. This is the
code:

        ((and (member 'array (car exp))
              (not (mget (caar exp) '$scalar)))
         '$nonscalar)

And this is a better implementation:

        ((member 'array (car exp))
         (cond ((mget (caar exp) '$scalar) '$scalar)
               ((mget (caar exp) '$nonscalar) '$nonscalar)
               (t nil)))

With this correction we get:

(%i3) scalarp(x[1]);
(%o3) false

(%i4) nonscalarp(x[1]);
(%o4) false

This is the behavior the code of mnewton expects and which is the old
behavior before I have done the change. With his correction we can
revert the declaration of h to be a scalar in mnewton.mac. The testsuite
and the share_testsuite have no problems.

This problem is not related to the further problems discussed in this
thread.

Sorry, about the bother. I will commit the correction and revert the
change in "mnewton.mac". Does it make sense to commit the correction to
the branch 5.22 too.

Dieter Kaiser