OK, here is an even smaller example which triggers the bug:
invert_by_lu (matrix ([v [0]]));
The error is caused by a name collision: there is a special
variable LB in src/grind.lisp (left bracket for arrays)
and apparently the symbol LB in share/linearalgebra/lu.lisp
refers to that same variable and clobbers it.
Renaming LB in lu.lisp to FOO-LB avoids the error.
I would have expected LB in lu.lisp to be a lexical variable; why not?
best, Robert Dodier
On 1/10/12, andre maute <andre.maute at gmx.de> wrote:
> On 01/10/2012 07:56 AM, Robert Dodier wrote:
>> On 1/8/12, andre maute<andre.maute at gmx.de> wrote:
>>
>>> M:matrix([1,0,0],[v[[1,0],[0,0]],1,0],[v[[0,1],[0,0]],v[[0,1],[1,0]],1])
>>> (%i7) Minvinv:invert_by_lu(invert_by_lu(M))
>>> Maxima encountered a Lisp error:
>>>
>>> The value NIL is not of type CHARACTER.
>> > From what I can tell, the error is not in invert_by_lu
>> but somewhere downstream from GENSYM-READABLE,
>> which calls AFORMAT and eventually OUTPUT-TEXT*,
>> where it barfs. Unfortunately I can't tell what's going on
>> in the source code (src/mformt.lisp); too much macrology
>> for my tiny brain to comprehend. Oh well.
>>
>> I find that
>> :lisp (defun gensym-readable (x) (gensym))
>> makes the error go away. Does that work for you?
>
> Yes, thanks for the workaround.
> Here two slightly smaller test cases, which give the error too.
> ---------------------------------
> display2d : false;
> Minv : matrix([1,0,0],[-v[[1,0],[0,0]],1,0],
> [v[[0,1],[1,0]]*v[[1,0],[0,0]]-v[[0,1],[0,0]],-v[[0,1],[1,0]],1]);
> invert_by_lu(Minv);
> ---------------------------------
> display2d : false;
> Minv : matrix([1,0,0],[-v[1,0,0,0],1,0],
> [v[0,1,1,0]*v[1,0,0,0]-v[0,1,0,0],-v[0,1,1,0],1]);
> invert_by_lu(Minv);
> ---------------------------------
>
> whereas the following works
> ---------------------------------
> display2d : false;
> Minv : matrix([1,0,0],[-v_1_0_0_0,1,0],
> [v_0_1_1_0*v_1_0_0_0-v_0_1_0_0,-v_0_1_1_0,1]);
> invert_by_lu(Minv);
> ---------------------------------
>
> Regards
> Andre
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>