Opened 5 years ago
Closed 4 years ago
#16858 closed defect (fixed)
Print RDF and CDF elements with more digits
Reported by:  jdemeyer  Owned by:  

Priority:  blocker  Milestone:  sage6.4 
Component:  basic arithmetic  Keywords:  
Cc:  vbraun, zimmerma, tdumont, dimpase  Merged in:  
Authors:  Jeroen Demeyer  Reviewers:  Volker Braun 
Report Upstream:  N/A  Work issues:  
Branch:  641e553 (Commits)  Commit:  641e553ba86daad46813778c55e9073baf617a5f 
Dependencies:  #16889  Stopgaps: 
Description (last modified by )
With the optional package cbc
installed:
sage t long src/sage/numerical/mip.pyx ********************************************************************** File "src/sage/numerical/mip.pyx", line 1470, in sage.numerical.mip.MixedIntegerLinearProgram.number_of_variables.add_constraint Failed example: p.solve() # rel tol 1e15 Expected: 6.666666666666666 Got: 6.66666666667 Tolerance exceeded: 5e13 > 1e15 ********************************************************************** [...several similar failures not shown...]
The underlying reason is that the coin
solver returns an RDF
element, while the glpk
solver returns a Python float. These are printed differently, even though they have the same value.
The branch here changes __repr__
for RDF
and CDF
elements and fixes tons of doctests. Other small fixes are switching __str__
and __repr__
for some classes in real_roots.pyx
and some doctest reformatting.
Change History (44)
comment:1 Changed 5 years ago by
comment:2 Changed 5 years ago by
same happens when GUROBI is the default LP solver. In addition, GUROBI automatically gives constraints names, and this screws up even more doctests in this case.
comment:3 Changed 4 years ago by
 Branch set to u/jdemeyer/ticket/16858
 Created changed from 08/20/14 13:59:23 to 08/20/14 13:59:23
 Modified changed from 08/21/14 13:00:39 to 08/21/14 13:00:39
comment:4 Changed 4 years ago by
 Commit set to 4957ed4306eaa69b0b20a14b056c1ff3f6a6c19c
 Component changed from linear programming to basic arithmetic
 Description modified (diff)
 Summary changed from Doctest failures when cbc is installed to Print RDF and CDF elements with more digits
New commits:
4957ed4  Print RDF and CDF elements like Python floats

comment:5 Changed 4 years ago by
 Commit changed from 4957ed4306eaa69b0b20a14b056c1ff3f6a6c19c to 9293ea3a5e8f5ef215159ee5e46cc36e754cc52d
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
9293ea3  Print RDF and CDF elements like Python floats

comment:6 Changed 4 years ago by
 Commit changed from 9293ea3a5e8f5ef215159ee5e46cc36e754cc52d to e1a218252aa87ecec15e4ba3e2dcd5f9532b3b06
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
e1a2182  Print RDF and CDF elements like Python floats

comment:7 Changed 4 years ago by
 Commit changed from e1a218252aa87ecec15e4ba3e2dcd5f9532b3b06 to e1bc1645ab4edae4f0d41eb608c600d01a903847
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
e1bc164  Print RDF and CDF elements like Python floats

comment:8 Changed 4 years ago by
 Dependencies set to #16889
comment:9 followup: ↓ 10 Changed 4 years ago by
Should we test this on ARM? There might be quite a bit of extra numerical noise...
comment:10 in reply to: ↑ 9 Changed 4 years ago by
Replying to dimpase:
Should we test this on ARM?
When this ticket has been set to needs_review, yes please.
There might be quite a bit of extra numerical noise...
I am also afraid of that.
comment:11 Changed 4 years ago by
 Commit changed from e1bc1645ab4edae4f0d41eb608c600d01a903847 to b95a636f5983dd1092423bad64a9201decc77013
comment:12 Changed 4 years ago by
comment:13 Changed 4 years ago by
 Commit changed from b95a636f5983dd1092423bad64a9201decc77013 to 2421bfa9233bf9b49bd347b22e4ac08cfad9d645
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
2421bfa  Print RDF and CDF elements like Python floats

comment:14 Changed 4 years ago by
 Commit changed from 2421bfa9233bf9b49bd347b22e4ac08cfad9d645 to ca60d8a3b0c600b7048967b42446fb232436d7d6
comment:15 Changed 4 years ago by
 Commit changed from ca60d8a3b0c600b7048967b42446fb232436d7d6 to e595a20bfe084744e281a78792b737105f2c7d96
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
e595a20  Print RDF and CDF elements like Python floats

comment:16 Changed 4 years ago by
Conflicts with 6.4.beta2. Let me know if I should wait for this ticket...
comment:17 Changed 4 years ago by
 Commit changed from e595a20bfe084744e281a78792b737105f2c7d96 to 1fe0898c5249af0b9377cff728c9fe56426fe3a5
comment:18 Changed 4 years ago by
 Commit changed from 1fe0898c5249af0b9377cff728c9fe56426fe3a5 to 7b858a2c569fb5f973fb49007d38064d5df1978f
comment:19 Changed 4 years ago by
 Commit changed from 7b858a2c569fb5f973fb49007d38064d5df1978f to 1c5cd881d6c039e7d154020d36af524240fe3b37
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
1c5cd88  Print RDF and CDF elements like Python floats

comment:20 Changed 4 years ago by
 Status changed from new to needs_review
This is now ready for testing. Volker, could you run this on the buildbots please and report back? It's not yet tested on OS X, so I expect some doctest failures.
comment:21 Changed 4 years ago by
 Cc zimmerma added
This also needs some changes to the French book...
comment:22 followup: ↓ 24 Changed 4 years ago by
I a couple of failures like this on my laptop:
sage t src/sage/matrix/matrix_double_dense.pyx ********************************************************************** File "src/sage/matrix/matrix_double_dense.pyx", line 3842, in sage.matrix.matrix_double_dense.Matrix_double_dense.exp Failed example: A.exp(algorithm='eig') # tol 1e14 Expected: [19.614602953804923 + 12.51774384676257*I 3.7949636449582016 + 28.883799306580997*I] [32.38358098092227 + 21.884235957898433*I 2.2696330040935084 + 44.90132482768484*I] Got: [19.614602953804923 + 12.517743846762574*I 3.794963644958207 + 28.883799306580997*I] [ 32.38358098092226 + 21.884235957898447*I 2.2696330040935333 + 44.901324827684824*I] Tolerance exceeded in 1 of 8: 2.2696330040935084 vs 2.2696330040935333, tolerance 1e14 > 1e14
At least the 1e14 > 1e14 is wrong ;)
comment:23 Changed 4 years ago by
I just started to run this ticket on the buildbot (http://build.sagemath.org/sage/waterfall?category=incremental)
comment:24 in reply to: ↑ 22 Changed 4 years ago by
Replying to vbraun:
At least the 1e14 > 1e14 is wrong ;)
I don't know if you're joking or not, but the left 1e14
is actually 1.097e14
printed with 1 significant digit. I didn't change that, but if you think that tolerances should be printed with more precision, that can easily be done on #16889.
comment:25 Changed 4 years ago by
 Cc tdumont added
Thierry Dumont will have a look at the changes implied for the french book, but not before Wednesday.
Paul
comment:26 Changed 4 years ago by
 Commit changed from 1c5cd881d6c039e7d154020d36af524240fe3b37 to 40dbfc4c4b0ac47d24a8d9c97824f6f7b542d5a7
Branch pushed to git repo; I updated commit sha1. New commits:
40dbfc4  Fix numerical noise on various systems

comment:27 Changed 4 years ago by
Still getting two failures on my laptop:
sage t src/sage/matrix/matrix2.pyx ********************************************************************** File "src/sage/matrix/matrix2.pyx", line 12209, in sage.matrix.matrix2.Matrix.diagonal.norm Failed example: A.norm(2) Expected: 5.470684443210384 Got: 5.470684443210385 **********************************************************************
and
sage t src/sage/modular/modform/numerical.py ********************************************************************** File "src/sage/modular/modform/numerical.py", line 463, in sage.modular.modform.numerical.NumericalEigenforms.systems_of_eigenvalues Failed example: numerical_eigenforms(61).systems_of_eigenvalues(10) # rel tol 1e14 Expected: [ [1.4811943040920152, 0.8060634335253695, 3.1563251746586642, 0.6751308705666477], [1.0, 2.0000000000000027, 3.000000000000003, 1.0000000000000044], [0.3111078174659775, 2.903211925911551, 2.525427560843529, 3.214319743377552], [2.170086486626034, 1.7092753594369208, 1.63089761381512, 0.46081112718908984], [3.0, 4.0, 6.0, 8.0] ] Got: [ [1.4811943040920152, 0.8060634335253695, 3.1563251746586642, 0.6751308705666477], [1.0000000000000007, 2.000000000000002, 3.000000000000004, 1.0000000000000024], [0.3111078174659775, 2.903211925911551, 2.525427560843529, 3.214319743377552], [2.1700864866260345, 1.7092753594369194, 1.6308976138151292, 0.46081112718909495], [3.0, 4.0, 6.0, 8.0] ] Tolerance exceeded in 1 of 20: 0.46081112718908984 vs 0.46081112718909495, tolerance 1e14 > 1e14 ********************************************************************** File "src/sage/modular/modform/numerical.py", line 490, in sage.modular.modform.numerical.NumericalEigenforms.systems_of_abs Failed example: numerical_eigenforms(61).systems_of_abs(10) # rel tol 1e14 Expected: [ [0.3111078174659775, 2.903211925911551, 2.525427560843529, 3.214319743377552], [1.0, 2.0000000000000027, 3.000000000000003, 1.0000000000000044], [1.4811943040920152, 0.8060634335253695, 3.1563251746586642, 0.6751308705666477], [2.170086486626034, 1.7092753594369208, 1.63089761381512, 0.46081112718908984], [3.0, 4.0, 6.0, 8.0] ] Got: [ [0.3111078174659775, 2.903211925911551, 2.525427560843529, 3.214319743377552], [1.0000000000000007, 2.000000000000002, 3.000000000000004, 1.0000000000000024], [1.4811943040920152, 0.8060634335253695, 3.1563251746586642, 0.6751308705666477], [2.1700864866260345, 1.7092753594369194, 1.6308976138151292, 0.46081112718909495], [3.0, 4.0, 6.0, 8.0] ] Tolerance exceeded in 1 of 20: 0.46081112718908984 vs 0.46081112718909495, tolerance 1e14 > 1e14 ********************************************************************** 2 items had failures: 1 of 2 in sage.modular.modform.numerical.NumericalEigenforms.systems_of_abs 1 of 2 in sage.modular.modform.numerical.NumericalEigenforms.systems_of_eigenvalues
Rerunning on the buildbot right now.
comment:28 Changed 4 years ago by
Passed on the buildbot.
comment:29 Changed 4 years ago by
 Commit changed from 40dbfc4c4b0ac47d24a8d9c97824f6f7b542d5a7 to b86821f5c785e49b7bc8ba3b2542163d3f1648d4
Branch pushed to git repo; I updated commit sha1. New commits:
b86821f  Fix numerical noise on one more system

comment:30 Changed 4 years ago by
 Cc dimpase added
ARM tests: http://boxen.math.washington.edu/home/vbraun/logs/armptestlong.log
Dima: what is the status with ARM float precision (before this ticket)?
comment:31 Changed 4 years ago by
IIRC, #15921 fixed all precision things. As the precision has increased, no wonder that few tests now fail.
comment:32 Changed 4 years ago by
Indeed, all tests pass on ARM without this ticket.
comment:33 Changed 4 years ago by
 Commit changed from b86821f5c785e49b7bc8ba3b2542163d3f1648d4 to d3b1d0b4839997338b847a4741c69ad95896d358
Branch pushed to git repo; I updated commit sha1. New commits:
d3b1d0b  Fix doctests on ARM

comment:34 Changed 4 years ago by
 Reviewers set to Volker Braun
comment:35 Changed 4 years ago by
You missed one failing doctest:
sage t long src/sage/modular/modform/numerical.py ********************************************************************** File "src/sage/modular/modform/numerical.py", line 463, in sage.modular.modform.numerical.NumericalEigenforms.systems_of_eigenvalues Failed example: numerical_eigenforms(61).systems_of_eigenvalues(10) # rel tol 2e14 Expected: [ [1.4811943040920152, 0.8060634335253695, 3.1563251746586642, 0.6751308705666477], [1.0, 2.0000000000000027, 3.000000000000003, 1.0000000000000044], [0.3111078174659775, 2.903211925911551, 2.525427560843529, 3.214319743377552], [2.170086486626034, 1.7092753594369208, 1.63089761381512, 0.46081112718908984], [3.0, 4.0, 6.0, 8.0] ] Got: [ [1.4811943040920152, 0.806063433525369, 3.156325174658668, 0.675130870566654], [1.0000000000000024, 1.9999999999999993, 2.999999999999994, 1.0000000000000067], [0.3111078174659905, 2.9032119259115587, 2.525427560843502, 3.214319743377512], [2.170086486626031, 1.7092753594369192, 1.6308976138151232, 0.46081112718909467], [3.0, 4.0, 6.0, 8.0] ] Tolerance exceeded in 1 of 20: 0.3111078174659775 vs 0.3111078174659905, tolerance 4e14 > 2e14 ********************************************************************** File "src/sage/modular/modform/numerical.py", line 490, in sage.modular.modform.numerical.NumericalEigenforms.systems_of_abs Failed example: numerical_eigenforms(61).systems_of_abs(10) # rel tol 2e14 Expected: [ [0.3111078174659775, 2.903211925911551, 2.525427560843529, 3.214319743377552], [1.0, 2.0000000000000027, 3.000000000000003, 1.0000000000000044], [1.4811943040920152, 0.8060634335253695, 3.1563251746586642, 0.6751308705666477], [2.170086486626034, 1.7092753594369208, 1.63089761381512, 0.46081112718908984], [3.0, 4.0, 6.0, 8.0] ] Got: [ [0.3111078174659905, 2.9032119259115587, 2.525427560843502, 3.214319743377512], [1.0000000000000024, 1.9999999999999993, 2.999999999999994, 1.0000000000000067], [1.4811943040920152, 0.806063433525369, 3.156325174658668, 0.675130870566654], [2.170086486626031, 1.7092753594369192, 1.6308976138151232, 0.46081112718909467], [3.0, 4.0, 6.0, 8.0] ] Tolerance exceeded in 1 of 20: 0.3111078174659775 vs 0.3111078174659905, tolerance 4e14 > 2e14 ********************************************************************** 2 items had failures: 1 of 2 in sage.modular.modform.numerical.NumericalEigenforms.systems_of_abs 1 of 2 in sage.modular.modform.numerical.NumericalEigenforms.systems_of_eigenvalues [46 tests, 2 failures, 1.53 s]
comment:36 Changed 4 years ago by
 Status changed from needs_review to needs_work
comment:37 Changed 4 years ago by
 Commit changed from d3b1d0b4839997338b847a4741c69ad95896d358 to 641e553ba86daad46813778c55e9073baf617a5f
Branch pushed to git repo; I updated commit sha1. New commits:
641e553  Fix more doctests on ARM

comment:38 Changed 4 years ago by
 Status changed from needs_work to needs_review
New commits:
641e553  Fix more doctests on ARM

comment:39 Changed 4 years ago by
 Status changed from needs_review to positive_review
comment:40 Changed 4 years ago by
if there are any changes in tests/french_book
, I'd like we check them first (see
comment 25), otherwise this might invalidate some examples we give in our book.
Paul
comment:41 Changed 4 years ago by
Per your comment, you have time until tomorrow ;)
comment:42 Changed 4 years ago by
 Status changed from positive_review to needs_review
comment:43 Changed 4 years ago by
 Status changed from needs_review to positive_review
Its only adding precision to the output, I think this should be uncontroversial.
comment:44 Changed 4 years ago by
 Branch changed from u/jdemeyer/ticket/16858 to 641e553ba86daad46813778c55e9073baf617a5f
 Resolution set to fixed
 Status changed from positive_review to closed
I'm working on a patch to change
_repr_
forRDF
andCDF
. There are a lot of doctest failures, but I think it makes sense.