Even though invert(matrix([1])), scalarmatrixp:all simplifies to 1, this is still a bug because Maxima functions should never give Lisp errors.
Arguably, too, if scalarmatrixp is simplifying the matrix to a scalar, then invert(x) should return 1/x for a scalar x to be consistent.
Also, the definition of invert says "invert(<M>) is equivalent to <M>^^-1", and x^^-1 => 1/x for scalar x. I suppose you could argue that the definition is restricted to matrices M, but I think that's quibbling.
Last edit: Stavros Macrakis 2026-06-10
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Oops,
matrix([1])becomes 1, so it's callinginvert(1).Even though
invert(matrix([1])), scalarmatrixp:allsimplifies to1, this is still a bug because Maxima functions should never give Lisp errors.Arguably, too, if
scalarmatrixpis simplifying the matrix to a scalar, theninvert(x)should return1/xfor a scalarxto be consistent.Also, the definition of
invertsays "invert(<M>)is equivalent to<M>^^-1", andx^^-1 => 1/xfor scalarx. I suppose you could argue that the definition is restricted to matricesM, but I think that's quibbling.Last edit: Stavros Macrakis 2026-06-10