Could you post the details of your example? adjugate is not supposed
to fail. And this should be fixed.

The problem is probably in matrix/matrix2.pyx:2355

           f = self.lift().charpoly(var).change_ring(R)
---->  elif R.is_field(proof = False) and R.is_exact():
           f = self._charpoly_hessenberg(var)

The function is_field is indeed failing in many circumstances
(throwing a NotImplementedError) and we should not rely on
this.

Vincent

Le 12/07/2019 à 18:35, Michael Jung a écrit :
Thanks for you answer.

Ah well, I already tried to compute the adjugate of a corresponding scalar field matrix, but it threw an error due to the is_field method. So I thought it is not possible since the ring is no field (what I found really strange, but god knows what algorithms are used). But I just added a "proof=True" argument to scalar fields and now it's fine. I get the feeling, interpreting error messages correctly is some kind of art. :D

Best regards,

Michael

Am 12.07.19 um 17:20 schrieb Vincent Delecroix:
Or directly through the adjugate method

sage: R.<a,b,c,d> = ZZ[]
sage: RR = R.quotient(a*d-b*c-1)
sage: a,b,c,d = RR.gens()
sage: m = matrix(2, [a,b,c,d])
sage: n = m.adjugate()    # we know that det=1 in this case
sage: m * n
[1 0]
[0 1]

Le 12/07/2019 à 16:53, Vincent Delecroix a écrit :
Dear Michael,

At least, you need to know that the determinant is invertible...
See the related tickets

https://trac.sagemath.org/ticket/15160
https://trac.sagemath.org/ticket/27869

Note that the division free inversion of matrices is not a
completely trivial task. A simple way is to go via the matrix
of cofactors by computing determinant with division free
algorithms. This should be reasonable enough.

Best
Vincent

Le 12/07/2019 à 16:43, Michael Jung a écrit :
Dear developers,
I need to compute the inverses of matrices over commutative rings (namely scalar fields on manifolds). Unfortunately, the algorithms only process if the ring is a field or a corresponding fraction field is known. For now, I
will pretend that the algebra of scalar fields is an algebraic field.
However, for most cases, the algorithms work for arbitrary rings aswell
when the matrix is invertible. I wonder why that hasn't been implemented yet. It would be nice if there was (for example) an additional attribute (something like "force=True") for the inverse function to pretend that the
given ring is a field and at least try a computation.

Best regards,
Michael




--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/b5c490bf-532b-1a29-060e-b11522ae4aec%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to