On Tue, Apr 13, 2021 at 11:35:55AM +0200, Prof. Dr. Johannes Grabmeier privat wrote:
> the FriCAS code for inverting matrices over R is not correct. If wished
> I can provide the necessary changes to matfuns.spad
I am not sure what you consider as "not correct". Namely, currently
'inverse' assumes that matrix is over a field. AFAICS this is
deliberate, because otherwise a lot of integer matrices would
be noninvertible (because inverse needs rational numbers). So
your result with 'inverse' is a conseqence of decision to not
provide 'inverse' over rings and interpreter rules for coercion.
Concerning 'recip', this is clearly a bug: SquareMatrix claims
to be a Ring, which implies that there is a 'recip'.
'recip' in SquareMatrix is inherited from MagmaWithUnit,
which is a trivial one: it fails on anything different than 1.
But Ring also claims 'unitsKnown', which means that 'recip' is
allowed to fail only on non-invertible elements. ATM is is
not clear for me how to fix this: for commutative rings we
can easily provide slow but simple implementation of 'recip'
using determinants. For more general rings this looks more
complicated. And to say the truth, I wonder if other non-commutative
rings have correct 'recip'.
--
Waldek Hebisch