Hi,
{{{
sage: C = A.change_ring(QQ)
sage: C.det().n() # numerical approximation of an exact computation
16801.7979988279
}}}
The algorithm for RDF is implemented in scipy which is more serious
for linear algebra than Sage (for floating point numbers). My answer
would be: if you are dealing with float use RDF.
2014/1/20, P Purkayastha <[email protected]>:
> The following matrix gives wildly different results
>
> A = matrix([[ 1.0, -1.50614628068, 2.26847661882, -
> 3.41665762226, 5.14598617013, -7.7506079306, 11.6735493077,
> -
> 17.5820728722],
> [ 1.0, -0.936702701875, 0.877411951699, -0.821874145813,
>
> 0.769851732984, -0.721122198329, 0.675477111557, -0.632721235449],
> [ 1.0, -0.443181140009, 0.19640952286, -0.0870449962496,
>
> 0.03857670067, -0.0170964661807, 0.00757683137208, -0.00335790876514],
> [ 1.0, 0.352786603689, 0.124458387743, 0.0439072519123,
>
> 0.0154898902795, 0.00546462578321, 0.00192784677049, 0.000680118514595],
> [ 1.0, 0.647213396311, 0.418885180364, 0.271108100248,
>
> 0.175464794329, 0.11356316547, 0.07349960202, 0.0475699270508],
> [ 1.0, 1.44318114001, 2.08277180288, 3.00581698486,
>
> 4.33793838286, 6.26043086067, 9.03493574645, 13.0390488705],
> [ 1.0, 1.93670270187, 3.75081735545, 7.26421810653,
>
> 14.0686308339, 27.2467553477, 52.7688646993, 102.197602838],
> [ 1.0, 2.50614628068, 6.28076918019, 15.7405263208,
>
> 39.4480614948, 98.8626125954, 247.764168855, 620.933250262]])
>
>
> B = A.change_ring(RDF)
>
>
> print "det(A) = {}, det(B) = {}".format(A.determinant(), B.determinant())
> print "parent(A) = {}\nparent(B) = {}".format(A.parent(), B.parent())
>
> The output is the totally unexpected:
>
> det(A) = -4.19430400000000e6, det(B) = 16801.7979988
> parent(A) = Full MatrixSpace of 8 by 8 dense matrices over Real Field with
> 53 bits of precision
> parent(B) = Full MatrixSpace of 8 by 8 dense matrices over Real Double
> Field
>
> Which of these outputs should we trust? And what is the preferred field over
> which something as simple as a determinant should be computed?
>
>
> - basu.
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.