diff --git a/src/doc/de/tutorial/tour_linalg.rst b/src/doc/de/tutorial/tour_linalg.rst index 6cd1724dd95..e04f7e0d5fd 100644 --- a/src/doc/de/tutorial/tour_linalg.rst +++ b/src/doc/de/tutorial/tour_linalg.rst @@ -114,10 +114,10 @@ standardmässig die Körper ``RR`` oder ``CC`` verwendet, welche allerdings nich alle der folgenden Berechnungen unterstützen:: sage: ARDF = matrix(RDF, [[1.2, 2], [2, 3]]) - sage: ARDF.eigenvalues() + sage: ARDF.eigenvalues() # rel tol 8e-16 [-0.09317121994613098, 4.293171219946131] sage: ACDF = matrix(CDF, [[1.2, I], [2, 3]]) - sage: ACDF.eigenvectors_right() # rel tol 1e-15 + sage: ACDF.eigenvectors_right() # rel tol 2e-15 [(0.8818456983293743 - 0.8209140653434135*I, [(0.7505608183809549, -0.616145932704589 + 0.2387941530333261*I)], 1), (3.3181543016706256 + 0.8209140653434133*I, [(0.14559469829270957 + 0.3756690858502104*I, 0.9152458258662108)], 1)] diff --git a/src/doc/en/tutorial/tour_linalg.rst b/src/doc/en/tutorial/tour_linalg.rst index 053b6489d76..04df8532337 100644 --- a/src/doc/en/tutorial/tour_linalg.rst +++ b/src/doc/en/tutorial/tour_linalg.rst @@ -111,10 +111,10 @@ by default the matrix is defined over the ``RR`` or ``CC`` fields, respectively, which do not support these computations for all the cases:: sage: ARDF = matrix(RDF, [[1.2, 2], [2, 3]]) - sage: ARDF.eigenvalues() + sage: ARDF.eigenvalues() # rel tol 8e-16 [-0.09317121994613098, 4.293171219946131] sage: ACDF = matrix(CDF, [[1.2, I], [2, 3]]) - sage: ACDF.eigenvectors_right() # rel tol 1e-15 + sage: ACDF.eigenvectors_right() # rel tol 2e-15 [(0.8818456983293743 - 0.8209140653434135*I, [(0.7505608183809549, -0.616145932704589 + 0.2387941530333261*I)], 1), (3.3181543016706256 + 0.8209140653434133*I, [(0.14559469829270957 + 0.3756690858502104*I, 0.9152458258662108)], 1)] diff --git a/src/doc/fr/tutorial/tour_linalg.rst b/src/doc/fr/tutorial/tour_linalg.rst index c9ada47843d..0b896ed139a 100644 --- a/src/doc/fr/tutorial/tour_linalg.rst +++ b/src/doc/fr/tutorial/tour_linalg.rst @@ -112,10 +112,10 @@ ce ne sont pas ``RDF`` ou ``CDF`` qui sont utilisés par défaut, mais ``RR`` et ``CC``, sur lesquels ces calculs ne sont pas implémentés dans tous les cas:: sage: ARDF = matrix(RDF, [[1.2, 2], [2, 3]]) - sage: ARDF.eigenvalues() + sage: ARDF.eigenvalues() # rel tol 8e-16 [-0.09317121994613098, 4.293171219946131] sage: ACDF = matrix(CDF, [[1.2, I], [2, 3]]) - sage: ACDF.eigenvectors_right() # rel tol 1e-15 + sage: ACDF.eigenvectors_right() # rel tol 2e-15 [(0.8818456983293743 - 0.8209140653434135*I, [(0.7505608183809549, -0.616145932704589 + 0.2387941530333261*I)], 1), (3.3181543016706256 + 0.8209140653434133*I, [(0.14559469829270957 + 0.3756690858502104*I, 0.9152458258662108)], 1)] diff --git a/src/doc/ru/tutorial/tour_linalg.rst b/src/doc/ru/tutorial/tour_linalg.rst index 18b9b2d8c2f..359f4b3626e 100644 --- a/src/doc/ru/tutorial/tour_linalg.rst +++ b/src/doc/ru/tutorial/tour_linalg.rst @@ -106,10 +106,10 @@ Sage может находить собственное число и собст соответственно:: sage: ARDF = matrix(RDF, [[1.2, 2], [2, 3]]) - sage: ARDF.eigenvalues() + sage: ARDF.eigenvalues() # rel tol 8e-16 [-0.09317121994613098, 4.293171219946131] sage: ACDF = matrix(CDF, [[1.2, I], [2, 3]]) - sage: ACDF.eigenvectors_right() # rel tol 1e-15 + sage: ACDF.eigenvectors_right() # rel tol 2e-15 [(0.8818456983293743 - 0.8209140653434135*I, [(0.7505608183809549, -0.616145932704589 + 0.2387941530333261*I)], 1), (3.3181543016706256 + 0.8209140653434133*I, [(0.14559469829270957 + 0.3756690858502104*I, 0.9152458258662108)], 1)] diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx index b233510651e..0345baf700f 100644 --- a/src/sage/matrix/matrix2.pyx +++ b/src/sage/matrix/matrix2.pyx @@ -4938,10 +4938,10 @@ cdef class Matrix(matrix1.Matrix): consult numerical or symbolic matrix classes for other options sage: em = A.change_ring(RDF).eigenmatrix_left() - sage: eigenvalues = em[0]; eigenvalues.dense_matrix().zero_at(2e-15) - [ 13.348469228349... 0.0 0.0] - [ 0.0 -1.348469228349... 0.0] - [ 0.0 0.0 0.0] + sage: eigenvalues = em[0]; eigenvalues.dense_matrix() # abs tol 1e-13 + [13.348469228349522 0.0 0.0] + [ 0.0 -1.348469228349534 0.0] + [ 0.0 0.0 0.0] sage: eigenvectors = em[1]; eigenvectors # not tested [ 0.440242867... 0.567868371... 0.695493875...] [ 0.897878732... 0.278434036... -0.341010658...] @@ -5206,7 +5206,7 @@ cdef class Matrix(matrix1.Matrix): consult numerical or symbolic matrix classes for other options sage: em = B.change_ring(RDF).eigenmatrix_right() - sage: eigenvalues = em[0]; eigenvalues.dense_matrix() # abs tol 1e-13 + sage: eigenvalues = em[0]; eigenvalues.dense_matrix() # abs tol 1e-13 [13.348469228349522 0.0 0.0] [ 0.0 -1.348469228349534 0.0] [ 0.0 0.0 0.0] @@ -5597,10 +5597,10 @@ cdef class Matrix(matrix1.Matrix): sage: A = matrix(QQ, 3, 3, range(9)) sage: em = A.change_ring(RDF).eigenmatrix_left() - sage: evalues = em[0]; evalues.dense_matrix().zero_at(2e-15) - [ 13.348469228349... 0.0 0.0] - [ 0.0 -1.348469228349... 0.0] - [ 0.0 0.0 0.0] + sage: evalues = em[0]; evalues.dense_matrix() # abs tol 1e-13 + [13.348469228349522 0.0 0.0] + [ 0.0 -1.348469228349534 0.0] + [ 0.0 0.0 0.0] sage: evectors = em[1]; sage: for i in range(3): ....: scale = evectors[i,0].sign() diff --git a/src/sage/matrix/matrix_double_dense.pyx b/src/sage/matrix/matrix_double_dense.pyx index 94f23044bfa..caf3e5f7722 100644 --- a/src/sage/matrix/matrix_double_dense.pyx +++ b/src/sage/matrix/matrix_double_dense.pyx @@ -1009,11 +1009,11 @@ cdef class Matrix_double_dense(matrix_dense.Matrix_dense): sage: A.condition() > 1.6e16 or A.condition() True - sage: A.singular_values(eps=None) # abs tol 2e-16 + sage: A.singular_values(eps=None) # abs tol 5e-16 [1.7953720595619975, 0.38027524595503703, 0.04473854875218107, 0.0037223122378911614, 0.0002330890890217751, 1.116335748323284e-05, 4.082376110397296e-07, 1.1228610675717613e-08, 2.2519645713496478e-10, 3.1113486853814003e-12, 2.6500422260778388e-14, 9.87312834948426e-17] - sage: A.singular_values(eps='auto') # abs tol 2e-16 + sage: A.singular_values(eps='auto') # abs tol 5e-16 [1.7953720595619975, 0.38027524595503703, 0.04473854875218107, 0.0037223122378911614, 0.0002330890890217751, 1.116335748323284e-05, 4.082376110397296e-07, 1.1228610675717613e-08, 2.2519645713496478e-10, 3.1113486853814003e-12, 2.6500422260778388e-14, 0.0] - sage: A.singular_values(eps=1e-4) # abs tol 2e-16 + sage: A.singular_values(eps=1e-4) # abs tol 5e-16 [1.7953720595619975, 0.38027524595503703, 0.04473854875218107, 0.0037223122378911614, 0.0002330890890217751, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] With Sage's "verbose" facility, you can compactly see the cutoff @@ -1135,7 +1135,7 @@ cdef class Matrix_double_dense(matrix_dense.Matrix_dense): [ 0.0 1.0 2.0 3.0] [ 8.0 9.0 10.0 11.0] [ 4.0 5.0 6.0 7.0] - sage: L*U + sage: L*U # rel tol 2e-16 [12.0 13.0 14.0 15.0] [ 0.0 1.0 2.0 3.0] [ 8.0 9.0 10.0 11.0] diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index 86f14ae0b7b..5164c088fd3 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -1629,8 +1629,8 @@ cdef class ComplexDoubleElement(FieldElement): sage: a = CDF(1,1); b = CDF(2,3) sage: c = a^b; c # indirect doctest -0.163450932107355 + 0.09600498360894891*I - sage: c^(1/b) - 1.0000000000000002 + 1.0*I + sage: c^(1/b) # rel tol 2e-16 + 1.0 + 1.0*I We compute the cube root of `-1` then cube it and observe a rounding error:: diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index da7b7ef468e..9eb4ec2ca97 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -5361,8 +5361,8 @@ cdef class Polynomial(CommutativeAlgebraElement): [(-1.0911236359717227 - 0.6299605249474374*I, 1), (3.885780586188048e-16 + 1.2599210498948734*I, 1), (1.0911236359717211 - 0.6299605249474363*I, 1)] sage: f.roots(multiplicities=False) # abs tol 1e-14 [-1.0911236359717227 - 0.6299605249474374*I, 3.885780586188048e-16 + 1.2599210498948734*I, 1.0911236359717211 - 0.6299605249474363*I] - sage: [f(z) for z in f.roots(multiplicities=False)] # abs tol 1e-12 - [1.3704315460216776e-15 + 3.3306690738754696e-15*I, 5.287107591627866e-16 + 1.9984014443252818e-15*I, 2.0616104309811867e-16 + 1.7763568394002505e-15*I] + sage: [abs(f(z)) for z in f.roots(multiplicities=False)] # abs tol 1e-14 + [8.95090418262362e-16, 8.728374398092689e-16, 1.0235750533041806e-15] sage: f = i*x^3 + 2; f I*x^3 + 2.0 sage: f.roots() # abs tol 1e-14 @@ -5614,9 +5614,9 @@ cdef class Polynomial(CommutativeAlgebraElement): sage: R. = QQ[] sage: g = -27*u^14 - 32*u^9 - sage: g.roots(CDF, multiplicities=False) # abs tol 1e-15 + sage: g.roots(CDF, multiplicities=False) # abs tol 2e-15 [-1.0345637159435719, 0.0, -0.3196977699902601 - 0.9839285635706636*I, -0.3196977699902601 + 0.9839285635706636*I, 0.8369796279620465 - 0.6081012947885318*I, 0.8369796279620465 + 0.6081012947885318*I] - sage: g.roots(CDF) # abs tol 1e-15 + sage: g.roots(CDF) # abs tol 2e-15 [(-1.0345637159435719, 1), (0.0, 9), (-0.3196977699902601 - 0.9839285635706636*I, 1), (-0.3196977699902601 + 0.9839285635706636*I, 1), (0.8369796279620465 - 0.6081012947885318*I, 1), (0.8369796279620465 + 0.6081012947885318*I, 1)] This shows that the issue at :trac:`2418` is fixed:: diff --git a/src/sage/rings/polynomial/real_roots.pyx b/src/sage/rings/polynomial/real_roots.pyx index edf1c14c1a8..aa6df969b3c 100644 --- a/src/sage/rings/polynomial/real_roots.pyx +++ b/src/sage/rings/polynomial/real_roots.pyx @@ -1573,7 +1573,7 @@ cdef class interval_bernstein_polynomial_float(interval_bernstein_polynomial): sage: bp2 sage: bp1, bp2, ok = bp.de_casteljau(ctx, 2/3) - sage: bp1 + sage: bp1 # rel tol 2e-16 sage: bp2 # rel tol 3e-15 diff --git a/src/sage/stats/hmm/chmm.pyx b/src/sage/stats/hmm/chmm.pyx index 5245128f221..f060cd24c4b 100644 --- a/src/sage/stats/hmm/chmm.pyx +++ b/src/sage/stats/hmm/chmm.pyx @@ -1337,7 +1337,7 @@ cdef class GaussianMixtureHiddenMarkovModel(GaussianHiddenMarkovModel): (2.18905068682..., 15) sage: m.log_likelihood(v) 2.18905068682... - sage: m # rel tol 3e-14 + sage: m # rel tol 6e-14 Gaussian Mixture Hidden Markov Model with 2 States Transition matrix: [ 0.8746363339773399 0.12536366602266016] diff --git a/src/sage/tests/french_book/mpoly.py b/src/sage/tests/french_book/mpoly.py index 0220323ba97..95847911752 100644 --- a/src/sage/tests/french_book/mpoly.py +++ b/src/sage/tests/french_book/mpoly.py @@ -361,7 +361,7 @@ Sage example in ./mpoly.tex, line 1119 (edited manually):: - sage: ys = CDF['y'](Jy.0).roots(); ys + sage: ys = CDF['y'](Jy.0).roots(); ys # abs tol 3e-16 [(-0.8000000000000002, 1), (0.0, 1), (0.8, 1)] sage: [CDF['x'](p(y=ys[0][0])).roots() for p in J.gens()] # abs tol 1e-14 [[(-0.5999999999999999 - 1.306289919090511e-16*I, 1), (0.6000000000000001 + 1.3062899190905113e-16*I, 1)], [(0.6000000000000001 - 3.135095805817224e-16*I, 1), (2.600000000000001 + 3.1350958058172237e-16*I, 1)]]