Open ppurka opened 10 years ago
Description changed:
---
+++
@@ -25,3 +25,17 @@
16801.7979988279 # same as when doing the computation over QQ
Sage's determinant() already uses PARI over Z/nZ for n less than the machine word size; it would be trivial to adapt it to work also over the reals.
+
+According to Dima, the fix should be:
+
+''Is the default choice of the algorithm the right one?
+One can see that ''
+
+ +sage: A.determinant(algorithm="hessenberg") +16801.7979988558 +
+is quite good...
+
+''
+Sage computes det() by computing charpoly(0), too... The division-free algorithm is obviously meant for more general setting of rings, not fields. I don't know why it was made default here, perhaps just an oversight.''
now (sage 7.6 beta 4)
A.determinant(algorithm="hessenberg")
also returns the faulty -4.19430400000000e6
sage: A.apply_map(RealField(78)).det()
16801.625000000000000000
sage: A.apply_map(RealField(77)).det()
16802.00000000000000000
sage: A.apply_map(RealField(30)).det(algorithm="hessenberg")
16800.613
sage: A.apply_map(RealField(53)).det()
-4.19430400000000e6
The issue is still happening with Sage 9.5.
Changed keywords from none to determinant, RealField
Refer to this sage-devel post
According to Peter Bruin, a possible fix is to use pari:
Well, it should also be fixed for a RealField of higher precision. An easy solution for that is to use PARI, which uses a numerically more stable algorithm (Gaussian elimination, choosing pivots of maximal absolute value; I don't know about proven error bounds). Example:
Sage's determinant() already uses PARI over Z/nZ for n less than the machine word size; it would be trivial to adapt it to work also over the reals.
According to Dima, the fix should be:
''Is the default choice of the algorithm the right one? One can see that ''
is quite good...
'' Sage computes det() by computing charpoly(0), too... The division-free algorithm is obviously meant for more general setting of rings, not fields. I don't know why it was made default here, perhaps just an oversight.''
Component: linear algebra
Keywords: determinant, RealField
Issue created by migration from https://trac.sagemath.org/ticket/15712