mnewton error



-----Robert Dodier <robert.dodier at gmail.com> wrote: -----

>I?don't?know?if?LU-FACTOR?is?generally?OK?with?rank-deficient
>matrices?or?what.

lu_factor does not factor non-rectangular, singular, or near-singular matrices. 

>>?Maybe?the?bug?is?related?to?the?(ill-advised)?way?that?the?mnewton?code
>>?uses?an?undeclared?array?h.
>
>Well,?that?doesn't?seem?to?have?anything?to?do?with?it.
>I?don't?see?what's?wrong?with?that?anyway.

The local declaration for h might be OK, but the code needs to be more careful:

 (%i1) load("mnewton.mac")$
 (%i2) mnewton(x^2-2,x, 0);
     Maxima encountered a Lisp error:
 Error in FUNCALL [or a callee]: Zero divisor.
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.

Ouch:

 (%i3) properties(h);
 (%o3) [scalar]

I suppose the cure is to place solve_by_lu inside an error catch. Finally, I guess DF needs a local 
declaration:

(%i6) DF[1] : 42$
(%i7) mnewton(x^2-2,x, 5.6);
assignment: cannot assign to (DF[i])[j]