Skip to content

Commit

Permalink
gh-38685: Loosen tolerance in a few expm() tests
Browse files Browse the repository at this point in the history
    
SciPy upstream just merged scipy/scipy#21553
which rewrites the matrix exponential in C. I merged this PR to work
around some other bug, and in the process noticed that a few tolerances
will need to be loosened in our test suite.
    
URL: #38685
Reported by: Michael Orlitzky
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed Sep 27, 2024
2 parents d233b16 + a727c17 commit 9f791ae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/sage/matrix/matrix2.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -15900,7 +15900,7 @@ cdef class Matrix(Matrix1):
sage: a.exp() # needs sage.symbolic
[ 1/11882424341266*((11*sqrt(227345670387496707609) + 5941212170633)*e^(3/1275529100*sqrt(227345670387496707609)) - 11*sqrt(227345670387496707609) + 5941212170633)*e^(-3/2551058200*sqrt(227345670387496707609) + 101/200) 445243650/75781890129165569203*(sqrt(227345670387496707609)*e^(3/1275529100*sqrt(227345670387496707609)) - sqrt(227345670387496707609))*e^(-3/2551058200*sqrt(227345670387496707609) + 101/200)]
[ 10000/53470909535697*(sqrt(227345670387496707609)*e^(3/1275529100*sqrt(227345670387496707609)) - sqrt(227345670387496707609))*e^(-3/2551058200*sqrt(227345670387496707609) + 101/200) -1/11882424341266*((11*sqrt(227345670387496707609) - 5941212170633)*e^(3/1275529100*sqrt(227345670387496707609)) - 11*sqrt(227345670387496707609) - 5941212170633)*e^(-3/2551058200*sqrt(227345670387496707609) + 101/200)]
sage: a.change_ring(RDF).exp() # rel tol 1e-14 # needs sage.symbolic
sage: a.change_ring(RDF).exp() # rel tol 6e-14 # needs sage.symbolic
[42748127.31532951 7368259.244159399]
[234538976.1381042 40426191.45156228]

Expand Down
4 changes: 2 additions & 2 deletions src/sage/matrix/matrix_double_dense.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3663,7 +3663,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense):
sage: A = matrix(RDF, 2, [1,2,3,4]); A
[1.0 2.0]
[3.0 4.0]
sage: A.exp() # tol 1e-14
sage: A.exp() # tol 5e-14
[51.968956198705044 74.73656456700327]
[112.10484685050491 164.07380304920997]
sage: A = matrix(CDF, 2, [1,2+I,3*I,4]); A # needs sage.symbolic
Expand All @@ -3676,7 +3676,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense):
TESTS::
sage: A = matrix(RDF, 2, [1,2,3,4])
sage: A.exp() # tol 1e-14
sage: A.exp() # tol 5e-14
[51.968956198705044 74.73656456700327]
[112.10484685050491 164.07380304920997]
Expand Down
2 changes: 1 addition & 1 deletion src/sage/symbolic/constants_c_impl.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ cdef class E(Expression):
[e 0]
[0 e]
sage: A = matrix(RDF, [[1,2],[3,4]])
sage: e^A # rel tol 1e-14
sage: e^A # rel tol 5e-14
[51.968956198705044 74.73656456700327]
[112.10484685050491 164.07380304920997]
"""
Expand Down

0 comments on commit 9f791ae

Please sign in to comment.