Opened 2 years ago

Closed 9 months ago

#23572 closed task (fixed)

doctests for the english translation of the book "Calcul mathématique avec Sage"

Reported by: zimmerma Owned by: chapoton
Priority: critical Milestone: sage-8.7
Component: doctest coverage Keywords:
Cc: mforets, dcoudert, nthiery, vklein, jhpalmieri Merged in:
Authors: Erik Bray, Frédéric Chapoton, Jeroen Demeyer Reviewers: Erik Bray, Frédéric Chapoton, Vincent Klein
Report Upstream: Reported upstream. No feedback yet. Work issues:
Branch: ae36049 (Commits) Commit: ae3604981449d425841ff188904cf641397307a8
Dependencies: #27066 Stopgaps:

Description (last modified by chapoton)

The purpose of this ticket is to add the doctests corresponding to the examples given in the english translation of the book "Calcul mathématique avec Sage" (see https://members.loria.fr/PZimmermann/sagebook/english.html).

Sage already includes doctests for the original version of this book (published in french in 2013). These doctests are in src/sage/tests/french_book, and should be updated.

The final version of the book is now under press, so it is time for adding/updating doctests.

NOTE: some doctests are not exactly those from the book. They have been modified (in a minimal manner) so that they will pass when sage is run using python 3.

bugs found:

  1. Using scipy.sparse.lil_matrix is now broken: #23867

Change History (180)

comment:1 Changed 2 years ago by mforets

  • Cc mforets added

comment:2 Changed 2 years ago by zimmerma

one issue we encounter is the following. The code below differs between Sage 8.0 and Sage 8.1beta3:

   def NearlySingularMatrix(R,n):
      M=matrix(R,n,n)
      for i in range(0,n):
         for j in range(0,n):
            M[i,j]= (1+log(R(1+i)))/((i+1)^2+(j+1)^2)
      return M
   n=35
   print NearlySingularMatrix(RDF,n).det()

With Sage 8.0 we get 0.0, whereas with Sage 8.1beta3 we get -0.0. I thought the determinant code was deterministic, and since RDF computations follow IEEE 754, we should get a deterministic answer. How can we get different answers?

comment:3 Changed 2 years ago by zimmerma

another issue:

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.0, Release Date: 2017-07-21                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
sage: C = graphs.ChvatalGraph()
sage: from sage.graphs.graph_coloring import edge_coloring
sage: edge_coloring(C, hex_colors = True)

{'#00ffff': [(0, 6), (1, 5), (2, 8), (3, 4), (7, 11), (9, 10)],
 '#7f00ff': [(0, 4), (1, 7), (2, 6), (3, 9), (5, 11), (8, 10)],
 '#7fff00': [(0, 9), (1, 2), (3, 7), (4, 8), (5, 10), (6, 11)],
 '#ff0000': [(0, 1), (2, 3), (4, 5), (6, 10), (7, 8), (9, 11)]}

With Sage 8.1beta3 we get:

    {'#00ffff': [(0, 9), (1, 5), (2, 6), (3, 4), (7, 11), (8, 10)],
     '#7f00ff': [(0, 1), (2, 8), (3, 7), (4, 5), (6, 10), (9, 11)],
     '#7fff00': [(0, 4), (1, 2), (3, 9), (5, 10), (6, 11), (7, 8)],
     '#ff0000': [(0, 6), (1, 7), (2, 3), (4, 8), (5, 11), (9, 10)]}

Is there a way to get a deterministic answer? Is there any random seed that controls the edge coloring algorithm?

comment:4 Changed 2 years ago by zimmerma

for comment 3, I'll ask David Coudert who worked on edge_coloring in #22564.

Paul

comment:5 Changed 2 years ago by zimmerma

  • Cc dcoudert added

comment:6 Changed 2 years ago by dcoudert

The coloring is done with ILP and the result depends on the ILP solver. #22564 has been merged in 8.1.beta?? The patch only slightly changes the order in which constraints are added to the ILP and it is enough the get a different solution from 8.0.

sage: from sage.graphs.graph_coloring import edge_coloring
sage: edge_coloring(C, hex_colors = True, solver='GLPK')

{'#00ffff': [(0, 9), (1, 5), (2, 6), (3, 4), (7, 11), (8, 10)],
 '#7f00ff': [(0, 1), (2, 8), (3, 7), (4, 5), (6, 10), (9, 11)],
 '#7fff00': [(0, 4), (1, 2), (3, 9), (5, 10), (6, 11), (7, 8)],
 '#ff0000': [(0, 6), (1, 7), (2, 3), (4, 8), (5, 11), (9, 10)]}
sage: edge_coloring(C, hex_colors = True, solver='Cplex')

{'#00ffff': [(0, 6), (1, 5), (2, 3), (4, 8), (7, 11), (9, 10)],
 '#7f00ff': [(0, 1), (2, 6), (3, 4), (5, 10), (7, 8), (9, 11)],
 '#7fff00': [(0, 9), (1, 2), (3, 7), (4, 5), (6, 11), (8, 10)],
 '#ff0000': [(0, 4), (1, 7), (2, 8), (3, 9), (5, 11), (6, 10)]}
sage: edge_coloring(C, hex_colors = True, solver='PPL')

{'#00ffff': [(0, 9), (1, 5), (2, 8), (3, 4), (6, 10), (7, 11)],
 '#7f00ff': [(0, 6), (1, 7), (2, 3), (4, 5), (8, 10), (9, 11)],
 '#7fff00': [(0, 4), (1, 2), (3, 9), (5, 10), (6, 11), (7, 8)],
 '#ff0000': [(0, 1), (2, 6), (3, 7), (4, 8), (5, 11), (9, 10)]}
sage: edge_coloring(C, hex_colors = True, solver='Coin')

{'#00ffff': [(0, 4), (1, 5), (2, 6), (3, 9), (7, 11), (8, 10)],
 '#7f00ff': [(0, 6), (1, 2), (3, 7), (4, 8), (5, 10), (9, 11)],
 '#7fff00': [(0, 1), (2, 3), (4, 5), (6, 11), (7, 8), (9, 10)],
 '#ff0000': [(0, 9), (1, 7), (2, 8), (3, 4), (5, 11), (6, 10)]}
sage: edge_coloring(C, hex_colors = True, solver='Gurobi')

{'#00ffff': [(0, 1), (2, 6), (3, 9), (4, 5), (7, 11), (8, 10)],
 '#7f00ff': [(0, 6), (1, 7), (2, 3), (4, 8), (5, 10), (9, 11)],
 '#7fff00': [(0, 4), (1, 5), (2, 8), (3, 7), (6, 11), (9, 10)],
 '#ff0000': [(0, 9), (1, 2), (3, 4), (5, 11), (6, 10), (7, 8)]}

In doctests, you must set the solver to GLPK. Otherwise, the default solver is used (e.g., Cplex if you have it).

comment:7 follow-up: Changed 2 years ago by zimmerma

David,

1) from the trac page, #22564 has been merged in 8.0, thus the difference I see should be due to subsequent changes

2) is there any reason why the order of the constraints was changed? It makes it difficult to add doctests for this example from our book about Sage

comment:8 in reply to: ↑ 7 Changed 2 years ago by dcoudert

Replying to zimmerma:

David,

1) from the trac page, #22564 has been merged in 8.0, thus the difference I see should be due to subsequent changes

2) is there any reason why the order of the constraints was changed? It makes it difficult to add doctests for this example from our book about Sage

I changed the code 1) to split the graph into connected components and color them separately (should be faster), and 2) because I don't understand why we should use list comprehension for adding constraints. It was:

    #  A vertex can not have two incident edges with the same color.
    [p.add_constraint(
            p.sum([color[R(e),i] for e in g.edges_incident(v, labels=False)]), max=1)
                for v in g.vertex_iterator()
                    for i in range(k)]
    # an edge must have a color
    [p.add_constraint(p.sum([color[R(e),i] for i in range(k)]), max=1, min=1)
         for e in g.edge_iterator(labels=False)]
    # anything is good as an objective value as long as it is satisfiable
    e = next(g.edge_iterator(labels=False))
    p.set_objective(color[R(e),0])

Now it is:

    # A vertex can not have two incident edges with the same color.
    for v in h.vertex_iterator():
        for i in range(k):
            p.add_constraint(p.sum(color[R(u,v),i] for u in h.neighbor_iterator(v)) <= 1)
    # Nn edge must have a color
    for u,v in h.edge_iterator(labels=False):
        p.add_constraint(p.sum(color[R(u,v),i] for i in range(k)) == 1)
    # We color the edges of the vertex of maximum degree
    for i,v in enumerate(h.neighbors(X)):
        p.add_constraint( color[R(v,X),i] == 1 )

So the main changes are:

  • use of neighbor_iterator instead of edges_incident in the first set of constraints (it has always been assumed in this method that the graph is simple)
  • removal of the objective function (not needed)
  • now force the coloring of the edges incident to the vertex of maximum degree (could speed up the resolution).

In fact, I bet that changing the version of GLPK could already change the result (e.g., faster algorithm converging to a different optimal solution). Furthermore, I assume that some internal heuristics of the solvers are randomized since we can set random seed of Cplex.

comment:9 Changed 2 years ago by zimmerma

David, thank you for the explanation (by the way there is a typo: "Nn edge must have a color" should be "An edge...").

Since it seems impossible to have a reliable doctest for this example, we won't test it.

Last edited 10 months ago by zimmerma (previous) (diff)

comment:10 in reply to: ↑ description Changed 2 years ago by jdemeyer

Replying to zimmerma:

Sage already includes doctests for the original version of this book (published in french in 2013). These doctests are in src/sage/tests/french_book, and should be updated.

Didn't you mention at some point that you didn't care any more about these doctests? I seem to remember something along those lines...

comment:11 Changed 2 years ago by zimmerma

Jeroen,

what I said is that there were too many changes in Sage upstream (with respect to Sage 5.9 which we used in the french book in 2013) so that we could check them (and even, sometimes, we had no chance to give our opinion on them before they were merged into Sage). Those doctests nevertheless did they job since most of the examples still run with current versions of Sage.

Now that we have updated the book to Sage 8.0, we'd like to add the (new) doctests to Sage doctests, so that the new (english) version of the book will not be obsolete too quickly.

comment:12 follow-ups: Changed 2 years ago by zimmerma

Nicolas Thiery just tested the doctests of our book with Sage 8.1beta5 and several do fail (while all tests pass with Sage 8.0). Here are the issues:

1) the lil_matrix do not work any more. Cf the example on page 299 of the english translation:

  sage: from scipy.sparse.linalg.dsolve import *
  sage: from scipy.sparse import lil_matrix
  sage: from numpy import array
  sage: n = 200
  sage: n2 = n*n
  sage: A = lil_matrix((n2, n2))
  sage: h2 = 1./float((n+1)^2)
  sage: for i in range(0,n2):
  ....:    A[i,i]=4*h2+1.
  ....:    if i+1<n2: A[i,int(i+1)]=-h2
  ....:    if i>0:    A[i,int(i-1)]=-h2
  ....:    if i+n<n2: A[i,int(i+n)]=-h2
  ....:    if i-n>=0: A[i,int(i-n)]=-h2
  sage: Acsc = A.tocsc()
  sage: b = array([1 for i in range(0,n2)])
  sage: solve = factorized(Acsc) # LU factorisation
  sage: S = solve(b)             # resolution

Now if fails at the A = lil_matrix((n2, n2)) line with:

    TypeError: unrecognized lil_matrix constructor usage

Aren't lil_matrix tested in the current doctests?

2) the category of QQ changed:

Failed example:
    QQ.category()
Expected:
    Join of Category of quotient fields and Category of metric spaces
Got:
    Join of Category of number fields and Category of quotient fields and Category of metric spaces

3) we have different output for graphs of the commands minor and edge_coloring. We will try to fix those with solver='GLPK' (cf comment 6 above). If that does not work, is there a random seed that we can set to make those commands deterministic?

comment:13 in reply to: ↑ 12 ; follow-up: Changed 2 years ago by jdemeyer

Replying to zimmerma:

3) we have different output for graphs of the commands minor and edge_coloring. We will try to fix those with solver='GLPK' (cf comment 6 above). If that does not work, is there a random seed that we can set to make those commands deterministic?

Are these tests really non-deterministic or just different with different versions of Sage?

comment:14 in reply to: ↑ 12 ; follow-up: Changed 2 years ago by jdemeyer

Replying to zimmerma:

2) the category of QQ changed:

Failed example:
    QQ.category()
Expected:
    Join of Category of quotient fields and Category of metric spaces
Got:
    Join of Category of number fields and Category of quotient fields and Category of metric spaces

This is a good and intentional change: just change the expected output.

comment:15 in reply to: ↑ 12 Changed 2 years ago by jdemeyer

Replying to zimmerma:

Aren't lil_matrix tested in the current doctests?

lil_matrix is not used or tested anywhere in Sage. I'll have a look.

Last edited 2 years ago by jdemeyer (previous) (diff)

comment:16 Changed 2 years ago by mforets

1) the lil_matrix do not work any more.

a scipy update? in sage 8.0.beta5 the version is 0.19.1, while in 8.0 it is 0.17.1.

however, the docstring says it's still valid:

...
        lil_matrix((M, N), [dtype])
            to construct an empty matrix with shape (M, N)
            dtype is optional, defaulting to dtype='d'. 
Last edited 2 years ago by mforets (previous) (diff)

comment:17 Changed 2 years ago by jdemeyer

  • Description modified (diff)
  • Report Upstream changed from N/A to Reported upstream. No feedback yet.

comment:18 in reply to: ↑ 13 Changed 2 years ago by zimmerma

Replying to jdemeyer:

Replying to zimmerma:

3) we have different output for graphs of the commands minor and edge_coloring. We will try to fix those with solver='GLPK' (cf comment 6 above). If that does not work, is there a random seed that we can set to make those commands deterministic?

Are these tests really non-deterministic or just different with different versions of Sage?

no idea, I first asked Nicolas to test with solver='GLPK'.

comment:19 in reply to: ↑ 14 ; follow-up: Changed 2 years ago by zimmerma

Replying to jdemeyer:

Replying to zimmerma:

2) the category of QQ changed:

Failed example:
    QQ.category()
Expected:
    Join of Category of quotient fields and Category of metric spaces
Got:
    Join of Category of number fields and Category of quotient fields and Category of metric spaces

This is a good and intentional change: just change the expected output.

this is not possible, since we currently use Sage 8.0 for the book, and this will make the doctests fail with 8.0.

comment:20 in reply to: ↑ 19 Changed 2 years ago by jdemeyer

Replying to zimmerma:

this is not possible, since we currently use Sage 8.0 for the book, and this will make the doctests fail with 8.0.

Is there any particular reason that you focus on 8.0? Given that the book is still in preparation, you could use Sage 8.1 instead.

comment:21 Changed 2 years ago by jdemeyer

  • Description modified (diff)

comment:22 Changed 2 years ago by jdemeyer

  • Description modified (diff)

comment:23 Changed 2 years ago by jdemeyer

I opened #23867 for the lil_matrix() issue.

comment:24 follow-up: Changed 2 years ago by jdemeyer

General comment: all the doctests in the book which return types will change in Python 3. Python 2 uses <type 'int'> while Python 3 uses <class 'int'>.

comment:25 in reply to: ↑ 24 Changed 2 years ago by zimmerma

Replying to jdemeyer:

General comment: all the doctests in the book which return types will change in Python 3. Python 2 uses <type 'int'> while Python 3 uses <class 'int'>.

thanks Jeroen. Alas, there is nothing we can do for that, just wait for Python 3 and update.

comment:26 follow-up: Changed 2 years ago by jdemeyer

For Sage doctests, you should write <... 'int'> instead of <type 'int'>.

comment:27 Changed 2 years ago by zimmerma

good idea! I will do that change in the doctests.

comment:28 in reply to: ↑ 26 Changed 17 months ago by embray

Replying to jdemeyer:

For Sage doctests, you should write <... 'int'> instead of <type 'int'>.

This actually isn't necessary; the doctest parser already accounts for this minor difference.

comment:29 Changed 17 months ago by embray

  • Owner changed from (none) to embray

I can take this over.

comment:30 Changed 14 months ago by embray

  • Milestone changed from sage-8.1 to sage-8.4
  • Priority changed from major to critical

Getting this done ASAP before 8.4 is out is pretty important, especially to make sure there's enough time to fix any failures that might still be lingering.

comment:31 Changed 14 months ago by embray

  • Authors set to Erik Bray
  • Branch set to u/embray/ticket-23572
  • Commit set to 7f3490eba3cd65e5a3e90580cd8d040a04040bc8

Current versions of the examples/exercises. There are still about half a dozen test failures, all of which are insubstantial and most of which stem from #25247, but will still need to be fixed. The question is whether to fix them in the book, in the test suite, or both.

For one of them I'm getting a deprecation warning from scipy that we should probably heed:

sage -t --long src/sage/tests/books/sagebook/linsolve_doctest.py
**********************************************************************
File "src/sage/tests/books/sagebook/linsolve_doctest.py", line 385, in sage.tests.books.sagebook.linsolve_doctest
Failed example:
    x = cg(A, b, M = msc, tol=1.e-8)
Expected nothing
Got:
    doctest:warning
    ...
    :
    DeprecationWarning: scipy.sparse.linalg.cg called without specifying `atol`. The default value will be changed in a future release. For compatibility, specify a value for `atol` explicitly, e.g., ``cg(..., atol=0)``, or to retain the old behavior ``cg(..., atol='legacy')``

New commits:

7f3490ereplace sage/tests/french_book with sage/tests/books/sagebook, containing

comment:32 Changed 14 months ago by embray

  • Status changed from new to needs_info

comment:33 Changed 14 months ago by zimmerma

Erik,

1) the examples of the book are now updated to Sage 8.3, and all examples pass with Sage 8.3

2) about the conjugate gradient failure, there is no atol option in Sage 8.3, only tol, and using atol=0 or atol='legacy' gives an error in Sage 8.3:

sage: x = cg(A, b, M = msc, tol=1.e-8, atol=0)       
...
TypeError: cg() got an unexpected keyword argument 'atol'

The only solution I see is to ignore this warning in the doctests. How can we do this?

comment:34 Changed 14 months ago by embray

I'm not sure what to do about this--I don't recall what version of scipy is included by default with Sage 8.3, but in 8.4.beta5 it's now scipy 1.1.0, which wants you to specify atol.

I could have the test ignore that warning, but it would be better to just include a fixed version of that example in Sage. The question is hhether to update the example in the book as well, or to just manually edit that one test in the copy included in the Sage tests.

comment:35 Changed 14 months ago by embray

Either way it would require manually modifying the test module.

comment:36 Changed 14 months ago by zimmerma

We can't change the example in the book since it should work with Sage 8.3.

I suggest you modify the doctest in the Sage distribution, by adding atol='legacy'.

This should solve this issue.

comment:37 follow-up: Changed 14 months ago by embray

So, to answer the more general question, if there are any examples from the book that no longer work exactly on Sage 8.4, I should copy them from the book as-is, and then only modify the copies that are added to Sage by this ticket?

I ask because if any of the examples need to be modified, one will eventually want to get them back into the book for a future version.

comment:38 in reply to: ↑ 37 Changed 14 months ago by zimmerma

Replying to embray:

So, to answer the more general question, if there are any examples from the book that no longer work exactly on Sage 8.4, I should copy them from the book as-is, and then only modify the copies that are added to Sage by this ticket?

yes. But please tell me of any such examples. Maybe we can still modify them in the book so that they work both for 8.3 and 8.4 (this is unfortunately not possible for the atol issue above).

comment:39 Changed 14 months ago by embray

Perhaps I'll just create a branch on the book repo for now to add any relevant updates.

comment:40 Changed 14 months ago by embray

For completeness, these are the current failures I get against 8.4.beta6:

sage -t src/sage/tests/books/sagebook/integration_doctest.py
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 109, in sage.tests.books.sagebook.integration_doctest
Failed example:
    gp('intnum(x=0, 1, x^(-99/100))') # abs tol 1e-16
Expected:
    73.62914262423378365
Got:
    73.629142624233783843668417691077783339
Tolerance exceeded:
    73.62914262423378365 vs 73.629142624233783843668417691077783339, tolerance 2e-16 > 1e-16
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 119, in sage.tests.books.sagebook.integration_doctest
Failed example:
    gp('intnum(x=[0, -1/42], 1, x^(-99/100))') # abs tol 1e-16
Expected:
    74.47274932028288503
Got:
    74.472749320282885192304428135608736736
Tolerance exceeded:
    74.47274932028288503 vs 74.472749320282885192304428135608736736, tolerance 2e-16 > 1e-16
**********************************************************************
1 item had failures:
   2 of  87 in sage.tests.books.sagebook.integration_doctest
    [86 tests, 2 failures, 23.25 s]
sage -t src/sage/tests/books/sagebook/polynomes_doctest.py
**********************************************************************
File "src/sage/tests/books/sagebook/polynomes_doctest.py", line 240, in sage.tests.books.sagebook.polynomes_doctest
Failed example:
    r.reduce(); r
Expected:
    1.00000000000000/(-x + 1.00000000000000)
Got:
    -1.00000000000000/(x - 1.00000000000000)
**********************************************************************
1 item had failures:
   1 of 111 in sage.tests.books.sagebook.polynomes_doctest
    [110 tests, 1 failure, 2.23 s]
sage -t src/sage/tests/books/sagebook/sol/integration_doctest.py
**********************************************************************
File "src/sage/tests/books/sagebook/sol/integration_doctest.py", line 39, in sage.tests.books.sagebook.sol.integration_doctest
Failed example:
    N(QuadNC(lambda x: x * log(1+x), 0, 1, 19)) # abs tol 1e-15
Expected:
    0.250000000000001
Got:
    0.249999999999999
Tolerance exceeded:
    0.250000000000001 vs 0.249999999999999, tolerance 2e-15 > 1e-15
File "src/sage/tests/books/sagebook/numbertheory_doctest.py", line 34, in sage.tests.books.sagebook.numbertheory_doctest
Failed example:
    1/a
Expected:
    Traceback (most recent call last):
      ...
    ZeroDivisionError: Inverse does not exist.
Got:
    <BLANKLINE>
    Traceback (most recent call last):
...
    ZeroDivisionError: inverse of Mod(3, 15) does not exist

Most of them seem to be caused by slight changes in PARI, though I'm not sure about the one with polynomes; obviously it's just choosing for some reason not to distribute the minus sign.

The last one is because the old exception message was slightly enhanced.

comment:41 follow-up: Changed 14 months ago by zimmerma

Erik, I fixed the error tolerances in the book. Please could you check again?

For the failure in polynomes, is there a way in the doctests to check we get one of both outputs?

For the numbertheory failure, it is unfortunate the error message did change. Is there a way to check for "ZeroDivisionError?: ... does not exist" in the doctest?

comment:42 in reply to: ↑ 41 Changed 14 months ago by embray

Replying to zimmerma:

Erik, I fixed the error tolerances in the book. Please could you check again?

I will double check, but yesterday I pulled down the latest version of the book, rebuilt it, and re-copied the files. I can try doing it one more time, perhaps with with a clean of the repository first...

For the failure in polynomes, is there a way in the doctests to check we get one of both outputs?

Theoretically you could check for both, but it would make for a rather ugly test like:

sage: repr(r) in ['1.00000000000000/(-x + 1.00000000000000)', '-1.00000000000000/(x - 1.00000000000000)']
True

Rather than checking for one of both it would be better to simply check the result by value like:

sage: r == -1.0/(x - 1.0)

or something like that. There might also be a way to normalize it; I'll take a close look.

For the numbertheory failure, it is unfortunate the error message did change. Is there a way to check for "ZeroDivisionError?: ... does not exist" in the doctest?

I don't think it's that "unfortunate". It did change for the better, and in 8.4, whereas I had thought the book was still aiming specifically at 8.3. While having these tests in the Sage test suite is an important way to keep track of how our changes impact real use cases, it should not block useful changes that happen to deviate from the book (especially in trivial ways).

I don't see any point in changing the doctest in Sage to be less specific. If you want to change it in the book, ZeroDivisionEror: ...does not exist would work, but is maybe a bit ugly and uninformative...?

comment:43 follow-up: Changed 14 months ago by zimmerma

Erik,

for the "polynomes" failure, I have added the doctest you suggest with repr (the second one you propose also works before r.reduce(), thus is not enough).

For the "numbertheory" failure, I have added "test=false", so this example is not tested any more.

All doctests still work with Sage 8.3.

Please could you check they all work with 8.4beta6?

Thank you.

comment:44 in reply to: ↑ 43 Changed 14 months ago by galois

Replying to zimmerma:

Erik,

for the "polynomes" failure, I have added the doctest you suggest with repr (the second one you propose also works before r.reduce(), thus is not enough).

I really wouldn't.... My whole point was it was not a good test, and even worse as an example in a book. Let me see if there is a better way to write this example; I just haven't tried yet.

For the "numbertheory" failure, I have added "test=false", so this example is not tested any more.

All doctests still work with Sage 8.3.

Please could you check they all work with 8.4beta6?

That's what I'm currently testing against...

comment:45 Changed 14 months ago by embray

Sorry, the above was me. Forgot I was still logged in as my bot :)

comment:46 Changed 14 months ago by embray

Okay, I double-checked and as I suspected I am up to date with the book files, and still get slight floating point difference in the tests I mentioned previously. I wonder if there has been a PARI or Cypari update since 8.3.

Anyways, this diff is all I need for the tests to pass:

  • src/sage/tests/books/sagebook/integration_doctest.py

    diff --git a/src/sage/tests/books/sagebook/integration_doctest.py b/src/sage/tests/books/sagebook/integration_doctest.py
    index 4f2699c..1a7c610 100644
    a b Sage example in ./integration.tex, line 717:: 
    106106Sage example in ./integration.tex, line 745::
    107107
    108108  sage: p = gp.set_precision(old_prec) # we reset the default precision
    109   sage: gp('intnum(x=0, 1, x^(-99/100))') # abs tol 1e-16
     109  sage: gp('intnum(x=0, 1, x^(-99/100))') # abs tol 2e-16
    110110  73.62914262423378365
    111111
    112112Sage example in ./integration.tex, line 753::
    Sage example in ./integration.tex, line 753:: 
    116116
    117117Sage example in ./integration.tex, line 764::
    118118
    119   sage: gp('intnum(x=[0, -1/42], 1, x^(-99/100))') # abs tol 1e-16
     119  sage: gp('intnum(x=[0, -1/42], 1, x^(-99/100))') # abs tol 2e-16
    120120  74.47274932028288503
    121121
    122122Sage example in ./integration.tex, line 783::
  • src/sage/tests/books/sagebook/linsolve_doctest.py

    diff --git a/src/sage/tests/books/sagebook/linsolve_doctest.py b/src/sage/tests/books/sagebook/linsolve_doctest.py
    index 552bfc2..812b6b7 100644
    a b Sage example in ./linsolve.tex, line 2721:: 
    382382  ....:     m[i,i] = 1./A[i,i]
    383383  sage: msc = m.tocsc()
    384384  sage: from scipy.sparse.linalg import cg
    385   sage: x = cg(A, b, M = msc, tol=1.e-8)
     385  sage: x = cg(A, b, M=msc, atol=1.e-8)
    386386
    387387Sage example in ./linsolve.tex, line 2782::
    388388
  • src/sage/tests/books/sagebook/numbertheory_doctest.py

    diff --git a/src/sage/tests/books/sagebook/numbertheory_doctest.py b/src/sage/tests/books/sagebook/numbertheory_doctest.py
    index cb8e331..09b291d 100644
    a b Sage example in ./numbertheory.tex, line 174:: 
    3434  sage: 1/a
    3535  Traceback (most recent call last):
    3636    ...
    37   ZeroDivisionError: Inverse does not exist.
     37  ZeroDivisionError: inverse of Mod(3, 15) does not exist
    3838
    3939Sage example in ./numbertheory.tex, line 199::
    4040
  • src/sage/tests/books/sagebook/polynomes_doctest.py

    diff --git a/src/sage/tests/books/sagebook/polynomes_doctest.py b/src/sage/tests/books/sagebook/polynomes_doctest.py
    index 926922d..77ba536 100644
    a b Sage example in ./polynomes.tex, line 1399:: 
    238238Sage example in ./polynomes.tex, line 1411::
    239239
    240240  sage: r.reduce(); r
    241   1.00000000000000/(-x + 1.00000000000000)
     241  -1.00000000000000/(x - 1.00000000000000)
    242242
    243243Sage example in ./polynomes.tex, line 1487::
    244244
  • src/sage/tests/books/sagebook/sol/integration_doctest.py

    diff --git a/src/sage/tests/books/sagebook/sol/integration_doctest.py b/src/sage/tests/books/sagebook/sol/integration_doctest.py
    index 518dcc9..b2c2e68 100644
    a b Sage example in ./sol/integration.tex, line 58:: 
    3636
    3737  sage: numerical_integral(x * log(1+x), 0, 1)
    3838  (0.25, 2.7755575615628914e-15)
    39   sage: N(QuadNC(lambda x: x * log(1+x), 0, 1, 19)) # abs tol 1e-15
     39  sage: N(QuadNC(lambda x: x * log(1+x), 0, 1, 19)) # abs tol 2e-15
    4040  0.250000000000001
    4141  sage: numerical_integral(sqrt(1-x^2), 0, 1)
    4242  (0.785398167726482..., 9.042725224567119...e-07)

I still think the best thing to do is to apply that just in the sage doctests, and then duplicate it to a branch in the book for future updates.

Last edited 14 months ago by embray (previous) (diff)

comment:47 follow-up: Changed 14 months ago by zimmerma

Erik, the abs tol changes were already applied in the book sources, thus you should not need them any more.

As I told before, we cannot apply the atol change since the example would not work any more with Sage 8.3, which is the version we use in the book (and the latest release at that time). I have just added test=false to that example, thus it should not appear any more in the doctests.

For the numbertheory issue, I have also put test=false in the book sources, thus it should no longer be tested.

And finally for the polynomes issue, I have replaced the test by the one using repr(r) that you suggested (in silent mode).

In summary, if you regenerate the doctests with revision 739453a of the book sources, all doctests should pass with both 8.3 and 8.4beta. Please can you confirm?

comment:48 in reply to: ↑ 47 Changed 14 months ago by embray

Replying to zimmerma:

Erik, the abs tol changes were already applied in the book sources, thus you should not need them any more.

Ok. I see you did that yesterday, after I already double-checked.

As I told before, we cannot apply the atol change since the example would not work any more with Sage 8.3, which is the version we use in the book (and the latest release at that time). I have just added test=false to that example, thus it should not appear any more in the doctests.

If you say so. My point is just that it's a test that can work fine when modified. Perhaps it's not worth testing though since it's just a scipy function.

For the numbertheory issue, I have also put test=false in the book sources, thus it should no longer be tested.

And finally for the polynomes issue, I have replaced the test by the one using repr(r) that you suggested (in silent mode).

That helps, but I still don't think it's a good way to test this.

comment:49 Changed 14 months ago by embray

I guess, my point is, if there's a [silent] copy of that test in the book source, solely for the purpose of generating doctests to into Sage's test suite, then it might as well just be the version of the test that works on Sage 8.4. There's no reason at all for it to work on 8.3.

comment:50 Changed 14 months ago by embray

To be clear, the result here should be deterministic. Looking at the diffs, there was some work done in this area recently.

comment:51 Changed 14 months ago by git

  • Commit changed from 7f3490eba3cd65e5a3e90580cd8d040a04040bc8 to d8014819b4a93c41c5ef0cdd73a8851b11806a07

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

d801481replace sage/tests/french_book with sage/tests/books/sagebook, containing

comment:52 Changed 14 months ago by embray

  • Status changed from needs_info to needs_review

Well, I went ahead and updated this from the latest version of the book, and now all tests pass, so let's just go with it. I am still confused, Paul, about what exactly your long-term intentions are w.r.t. keeping the book+sage+doctests all in sync. But this is good enough for now.

Volker, if we could have this merged in 8.4 that would be ideal. If for some reason it has to wait, I will do my best to ensure that these tests are still passing (which shouldn't be the problem, as I believe the time has passed for non-critical changes to 8.4), but it should definitely be merged first thing after 8.4 is released, if not before.

comment:53 follow-up: Changed 13 months ago by zimmerma

sorry for the delay, I was busy with the book itself.

Erik, the goal of including this into Sage is that people changing the behavior of Sage know when they break examples in the french book, which is the same I guess for other stuff in sage/tests.

It would be nice if someone could review that ticket (as author of the book, I feel in conflict of interest).

comment:54 in reply to: ↑ 53 ; follow-up: Changed 13 months ago by embray

Replying to zimmerma:

sorry for the delay, I was busy with the book itself.

Erik, the goal of including this into Sage is that people changing the behavior of Sage know when they break examples in the french book, which is the same I guess for other stuff in sage/tests.

I understand that obviously, and that wasn't my question. My question is to what extent do you expect Sage development to conform to the examples in the book and for how long; and what is your goal for handling cases where changes to Sage do necessarily break examples from the book? As we saw from moving from 8.3 to 8.4 there were changes that "broke" the examples, albeit usually in mostly trivial ways, but that were changes for the better that should not have been held back just because it would have caused some differences from published books.

IIUC the goal here is to just conform with the version of Sage that the book claims to conform to. But if the book needs to be updated in the future the question is how to go about that.

comment:55 follow-up: Changed 13 months ago by chapoton

Maybe the book should avoid using ".next()", "<>", "xrange" and ".iteritems", no ??

See the patchbot plugins for the long list of python3 incompatibilities...

comment:56 in reply to: ↑ 55 ; follow-up: Changed 13 months ago by zimmerma

Replying to chapoton:

Maybe the book should avoid using ".next()", "<>", "xrange" and ".iteritems", no ??

See the patchbot plugins for the long list of python3 incompatibilities...

sorry, this is too late. The book is now in press. Maybe for the next edition?

comment:57 in reply to: ↑ 54 Changed 13 months ago by zimmerma

Erik,

[...]

I understand that obviously, and that wasn't my question. My question is to what extent do you expect Sage development to conform to the examples in the book and for how long; and what is your goal for handling cases where changes to Sage do necessarily break examples from the book? As we saw from moving from 8.3 to 8.4 there were changes that "broke" the examples, albeit usually in mostly trivial ways, but that were changes for the better that should not have been held back just because it would have caused some differences from published books.

IIUC the goal here is to just conform with the version of Sage that the book claims to conform to. But if the book needs to be updated in the future the question is how to go about that.

the Sage developers will decide what is best, like they did in the past, between changing the behavior of Sage and breaking examples from published material. I cannot decide for them to what extent or how long.

The goal is (1) to inform the Sage developers about published material that they could break, and (2) to inform the authors of the book (by adding them in cc of the corresponding tickets) when changes are made that break some examples. In case (2) we will then discuss together case-by-case, and maybe it will be an opportunity to improve the examples in the book.

comment:58 in reply to: ↑ 56 Changed 13 months ago by chapoton

Replying to zimmerma:

Replying to chapoton:

Maybe the book should avoid using ".next()", "<>", "xrange" and ".iteritems", no ??

See the patchbot plugins for the long list of python3 incompatibilities...

sorry, this is too late. The book is now in press. Maybe for the next edition?

Ok. But my point is that we are not going to accept here and now any doctest that does not pass on python3.

comment:59 follow-up: Changed 13 months ago by zimmerma

  • Cc nthiery added

Ok. But my point is that we are not going to accept here and now any doctest that does not pass on python3.

Nicolas (which I added in cc) checked some time ago with Python3, and if I recall correctly, all tests did pass. Nicolas please can you confirm?

comment:60 Changed 13 months ago by chapoton

Many doctests are not passing with python3. Among them, some (a lot) are not your fault, just failing because sage is not yet fully ready to run with python3.

But many are caused by bad doctests in the books : use of .next, use of <>, use of xrange, etc

For example, every doctest starting with map must be wrapped with list(map(..)):

Failed example:
    map (cos, [0, pi/6, pi/4, pi/3, pi/2])
Expected:
    [1, 1/2*sqrt(3), 1/2*sqrt(2), 1/2, 0]
Got:
    <map object at 0x7f1c2dd9cf28>

An example for xrange:

File "src/sage/tests/books/sagebook/integration_doctest.py", line 36, in sage.tests.books.sagebook.integration_doctest
Failed example:
    interp_points = [(1+2*u/(n-1), N(f(1+2*u/(n-1))))
                     for u in xrange(n)]
Exception raised:
    Traceback (most recent call last):
      File "/home/chapoton/sage3/local/lib/python3.6/site-packages/sage/doctest/forker.py", line 659, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/chapoton/sage3/local/lib/python3.6/site-packages/sage/doctest/forker.py", line 1070, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.tests.books.sagebook.integration_doctest[7]>", line 2, in <module>
        for u in xrange(n)]
    NameError: name 'xrange' is not defined

And the global test result:

sage -t --long --warn-long src/sage/tests/books/sagebook/combinat_doctest.py  # 25 doctests failed
sage -t --long --warn-long src/sage/tests/books/sagebook/float_doctest.py  # 3 doctests failed
sage -t --long --warn-long src/sage/tests/books/sagebook/graphique_doctest.py  # 1 doctest failed
sage -t --long --warn-long src/sage/tests/books/sagebook/graphtheory_doctest.py  # 11 doctests failed
sage -t --long --warn-long src/sage/tests/books/sagebook/lp_doctest.py  # 1 doctest failed
sage -t --long --warn-long src/sage/tests/books/sagebook/mpoly_doctest.py  # 19 doctests failed
sage -t --long --warn-long src/sage/tests/books/sagebook/programmation_doctest.py  # 23 doctests failed
sage -t --long --warn-long src/sage/tests/books/sagebook/nonlinear_doctest.py  # 24 doctests failed
sage -t --long --warn-long src/sage/tests/books/sagebook/linsolve_doctest.py  # 2 doctests failed
sage -t --long --warn-long src/sage/tests/books/sagebook/polynomes_doctest.py  # 1 doctest failed
sage -t --long --warn-long src/sage/tests/books/sagebook/integration_doctest.py  # 5 doctests failed
sage -t --long --warn-long src/sage/tests/books/sagebook/sol/combinat_doctest.py  # 1 doctest failed
sage -t --long --warn-long src/sage/tests/books/sagebook/sol/graphique_doctest.py  # 2 doctests failed
sage -t --long --warn-long src/sage/tests/books/sagebook/sol/graphtheory_doctest.py  # 1 doctest failed
sage -t --long --warn-long src/sage/tests/books/sagebook/sol/mpoly_doctest.py  # 6 doctests failed
sage -t --long --warn-long src/sage/tests/books/sagebook/sol/nonlinear_doctest.py  # 2 doctests failed
sage -t --long --warn-long src/sage/tests/books/sagebook/sol/numbertheory_doctest.py  # 11 doctests failed
sage -t --long --warn-long src/sage/tests/books/sagebook/sol/polynomes_doctest.py  # 4 doctests failed
sage -t --long --warn-long src/sage/tests/books/sagebook/sol/integration_doctest.py  # 6 doctests failed

comment:61 Changed 13 months ago by vklein

  • Cc vklein added

comment:62 in reply to: ↑ 59 Changed 13 months ago by nthiery

Replying to zimmerma:

Ok. But my point is that we are not going to accept here and now any doctest that does not pass on python3.

Nicolas (which I added in cc) checked some time ago with Python3, and if I recall correctly, all tests did pass. Nicolas please can you confirm?

More precisely: I had checked with Python 2 together with from future imports (print_statements, division, absolute_import); this does not cover all Python3 incompatibilities.

comment:63 follow-up: Changed 13 months ago by chapoton

Because we are now (painfully) trying to make all doctests pass with python3, this ticket will only be accepted with the necessary changes that make all or most of its doctests pass with python3. I am sorry that this forces some differences with the fresh new book.

On the other hand, I am surprised that this book for example still uses (and maybe even recommends using) <>, which is known since along time to be deprecated.

comment:64 in reply to: ↑ 63 Changed 13 months ago by zimmerma

Replying to chapoton:

Because we are now (painfully) trying to make all doctests pass with python3, this ticket will only be accepted with the necessary changes that make all or most of its doctests pass with python3. I am sorry that this forces some differences with the fresh new book.

this ticket would make no sense any more, if not checking the examples from the book.

We are in a dead end. I see no solution.

comment:65 follow-up: Changed 13 months ago by jdemeyer

But couldn't you adapt the examples in the book to make them Python 3 compatible?

comment:66 Changed 13 months ago by embray

  • Milestone changed from sage-8.4 to sage-8.5

comment:67 in reply to: ↑ 65 Changed 13 months ago by embray

Replying to jdemeyer:

But couldn't you adapt the examples in the book to make them Python 3 compatible?

As Paul already demonstrated to me while working on this ticket earlier, the tex markup for the book is already such that it's possible to have multiple copies of a given example: One that is actually shown in the book, but excluded from the tests, and one that is hidden from the text but included in the generated doctests. So we could easily do that for the examples that are currently not Python 3 compatible.

Or, more simply, for now I could just modify the copies of the examples included in Sage to be Python 3 compatible. Most, if not all of these changes do not change the substance of the example, but rather are minor syntactic and spelling changes, mostly to do with Python itself (and not anything Sage-specific).

comment:68 Changed 13 months ago by chapoton

  • Branch changed from u/embray/ticket-23572 to public/french_book_python3
  • Commit changed from d8014819b4a93c41c5ef0cdd73a8851b11806a07 to b15724091409b162560c8eadfe9886b9b7ce24ee

Here is a branch with some tests modified to be compatible with python3.

Work in progress.


New commits:

5bc5344Merge branch 'u/embray/ticket-23572' in 8.5.b2
b157240python3 compatibility of doctests

comment:69 Changed 13 months ago by git

  • Commit changed from b15724091409b162560c8eadfe9886b9b7ce24ee to 9bd7f8f5f3227b8d62e12c19443d84b88050dd7e

Branch pushed to git repo; I updated commit sha1. New commits:

9bd7f8fmore py3 fixes

comment:70 Changed 13 months ago by git

  • Commit changed from 9bd7f8f5f3227b8d62e12c19443d84b88050dd7e to 0a09136c26c89ac5f82c4bc28d77c74e80c5ab68

Branch pushed to git repo; I updated commit sha1. New commits:

0a09136even more py3 fixes

comment:71 Changed 13 months ago by embray

For the ones involving reduce that you marked # py2, instead you could import reduce from functools.

In fact, I always found it annoying that Guido took reduce out of the built-ins. I think for Sage on Python 3, in order to maintain compatibility, we should add reduce back in as a default global.

Frédéric, could you add a new ticket to do that, and drop the # py2 stuff from this ticket and make this a dependency on the reduce one? Then squash the the Python 3 fixes you added into a single commit (to make it a bit more manageable). After that's done we should set this positive_review.

As I suspected, none of the Python 3 fixes for these tests materially impact the tests in any semantically meaningful way.

comment:72 Changed 13 months ago by embray

  • Status changed from needs_review to needs_work
  • Work issues set to support `reduce` as a global in Python 3

comment:73 Changed 13 months ago by git

  • Commit changed from 0a09136c26c89ac5f82c4bc28d77c74e80c5ab68 to ec5b502d1e7b20bdc3eedb11e9c4d5ed1eebfc9c

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

ec5b502python3 compatibility of doctests

comment:74 Changed 13 months ago by chapoton

  • Dependencies set to #26656
  • Status changed from needs_work to needs_review

done

comment:75 Changed 13 months ago by git

  • Commit changed from ec5b502d1e7b20bdc3eedb11e9c4d5ed1eebfc9c to faa2a2e5ab4fbb9ba3642285c03caec06402390c

Branch pushed to git repo; I updated commit sha1. New commits:

faa2a2etrac 23572 book: more py3 doctests fixed

comment:76 Changed 12 months ago by embray

  • Reviewers set to Erik Bray
  • Status changed from needs_review to positive_review

comment:77 Changed 12 months ago by chapoton

sorry, but I am not sure that the doctests do pass, as the patchbot has reported something strange. And they certainly do not all pass with python3..

comment:78 Changed 12 months ago by embray

  • Status changed from positive_review to needs_work

Well, please have a look then, because this looks related to some of the python 3 fixes you added (strangely). I also assumed when you wrote "done" you had squashed the python 3 fixes--which you did--but it seems you've added more.

comment:79 Changed 12 months ago by embray

  • Owner changed from embray to chapoton

comment:80 Changed 12 months ago by git

  • Commit changed from faa2a2e5ab4fbb9ba3642285c03caec06402390c to a4a22ae97f3ea60cf8e61478aecf8379f83be5c1

Branch pushed to git repo; I updated commit sha1. New commits:

a4a22aetrac 23572 fix doctest failing because book was moved

comment:81 Changed 12 months ago by chapoton

  • Status changed from needs_work to needs_review

comment:82 Changed 12 months ago by chapoton

  • Status changed from needs_review to needs_work

red branch

comment:83 Changed 12 months ago by git

  • Commit changed from a4a22ae97f3ea60cf8e61478aecf8379f83be5c1 to 6d8f188bb44969dbdab282109070a8bf6f25667e

Branch pushed to git repo; I updated commit sha1. New commits:

6d8f188Merge branch 'public/french_book_python3' in 8.5.b3

comment:84 Changed 12 months ago by chapoton

  • Status changed from needs_work to needs_review

rebased


New commits:

6d8f188Merge branch 'public/french_book_python3' in 8.5.b3

New commits:

6d8f188Merge branch 'public/french_book_python3' in 8.5.b3

comment:85 Changed 12 months ago by embray

Why this change?

  • src/sage/tests/books/sagebook/combinat_doctest.py

    diff --git a/src/sage/tests/books/sagebook/combinat_doctest.py b/src/sage/tests/books/sagebook/combinat_doctest.py
    index 2192fe6..40a0aa1 100644
    a b Sage example in ./combinat.tex, line 1895:: 
    590590Sage example in ./combinat.tex, line 1909::
    591591
    592592  sage: cubes = [t**3 for t in range(-999,1000)]
    593   sage: exists([(x,y) for x in cubes for y in cubes], lambda x,y: x+y == 218) # long
     593  sage: exists([(x,y) for x in cubes for y in cubes], lambda xy: sum(xy) == 218) # long
    594594  (True, (-125, 343))
    595   sage: exists(((x,y) for x in cubes for y in cubes), lambda x,y: x+y == 218) # long
     595  sage: exists(((x,y) for x in cubes for y in cubes), lambda xy: sum(xy) == 218) # long
    596596  (True, (-125, 343))
    597597
    598598Sage example in ./combinat.tex, line 1927::

That doesn't look necessary...?

This one also looks like a more substantive change than it should be:

  • src/sage/tests/books/sagebook/graphtheory_doctest.py

    diff --git a/src/sage/tests/books/sagebook/graphtheory_doctest.py b/src/sage/tests/books/sagebook/graphtheory_doctest.py
    index c60c4a8..f64f416 100644
    a b Sage example in ./graphtheory.tex, line 2070:: 
    360360
    361361Sage example in ./graphtheory.tex, line 2084::
    362362
    363   sage: G.independent_set()
    364   [4, 6, 9, 11, 16, 21, 23, 26, 28, 33, 38, 43, 50,
    365   56, 61, 71, 76, 78, 83, 88, 93, 95, 98, 100]
     363  sage: X = G.independent_set(); G.is_independent_set(X)
     364  True
    366365
    367366Sage example in ./graphtheory.tex, line 2139::

If it happens that on Python 3 a different independent set is returned that's fine, but then we should mark that line # random and add the G.is_independent_set(X) test on a separate line.

I can fix the latter. But for the prior I wanted to check with you why the change was made since AFAICT there's no reason for it.

comment:86 Changed 12 months ago by chapoton

With python3:

sage: cubes = [t**3 for t in range(-999,1000)]
sage: exists([(x,y) for x in cubes for y in cubes], lambda xy: sum(xy) == 218) 
(True, (-125, 343))
sage: exists([(x,y) for x in cubes for y in cubes], lambda x,y: x+y == 218)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-ea62578e4e4d> in <module>()
----> 1 exists([(x,y) for x in cubes for y in cubes], lambda x,y: x+y == Integer(218))

/home/chapoton/sage3/local/lib/python3.6/site-packages/sage/misc/misc.py in exists(S, P)
   1389     """
   1390     for x in S:
-> 1391         if P(x):
   1392             return True, x
   1393     return False, None

TypeError: <lambda>() missing 1 required positional argument: 'y'

comment:87 Changed 12 months ago by git

  • Commit changed from 6d8f188bb44969dbdab282109070a8bf6f25667e to b32170fe754f9293b8c7324414511c61f12ce64b

Branch pushed to git repo; I updated commit sha1. New commits:

4a316cfMerge branch 'public/french_book_python3' in 8.5.b4
b32170freviewer suggestion about independent set test

comment:88 Changed 12 months ago by chapoton

The suggested change for independent set is done. The other suggestion is not right, see above.

comment:89 Changed 12 months ago by embray

Why did sage.misc.misc.exists change/break? It looks like it used to be able to accept a list of tuples and now it can't?

comment:90 follow-up: Changed 12 months ago by chapoton

nothing has changed, the "exists" failing doctests also fail with python2.

comment:91 Changed 12 months ago by chapoton

anybody out there ?

comment:92 in reply to: ↑ 90 ; follow-up: Changed 12 months ago by embray

Replying to chapoton:

nothing has changed, the "exists" failing doctests also fail with python2.

I understand that's not a Python 3 specific thing, but something must have changed in Sage since the 8.4 release since that test didn't fail before...or did it? Was there some reason it wasn't being run?

comment:93 in reply to: ↑ 92 Changed 12 months ago by embray

Replying to embray:

Replying to chapoton:

nothing has changed, the "exists" failing doctests also fail with python2.

I understand that's not a Python 3 specific thing, but something must have changed in Sage since the 8.4 release since that test didn't fail before...or did it? Was there some reason it wasn't being run?

Well, AFAICT, it really hasn't changed at all recently. So I wonder how that test ever passed, unless it was never being run at all...

comment:94 Changed 12 months ago by embray

Ah, I see now. In the original test it used lambda (x,y):, which actually gets parsed as tuple unpacking in the function signature (e.g. same as def f((x, y)):) which was dropped in Python 3. That's very subtle since in the lambda context it's less clear that that's what's going on (perhaps at least part of why it was dropped).

Okay.

comment:95 Changed 12 months ago by chapoton

So ? Can we move on ? Paul, what do you think ?

comment:96 Changed 12 months ago by zimmerma

So ? Can we move on ? Paul, what do you think ?

as I said in comment 64, this ticket has diverged from the book (now in print), thus I am no longer motivated to work on it.

comment:97 Changed 12 months ago by chapoton

Bonjour Paul.

Est-ce que ça veut dire qu'on peut valider ce ticket ? D'une certaine façon, les doctests sont ceux du livre, juste modifiés minimalement pour être valides sous python 3.

Je suis désolé que ça complique la relation avec le livre. C'est vraiment dommage que le livre ne soit pas compatible avec python 3.

comment:98 Changed 12 months ago by zimmerma

yes please go on, after modifying the description to reflect the fact that these doctests are not exactly those from the book

comment:99 Changed 12 months ago by chapoton

  • Description modified (diff)

I modified the ticket description. Needs review. Erik ?

comment:100 Changed 11 months ago by embray

  • Status changed from needs_review to positive_review

comment:101 Changed 11 months ago by embray

The alternative, I suppose, would be to provide some way to just completely skip those tests on Python 3. In a way, that might have been better. Of course they were not written with Python 3 in mind: The book was not either, as Sage does not support Python 3 yet. But I agree with Frédéric that the translation required for running these tests on Python 3 is also trivial, and so they are still serving their intended purpose of noting changes to Sage that would invalidate the book's examples.

comment:102 Changed 11 months ago by jdemeyer

  • Status changed from positive_review to needs_info

One patchbot reports

sage -t --long src/sage/tests/books/sagebook/float_doctest.py
**********************************************************************
File "src/sage/tests/books/sagebook/float_doctest.py", line 287, in sage.tests.books.sagebook.float_doctest
Failed example:
    RBF(pi)
Expected:
    [3.141592653589793 +/- 5.61e-16]
Got:
    [3.141592653589793 +/- 3.39e-16]
**********************************************************************
File "src/sage/tests/books/sagebook/float_doctest.py", line 289, in sage.tests.books.sagebook.float_doctest
Failed example:
    RealBallField(100)(pi)
Expected:
    [3.14159265358979323846264338328 +/- 3.83e-30]
Got:
    [3.14159265358979323846264338328 +/- 2.25e-30]
**********************************************************************
File "src/sage/tests/books/sagebook/float_doctest.py", line 431, in sage.tests.books.sagebook.float_doctest
Failed example:
    CBF(sqrt(2),pi)
Expected:
    [1.414213562373095 +/- 4.10e-16] + [3.141592653589793 +/- 5.61e-16]*I
Got:
    [1.414213562373095 +/- 4.10e-16] + [3.141592653589793 +/- 3.39e-16]*I
**********************************************************************
File "src/sage/tests/books/sagebook/float_doctest.py", line 437, in sage.tests.books.sagebook.float_doctest
Failed example:
    CBF(sqrt(2)+pi*I)
Expected:
    [1.414213562373095 +/- 4.10e-16] + [3.141592653589793 +/- 5.61e-16]*I
Got:
    [1.414213562373095 +/- 4.10e-16] + [3.141592653589793 +/- 3.39e-16]*I
**********************************************************************
File "src/sage/tests/books/sagebook/float_doctest.py", line 462, in sage.tests.books.sagebook.float_doctest
Failed example:
    ComplexBallField(100)(1+I*pi).arg()
Expected:
    [1.26262725567891168344432208360 +/- 6.60e-30]
Got:
    [1.26262725567891168344432208360 +/- 6.46e-30]
**********************************************************************

Do we have a reason to say that this patchbot is wrong?

comment:103 Changed 11 months ago by chapoton

and in fact two patchbots complain at this same place..

comment:104 Changed 11 months ago by embray

This would be due to #26360. For now we should use the (not ideal) solution from that ticket of just replacing the mantissa in those floats with ....

Last edited 11 months ago by embray (previous) (diff)

comment:105 Changed 11 months ago by git

  • Commit changed from b32170fe754f9293b8c7324414511c61f12ce64b to a00c64c5d6f0599b988469895f69837dba8d9e71

Branch pushed to git repo; I updated commit sha1. New commits:

324b483Merge branch 'public/french_book_python3' in 8.6.b0
a00c64clivre sage doctests: fix floating errors

comment:106 Changed 11 months ago by chapoton

  • Status changed from needs_info to needs_review

I have fixed the float doctests in the suggested way.

comment:107 Changed 11 months ago by chapoton

bot is now morally green

comment:108 Changed 11 months ago by embray

  • Milestone changed from sage-8.5 to sage-8.6
  • Status changed from needs_review to positive_review

comment:109 Changed 11 months ago by chapoton

  • Authors changed from Erik Bray to Erik Bray, Frédéric Chapoton
  • Reviewers changed from Erik Bray to Erik Bray, Frédéric Chapoton

comment:110 Changed 11 months ago by vbraun

  • Status changed from positive_review to needs_work

on OSX:

**********************************************************************
File "src/sage/tests/books/sagebook/float_doctest.py", line 208, in sage.tests.books.sagebook.float_doctest
Failed example:
    print("exact - classical summation: %.1f" % (s-ii))
Expected:
    exact - classical summation: -45.5
Got:
    exact - classical summation: -45.6
**********************************************************************
1 item had failures:
   1 of 142 in sage.tests.books.sagebook.float_doctest
    [141 tests, 1 failure, 40.89 s]
**********************************************************************
File "src/sage/tests/books/sagebook/graphtheory_doctest.py", line 66, in sage.tests.books.sagebook.graphtheory_doctest
Failed example:
    P.minor(graphs.CompleteBipartiteGraph(3,3))
Expected:
    {0: [1], 1: [8], 2: [4], 3: [6, 7, 9], 4: [2, 3], 5: [0, 5]}
Got:
    {0: [0, 4], 1: [1, 6, 8], 2: [2, 7], 3: [3], 4: [9], 5: [5]}
**********************************************************************
File "src/sage/tests/books/sagebook/graphtheory_doctest.py", line 68, in sage.tests.books.sagebook.graphtheory_doctest
Failed example:
    P.minor(graphs.CompleteGraph(5))
Expected:
    {0: [1, 6], 1: [0, 5], 2: [2, 7], 3: [4, 9], 4: [3, 8]}
Got:
    {0: [5, 8], 1: [1, 6], 2: [2, 3], 3: [7, 9], 4: [0, 4]}
**********************************************************************
1 item had failures:
   2 of 114 in sage.tests.books.sagebook.graphtheory_doctest
    [113 tests, 2 failures, 8.61 s]
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 24, in sage.tests.books.sagebook.integration_doctest
Failed example:
    N(integrate(sin(x^2)/(x^2), x, 1, infinity))
Expected:
    0.285736646322853 - 6.93889390390723e-18*I
Got:
    0.285736646322853 + 6.93889390390723e-18*I
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 45, in sage.tests.books.sagebook.integration_doctest
Failed example:
    N(integrate(exp(-x^2)*log(x), x, 17, 42))
Expected:
    2.5657285006962035e-127
Got:
    2.565728500696221e-127
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 57, in sage.tests.books.sagebook.integration_doctest
Failed example:
    numerical_integral(exp(-x^2)*log(x), 17, 42)
Expected:
    (2.5657285006962035e-127, 3.3540254049238093e-128)
Got:
    (2.565728500696221e-127, 3.3540254049023843e-128)
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 64, in sage.tests.books.sagebook.integration_doctest
Failed example:
    numerical_integral(exp(-x^100), 0, 1.1, algorithm='qng')
Expected:
    (0.994327538576531..., 0.016840666914688864)
Got:
    (0.9943275385765319, 0.016840666914705607)
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 74, in sage.tests.books.sagebook.integration_doctest
Failed example:
    N(integrate(exp(-x^2)*log(x), x, 17, 42), digits=60)
Expected:
    2.5657285006962035e-127
Got:
    2.565728500696221e-127
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 95, in sage.tests.books.sagebook.integration_doctest
Failed example:
    gp('intnum(x=17, 20, exp(-x^2)*log(x))')
Expected:
    2.5657285005610514829173563961304785900 E-127
Got:
    2.565728500561051482917356396 E-127
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 100, in sage.tests.books.sagebook.integration_doctest
Failed example:
    gp('intnum(x=0, 1, sin(sin(x)))')
Expected:
    0.43060610312069060491237735524846578643
Got:
    0.4306061031206906049123773553
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 109, in sage.tests.books.sagebook.integration_doctest
Failed example:
    gp('intnum(x=0, 1, x^(-99/100))') # abs tol 2e-16
Expected:
    73.62914262423378365
Got:
    67.28157752276430690714796980
Tolerance exceeded:
    73.62914262423378365 vs 67.28157752276430690714796980, tolerance 6e+00 > 2e-16
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 114, in sage.tests.books.sagebook.integration_doctest
Failed example:
    gp('intnum(x=[0, -99/100], 1, x^(-99/100))')
Expected:
    100.00000000000000000000000000000000000
Got:
    100.0000000000000000000000000
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 119, in sage.tests.books.sagebook.integration_doctest
Failed example:
    gp('intnum(x=[0, -1/42], 1, x^(-99/100))') # abs tol 2e-16
Expected:
    74.47274932028288503
Got:
    68.16118711180150288540450897
Tolerance exceeded:
    74.47274932028288503 vs 68.16118711180150288540450897, tolerance 6e+00 > 2e-16
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 178, in sage.tests.books.sagebook.integration_doctest
Failed example:
    f(0.0), f(0.5), f(1.0)
Expected:
    (0.0, 0.8414895067661431, 1.6318696084180513)
Got:
    (0.0, 0.8414895067661431, 1.6318696084180517)
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 183, in sage.tests.books.sagebook.integration_doctest
Failed example:
    numerical_integral(f, 0, 1)
Expected:
    (0.8606791942204567, 6.301207560882073e-07)
Got:
    (0.8606791942204566, 6.301207561280224e-07)
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 190, in sage.tests.books.sagebook.integration_doctest
Failed example:
    numerical_integral(f, 0, 1)
Expected:
    (0.860679194220456..., 6.301207560882096e-07)
Got:
    (0.8606791942204566, 6.301207560974723e-07)
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 197, in sage.tests.books.sagebook.integration_doctest
Failed example:
    numerical_integral(f, 0, 1)
Expected:
    (0.8606791942204567, 6.301207561187562e-07)
Got:
    (0.8606791942204565, 6.301207561295888e-07)
**********************************************************************
File "src/sage/tests/books/sagebook/integration_doctest.py", line 213, in sage.tests.books.sagebook.integration_doctest
Failed example:
    evalI(100)
Expected:
    (0.8606792028826138, 5.553962923506737e-07)
Got:
    (0.8606792028826138, 5.553962919606637e-07)
**********************************************************************
1 item had failures:
  15 of  87 in sage.tests.books.sagebook.integration_doctest
    [86 tests, 15 failures, 23.56 s]
**********************************************************************
File "src/sage/tests/books/sagebook/linsolve_doctest.py", line 129, in sage.tests.books.sagebook.linsolve_doctest
Failed example:
    R1.solve_right(c)
Expected:
    (-1.499999999999999, -0.49999999999999867, 2.749999999999997)
Got:
    (-1.4999999999999967, -0.49999999999999745, 2.749999999999994)
**********************************************************************
File "src/sage/tests/books/sagebook/linsolve_doctest.py", line 135, in sage.tests.books.sagebook.linsolve_doctest
Failed example:
    Z.norm(Infinity)*(Z^-1).norm(Infinity) # abs tol 1e-11
Expected:
    1992.3750000000168
Got:
    1992.3750000000014
Tolerance exceeded:
    1992.3750000000168 vs 1992.3750000000014, tolerance 2e-11 > 1e-11
**********************************************************************
File "src/sage/tests/books/sagebook/linsolve_doctest.py", line 150, in sage.tests.books.sagebook.linsolve_doctest
Failed example:
    x = V*lamb; x
Expected:
    (0.2370370370370367, 0.4518518518518521, 0.3703703703703702)
Got:
    (-5341941225574732.0, -2670970612787367.0, 6677426531968419.0)
**********************************************************************
File "src/sage/tests/books/sagebook/linsolve_doctest.py", line 155, in sage.tests.books.sagebook.linsolve_doctest
Failed example:
    m = 3; [ Sig[i,i] for i in range(0,m) ]
Expected:
    [8.309316833256451, 1.3983038884881154, 0.0]
Got:
    [8.309316833256451, 1.3983038884881158, 1.1474751322044736e-16]
**********************************************************************
File "src/sage/tests/books/sagebook/linsolve_doctest.py", line 180, in sage.tests.books.sagebook.linsolve_doctest
Failed example:
    Q
Expected:
    [ 0.7612151656410958  0.6484993998439783]
    [-0.6484993998439782  0.7612151656410955]
Got:
    [ 0.7612151656410957   0.648499399843978]
    [-0.6484993998439779  0.7612151656410955]
**********************************************************************
File "src/sage/tests/books/sagebook/linsolve_doctest.py", line 215, in sage.tests.books.sagebook.linsolve_doctest
Failed example:
    X
Expected:
    (0.9276845629439007, 0.10329475725387141, -0.3587917847435305)
Got:
    (0.9276845629439006, 0.1032947572538714, -0.3587917847435305)
**********************************************************************
File "src/sage/tests/books/sagebook/linsolve_doctest.py", line 234, in sage.tests.books.sagebook.linsolve_doctest
Failed example:
    Aref.eigenvalues()
Expected:
    [585.0305586200212, 92.91426499150643, 0.03226690899408103, 4.022909479477674]
Got:
    [585.0305586200216, 92.91426499150661, 0.03226690899409142, 4.022909479477676]
**********************************************************************
File "src/sage/tests/books/sagebook/linsolve_doctest.py", line 241, in sage.tests.books.sagebook.linsolve_doctest
Failed example:
    eigen_vals
Expected:
    [   6.39294791648918                 0.0                 0.0]
    [                0.0   0.560519476111939                 0.0]
    [                0.0                 0.0 -1.9534673926011215]
Got:
    [  6.392947916489186                 0.0                 0.0]
    [                0.0  0.5605194761119401                 0.0]
    [                0.0                 0.0 -1.9534673926011223]
**********************************************************************
File "src/sage/tests/books/sagebook/linsolve_doctest.py", line 272, in sage.tests.books.sagebook.linsolve_doctest
Failed example:
    roots = comp.eigenvalues(); roots
Expected:
    [0.3475215101190289 + 0.5665505533984981*I, 0.3475215101190289 - 0.5665505533984981*I,
     0.34502377696179265 + 0.43990870238588275*I, 0.34502377696179265 - 0.43990870238588275*I,
     -0.5172576143252197 + 0.5129582067889322*I, -0.5172576143252197 - 0.5129582067889322*I,
     -1.3669971645459291, -9.983578180965276]
Got:
    [0.3475215101190277 + 0.5665505533984982*I,
     0.3475215101190277 - 0.5665505533984982*I,
     0.34502377696179476 + 0.4399087023858829*I,
     0.34502377696179476 - 0.4399087023858829*I,
     -0.5172576143252197 + 0.5129582067889321*I,
     -0.5172576143252197 - 0.5129582067889321*I,
     -1.366997164545929,
     -9.983578180965276]
**********************************************************************
1 item had failures:
   9 of 132 in sage.tests.books.sagebook.linsolve_doctest
    [131 tests, 9 failures, 17.02 s]
**********************************************************************
File "src/sage/tests/books/sagebook/mpoly_doctest.py", line 395, in sage.tests.books.sagebook.mpoly_doctest
Failed example:
    ys = CDF['y'](Jy.0).roots(); ys
Expected:
    [(-0.8000000000000002, 1), (0.0, 1), (0.8, 1)]
Got:
    [(-0.8, 1), (0.0, 1), (0.7999999999999997, 1)]
**********************************************************************
File "src/sage/tests/books/sagebook/mpoly_doctest.py", line 397, in sage.tests.books.sagebook.mpoly_doctest
Failed example:
    [CDF['x'](p(y=ys[0][0])).roots() for p in J.gens()]
Expected:
    [[(-0.5999999999999999 - 1.306289919090511e-16*I, 1),
     (0.6000000000000001 + 1.3062899190905113e-16*I, 1)],
     [(0.6000000000000001 - 3.1350958058172247e-16*I, 1),
      (2.600000000000001 + 3.135095805817224e-16*I, 1)]]
Got:
    [[(-0.6 - 1.30628991909051e-16*I, 1), (0.6 + 1.3062899190905103e-16*I, 1)],
     [(0.6 - 3.135095805817224e-16*I, 1),
      (2.6000000000000005 + 3.1350958058172237e-16*I, 1)]]
**********************************************************************
1 item had failures:
   2 of 161 in sage.tests.books.sagebook.mpoly_doctest
    [160 tests, 2 failures, 8.27 s]
**********************************************************************
File "src/sage/tests/books/sagebook/polynomes_doctest.py", line 76, in sage.tests.books.sagebook.polynomes_doctest
Failed example:
    p.change_ring(RDF).factor()
Expected:
    (x - 15.810249675906654) * (x - 0.18975032409334563)
Got:
    (x - 15.810249675906654) * (x - 0.1897503240933456)
**********************************************************************
1 item had failures:
   1 of 111 in sage.tests.books.sagebook.polynomes_doctest
    [110 tests, 1 failure, 2.48 s]
**********************************************************************
File "src/sage/tests/books/sagebook/sol/integration_doctest.py", line 39, in sage.tests.books.sagebook.sol.integration_doctest
Failed example:
    N(QuadNC(lambda x: x * log(1+x), 0, 1, 19)) # abs tol 2e-15
Expected:
    0.250000000000001
Got:
    0.249999999999996
Tolerance exceeded:
    0.250000000000001 vs 0.249999999999996, tolerance 5e-15 > 2e-15
**********************************************************************
File "src/sage/tests/books/sagebook/sol/integration_doctest.py", line 41, in sage.tests.books.sagebook.sol.integration_doctest
Failed example:
    numerical_integral(sqrt(1-x^2), 0, 1)
Expected:
    (0.785398167726482..., 9.042725224567119...e-07)
Got:
    (0.7853981677264822, 9.042725224536535e-07)
**********************************************************************
1 item had failures:
   2 of  13 in sage.tests.books.sagebook.sol.integration_doctest
    [12 tests, 2 failures, 2.76 s]
----------------------------------------------------------------------

comment:111 Changed 11 months ago by git

  • Commit changed from a00c64c5d6f0599b988469895f69837dba8d9e71 to 6d6fb708c43e73cf173845cab7a188f61729d96b

Branch pushed to git repo; I updated commit sha1. New commits:

3c6139aMerge branch 'public/french_book_python3' in 8.6.b1
6d6fb70partial fix for numerical noise on osX

comment:112 Changed 11 months ago by chapoton

I did what I could (blindly) for the numerical noise on osX. We need an OsX reviewer to finish the job..

comment:113 Changed 11 months ago by embray

Thank you. What a pain in the ass. If we had #26784 or another way to skip some tests on a specific platform I would just mark the entire directory to be skipped on OSX. It's really beside the point of these tests that they give the exact same results on all imaginable platforms supported by Sage.

comment:114 Changed 11 months ago by embray

I think for the rest of these it would suffice to just mark # known fail for now and move on. It's not critical. I don't think these tests were ever run on OSX before.

comment:115 Changed 10 months ago by chapoton

I have no OsX computer available to see what remains to be fixed or tagged.

comment:116 Changed 10 months ago by embray

  • Milestone changed from sage-8.6 to sage-8.7

Retarging tickets optimistically to the next milestone. If you are responsible for this ticket (either its reporter or owner) and don't believe you are likely to complete this ticket before the next release (8.7) please retarget this ticket's milestone to sage-pending or sage-wishlist.

comment:117 Changed 10 months ago by vklein

Here is what i get with an OSX computer:

MacBook-de-admin:sage admin$ ./sage -t --long src/sage/tests/books/sagebook
This looks like the first time you are running Sage.
Cleaning up, do not interrupt this.
Done cleaning.
no stored timings available
Running doctests with ID 2019-01-17-09-16-48-9bc3bf58.
Git branch: t/23572/public/french_book_python3
Using --optional=dochtml,gfortran,mpir,python2,sage
Doctesting 32 files.
sage -t --long src/sage/tests/books/sagebook/calculus_doctest.py
**********************************************************************
File "src/sage/tests/books/sagebook/calculus_doctest.py", line 210, in sage.tests.books.sagebook.calculus_doctest
Failed example:
    solve([x^2 * y * z == 18, x * y^3 * z == 24,x * y * z^4 == 6], x, y, z)
Expected:
    [[x == 3, y == 2, z == 1],
     [x == (1.337215067329613 - 2.685489874065195*I),
      y == (-1.700434271459228 + 1.052864325754712*I),
      z == (0.9324722294043555 - 0.3612416661871523*I)], ...]
Got:
    [[x == 3, y == 2, z == 1], [x == (1.337215067329607 - 2.6854898740652*I), y == (-1.700434271459228 + 1.052864325754712*I), z == (0.9324722294043555 - 0.3612416661871516*I)], [x == (1.337215067329607 + 2.685489874065201*I), y == (-1.700434271459228 - 1.052864325754712*I), z == (0.9324722294043555 + 0.3612416661871516*I)], [x == (-2.550651407188843 - 1.57929648863207*I), y == (-0.5473259801441658 + 1.923651286345638*I), z == (-0.9829730996839017 - 0.1837495178165701*I)], [x == (-2.550651407188842 + 1.57929648863207*I), y == (-0.5473259801441658 - 1.923651286345638*I), z == (-0.9829730996839017 + 0.1837495178165701*I)], [x == (0.2768050783899186 - 2.987202528885068*I), y == (1.478017834441328 - 1.347391287293138*I), z == (-0.8502171357296142 - 0.5264321628773558*I)], [x == (0.276805078389906 + 2.987202528885103*I), y == (1.478017834441318 + 1.347391287293114*I), z == (-0.8502171357296142 + 0.5264321628773558*I)], [x == (-0.8209889702162457 + 2.885476929518458*I), y == (-1.205269272758512 - 1.59603445456048*I), z == (0.09226835946330207 - 0.9957341762950345*I)], [x == (-0.8209889702162482 - 2.885476929518459*I), y == (-1.205269272758513 + 1.596034454560479*I), z == (0.09226835946330207 + 0.9957341762950345*I)], [x == (-1.807903909137758 - 2.394051681840712*I), y == (0.8914767115530775 - 1.790326582710134*I), z == (0.7390089172206591 - 0.6736956436465571*I)], [x == (-1.80790390913777 + 2.394051681840719*I), y == (0.8914767115530766 + 1.790326582710125*I), z == (0.7390089172206591 + 0.6736956436465571*I)], [x == (2.217026751661979 + 2.021086930939673*I), y == (1.864944458808712 + 0.722483332374306*I), z == (-0.2736629900720828 - 0.9618256431728189*I)], [x == (2.217026751662001 - 2.021086930939692*I), y == (1.864944458808693 - 0.7224833323742994*I), z == (-0.2736629900720828 + 0.9618256431728189*I)], [x == (2.797416688213066 - 1.083724998561461*I), y == (-1.965946199367804 + 0.3674990356331406*I), z == (-0.6026346363792563 - 0.7980172272802396*I)], [x == (2.797416688213067 + 1.083724998561461*I), y == (-1.965946199367804 - 0.3674990356331406*I), z == (-0.6026346363792563 + 0.7980172272802396*I)], [x == (-2.948919299051704 + 0.5512485534497115*I), y == (0.184536718926604 + 1.991468352590069*I), z == (0.4457383557765383 - 0.8951632913550623*I)], [x == (-2.948919299051704 - 0.5512485534497119*I), y == (0.1845367189266038 - 1.991468352590069*I), z == (0.4457383557765383 + 0.8951632913550623*I)]]
**********************************************************************
File "src/sage/tests/books/sagebook/calculus_doctest.py", line 225, in sage.tests.books.sagebook.calculus_doctest
Failed example:
    find_root(expr, 0.1, pi)
Expected:
    2.0943951023931957
Got:
    2.0943951023931953
**********************************************************************
1 item had failures:
   2 of 146 in sage.tests.books.sagebook.calculus_doctest
    [145 tests, 2 failures, 7.85 s]
...
----------------------------------------------------------------------
sage -t --long src/sage/tests/books/sagebook/calculus_doctest.py  # 2 doctests failed
----------------------------------------------------------------------
Total time for all tests: 383.2 seconds
    cpu time: 346.3 seconds
    cumulative wall time: 381.1 seconds

comment:118 Changed 10 months ago by git

  • Commit changed from 6d6fb708c43e73cf173845cab7a188f61729d96b to 6da362973acff90517448e8e8fb3eef6282b313f

Branch pushed to git repo; I updated commit sha1. New commits:

17d97d8Merge branch 'public/french_book_python3' in 8.6
6da3629book doctests : adding some tolerance again

comment:119 Changed 10 months ago by chapoton

Thanks a lot. Could you please double check now with my latest fixes ?

comment:120 Changed 10 months ago by vklein

  • Authors changed from Erik Bray, Frédéric Chapoton to Erik Bray, Frédéric Chapoton, Vincent Klein

Yes sage -t --long src/sage/tests/books/sagebook now pass on OSX. In my humble opinion a green would mean positive review.

comment:121 Changed 10 months ago by vklein

  • Authors changed from Erik Bray, Frédéric Chapoton, Vincent Klein to Erik Bray, Frédéric Chapoton
  • Reviewers changed from Erik Bray, Frédéric Chapoton to Erik Bray, Frédéric Chapoton, Vincent Klein

comment:122 Changed 10 months ago by chapoton

  • Dependencies #26656 deleted
  • Work issues support `reduce` as a global in Python 3 deleted

comment:123 Changed 10 months ago by embray

  • Status changed from needs_work to positive_review

Great, thank you Vincent! Hopefully this time...

comment:124 Changed 10 months ago by vbraun

  • Status changed from positive_review to needs_work
sage -t --long src/sage/tests/books/sagebook/float_doctest.py
**********************************************************************
File "src/sage/tests/books/sagebook/float_doctest.py", line 282, in sage.tests.books.sagebook.float_doctest
Failed example:
    RIF(0,+infinity)
Expected:
    [0.00000000000000000 .. +infinity]
Got:
    [0.0000000000000000 .. +infinity]
**********************************************************************
File "src/sage/tests/books/sagebook/float_doctest.py", line 339, in sage.tests.books.sagebook.float_doctest
Failed example:
    E = RIF(0,1); log(E)
Expected:
    [-infinity .. -0.00000000000000000]
Got:
    [-infinity .. -0.0000000000000000]
**********************************************************************
File "src/sage/tests/books/sagebook/float_doctest.py", line 352, in sage.tests.books.sagebook.float_doctest
Failed example:
    1-x^2
Expected:
    [0.00000000000000000 .. 1.0000000000000000]
Got:
    [0.0000000000000000 .. 1.0000000000000000]
**********************************************************************
File "src/sage/tests/books/sagebook/float_doctest.py", line 354, in sage.tests.books.sagebook.float_doctest
Failed example:
    1-x*x
Expected:
    [0.00000000000000000 .. 2.0000000000000000]
Got:
    [0.0000000000000000 .. 2.0000000000000000]
**********************************************************************
File "src/sage/tests/books/sagebook/float_doctest.py", line 356, in sage.tests.books.sagebook.float_doctest
Failed example:
    (1-x)*(1+x)
Expected:
    [0.00000000000000000 .. 4.0000000000000000]
Got:
    [0.0000000000000000 .. 4.0000000000000000]
**********************************************************************
1 item had failures:
   5 of 142 in sage.tests.books.sagebook.float_doctest
    [141 tests, 5 failures, 20.45 s]


sage -t --long src/sage/tests/books/sagebook/sol/float_doctest.py
**********************************************************************
File "src/sage/tests/books/sagebook/sol/float_doctest.py", line 137, in sage.tests.books.sagebook.sol.float_doctest
Failed example:
    f(I)
Expected:
    [0.00000000000000000 .. 1.0000000000000000]
Got:
    [0.0000000000000000 .. 1.0000000000000000]
**********************************************************************
1 item had failures:
   1 of  49 in sage.tests.books.sagebook.sol.float_doctest
    [48 tests, 1 failure, 1.79 s]

comment:125 Changed 10 months ago by git

  • Commit changed from 6da362973acff90517448e8e8fb3eef6282b313f to 4c9163c5e84afc8a1deff94e16d776fe7a690852

Branch pushed to git repo; I updated commit sha1. New commits:

4c9163cfix osX doctests for 0.0000000000

comment:126 Changed 10 months ago by chapoton

  • Status changed from needs_work to needs_review

oh, boy.. Ce ticket commence a me porter sur les nerfs.

Vincent, tu veux bien vérifier que tous les tests du livre passent sur OsX, s'il te plait ?

Last edited 10 months ago by chapoton (previous) (diff)

comment:127 Changed 10 months ago by vklein

Hélas, çà va prendre un peu de temps. Je n'ai pas dans l'immédiat de mac installé avec un sage sous la main.

comment:128 Changed 10 months ago by chapoton

  • Cc jhpalmieri added

@jhpalmieri

John, would you by chance be able to run the doctests of the modified files on OsX ? If so, please do.

comment:129 Changed 10 months ago by jdemeyer

For the last commit, I personally think it would have been better to just replace 0.00000000000000000 by 0.0000000000000000 (as done in #26156). Using ... implies that the test is somehow not deterministic, while it is.

comment:130 Changed 10 months ago by jdemeyer

Just to clear things up: the failure from 124 has nothing to do with OS X (I wonder why you think that).

comment:131 Changed 10 months ago by chapoton

ok, right. No time to change my last commit right now

comment:132 Changed 10 months ago by jdemeyer

Since it's a tiny change and it's my "fault", I'll fix it.

comment:133 Changed 10 months ago by jdemeyer

Another question while I'm looking at the code: what's the meaning of sol in the directory name src/sage/tests/books/sagebook/sol? The way I understand it, that's the directory for the tests of the (old) french book, but I don't understand the name sol.

comment:134 Changed 10 months ago by jdemeyer

Also the name sagebook is not very descriptive.

comment:135 Changed 10 months ago by chapoton

solutions of exercises ?

comment:136 Changed 10 months ago by git

  • Commit changed from 4c9163c5e84afc8a1deff94e16d776fe7a690852 to 860b65c4723a2d7af3289afb365b53a665ebc208

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

07902fcreplace sage/tests/french_book with sage/tests/books/sagebook, containing
7c6b243python3 compatibility of doctests
860b65cFix 0.00000000000000000 in doctests

comment:137 Changed 10 months ago by vklein

@chapoton It looks like you are right the examples under sol modules comes from "Annex A. Solutions des exercises" chapter of the French version.
This chapter is named "ANNEX A. ANSWERS TO EXERCISES" in the English book. I let you decide if ans or answers or another thing would be a better module name.

Last edited 10 months ago by vklein (previous) (diff)

comment:138 Changed 10 months ago by zimmerma

I confirm "sol" means "solutions of exercises". This part was also updated for the english version.

comment:139 Changed 10 months ago by git

  • Commit changed from 860b65c4723a2d7af3289afb365b53a665ebc208 to d4dfe2da3ac68011737d637c3dfbdda20bb49b10

Branch pushed to git repo; I updated commit sha1. New commits:

d4dfe2dRename sagebook -> computational-mathematics-with-sagemath

comment:140 Changed 10 months ago by git

  • Commit changed from d4dfe2da3ac68011737d637c3dfbdda20bb49b10 to 10bbaae5c50226711e110d65a840fb9d74c5f7a1

Branch pushed to git repo; I updated commit sha1. New commits:

10bbaaeUpdate README

comment:141 Changed 10 months ago by vklein

Sorry for this picky remark but computational_mathematics_with_sagemath would be a far more standard compliant name (_ instead of -).

comment:142 Changed 10 months ago by jhpalmieri

I get one doctest failure:

sage -t --warn-long 53.8 src/sage/tests/py3_syntax.py
**********************************************************************
File "src/sage/tests/py3_syntax.py", line 80, in sage.tests.py3_syntax.SortedDirectoryWalkerABC.__iter__
Failed example:
    next(iter(test))
Exception raised:
    Traceback (most recent call last):
      File "/Users/jpalmier/Desktop/Sage/git/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 671, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/jpalmier/Desktop/Sage/git/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 1086, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.tests.py3_syntax.SortedDirectoryWalkerABC.__iter__[2]>", line 1, in <module>
        next(iter(test))
    StopIteration
**********************************************************************
1 item had failures:
   1 of   4 in sage.tests.py3_syntax.SortedDirectoryWalkerABC.__iter__
    [27 tests, 1 failure, 0.05 s]
----------------------------------------------------------------------
sage -t --warn-long 53.8 src/sage/tests/py3_syntax.py  # 1 doctest failed
----------------------------------------------------------------------
Total time for all tests: 0.1 seconds
    cpu time: 0.0 seconds
    cumulative wall time: 0.1 seconds

comment:143 Changed 10 months ago by git

  • Commit changed from 10bbaae5c50226711e110d65a840fb9d74c5f7a1 to fd9e5d1cf0729629bb0d5cc7f05323175d4f888b

Branch pushed to git repo; I updated commit sha1. New commits:

fd9e5d1fix the py3_syntax doctest

comment:144 Changed 10 months ago by chapoton

my last fix is not correct yet

comment:145 Changed 10 months ago by git

  • Commit changed from fd9e5d1cf0729629bb0d5cc7f05323175d4f888b to 96d55d4ff346642b182703ebd3e08f96c65c7898

Branch pushed to git repo; I updated commit sha1. New commits:

96d55d4fix doctest

comment:146 follow-up: Changed 10 months ago by chapoton

and now a bunch of ubuntu ppc failing doctests, just for the fun of it... :-(

comment:147 in reply to: ↑ 146 Changed 10 months ago by jdemeyer

Replying to chapoton:

and now a bunch of ubuntu ppc failing doctests, just for the fun of it... :-(

Most of those are numerical noise, not so bad.

comment:148 Changed 10 months ago by git

  • Commit changed from 96d55d4ff346642b182703ebd3e08f96c65c7898 to a7d2dc9374419ba61b4038ce563282344eaeb699

Branch pushed to git repo; I updated commit sha1. New commits:

252be98Merge branch 'public/french_book_python3' in 8.7.b1
a7d2dc9fixing almost all ubuntu/ppc numerical precision doctests in book

comment:149 Changed 10 months ago by chapoton

There is one suspect doctest that I have not fixed.. Namely

File "src/sage/tests/books/computational-mathematics-with-sagemath/linsolve_doctest.py", line 150, in sage.tests.books.computational-mathematics-with-sagemath.linsolve_doctest
Failed example:
    x = V*lamb; x
Expected:
    (0.2370370370370367, 0.4518518518518521, 0.3703703703703702)
Got:
    (-2.083296832557597e+16, -1.0416484162787986e+16, 2.6041210406969964e+16)
Last edited 10 months ago by chapoton (previous) (diff)

comment:150 follow-up: Changed 10 months ago by chapoton

may I just tag this bad one with # known bug ?

comment:151 in reply to: ↑ 150 Changed 10 months ago by embray

Replying to chapoton:

may I just tag this bad one with # known bug ?

I cracked open my actual copy of the book to better understand the context to this example (being that I'm stupid it was not immediately obvious to me). The purpose of the example is to demonstrate using single value decomposition to find an approximate solution to overdetermined system of equations. I don't know exactly how SVD is implemented but the docs say that U and V are not guaranteed to be unique, and indeed the problem does not have an exact solution.

So for this test I would just mark it # random (I don't think it's a bug, it's just not guaranteed deterministic between systems).

comment:152 Changed 10 months ago by git

  • Commit changed from a7d2dc9374419ba61b4038ce563282344eaeb699 to f76c2aafc6ec0d2189736b6b969478aa1dfd7d6e

Branch pushed to git repo; I updated commit sha1. New commits:

f76c2aaadding one # random

comment:153 Changed 10 months ago by chapoton

can we now try to send it again to the buildbots, please ?

comment:154 Changed 10 months ago by embray

Sure, but I would like to see better commit messages.

comment:155 Changed 10 months ago by git

  • Commit changed from f76c2aafc6ec0d2189736b6b969478aa1dfd7d6e to 5947493a49a57d19a4fe8b2c40c4451c9f91dac1

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

5947493This example is inherently non-deterministic between systems, by design. So it

comment:156 Changed 10 months ago by embray

  • Status changed from needs_review to positive_review

comment:157 Changed 10 months ago by vbraun

  • Status changed from positive_review to needs_work
**********************************************************************
File "src/sage/tests/books/computational-mathematics-with-sagemath/float_doctest.py", line 208, in sage.tests.books.computational-mathematics-with-sagemath.float_doctest
Failed example:
    print("exact - classical summation: %.1f" % (s-ii))
Expected:
    exact - classical summation: -45.5
Got:
    exact - classical summation: -45.6
**********************************************************************
1 item had failures:
   1 of 142 in sage.tests.books.computational-mathematics-with-sagemath.float_doctest
    [141 tests, 1 failure, 50.05 s]
**********************************************************************
File "src/sage/tests/books/computational-mathematics-with-sagemath/integration_doctest.py", line 109, in sage.tests.books.computational-mathematics-with-sagemath.integration_doctest
Failed example:
    gp('intnum(x=0, 1, x^(-99/100))') # abs tol 2e-16
Expected:
    73.62914262423378365
Got:
    67.28157752276430690714796980
Tolerance exceeded:
    73.62914262423378365 vs 67.28157752276430690714796980, tolerance 7e0 > 2e-16
**********************************************************************
File "src/sage/tests/books/computational-mathematics-with-sagemath/integration_doctest.py", line 119, in sage.tests.books.computational-mathematics-with-sagemath.integration_doctest
Failed example:
    gp('intnum(x=[0, -1/42], 1, x^(-99/100))') # abs tol 2e-16
Expected:
    74.47274932028288503
Got:
    68.16118711180150288540450897
Tolerance exceeded:
    74.47274932028288503 vs 68.16118711180150288540450897, tolerance 7e0 > 2e-16
**********************************************************************
1 item had failures:
   2 of  87 in sage.tests.books.computational-mathematics-with-sagemath.integration_doctest
    [86 tests, 2 failures, 28.58 s]
**********************************************************************
File "src/sage/tests/books/computational-mathematics-with-sagemath/linsolve_doctest.py", line 135, in sage.tests.books.computational-mathematics-with-sagemath.linsolve_doctest
Failed example:
    Z.norm(Infinity)*(Z^-1).norm(Infinity) # abs tol 1e-11
Expected:
    1992.3750000000168
Got:
    1992.3750000000014
Tolerance exceeded:
    1992.3750000000168 vs 1992.3750000000014, tolerance 2e-11 > 1e-11
**********************************************************************
File "src/sage/tests/books/computational-mathematics-with-sagemath/linsolve_doctest.py", line 180, in sage.tests.books.computational-mathematics-with-sagemath.linsolve_doctest
Failed example:
    Q
Expected:
    [ 0.7612151656410958  0.6484993998439783]
    [-0.6484993998439782  0.7612151656410955]
Got:
    [ 0.7612151656410957   0.648499399843978]
    [-0.6484993998439779  0.7612151656410955]
**********************************************************************
1 item had failures:
   2 of 132 in sage.tests.books.computational-mathematics-with-sagemath.linsolve_doctest
    [131 tests, 2 failures, 21.59 s]
----------------------------------------------------------------------
sage -t --long src/sage/tests/books/computational-mathematics-with-sagemath/float_doctest.py  # 1 doctest failed
sage -t --long src/sage/tests/books/computational-mathematics-with-sagemath/integration_doctest.py  # 2 doctests failed
sage -t --long src/sage/tests/books/computational-mathematics-with-sagemath/linsolve_doctest.py  # 2 doctests failed
----------------------------------------------------------------------

comment:158 Changed 10 months ago by embray

What platform??

Also, could you please make it a priority to merge this ticket? Or else it will never get done. As far as I know everyone who's worked on it has been able to get all the tests the pass just fine.

comment:159 Changed 10 months ago by embray

In other words, this suite of tests touches so many parts of the Sage code that it's unfair to merge this ticket along with a bunch of others, and then say this one "failed" because something was changed in one of those other tickets that caused some of these tests to fail. If anything it's those tickets that should be marked as "needs_work" or they should add this ticket as a dependency.

Otherwise it is impossible for us to guess which other tickets you're going to integrate in with it, and thus impossible to predict how some example results will change.

comment:160 Changed 10 months ago by vbraun

Thats on 32-bit. It all seems to be numerical precision issues, just add the relevant #tol and we can try again.

comment:161 Changed 10 months ago by embray

Okay, thanks. I don't think a lot of people are testing on 32-bit then.

I wonder if we could just mark those tests # 64-bit actually. I honestly don't care if they are tested on 32-bit.

comment:162 Changed 10 months ago by git

  • Commit changed from 5947493a49a57d19a4fe8b2c40c4451c9f91dac1 to 111af39340990402e8bb726e2a0b44bed8142736

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

1e933a3replace sage/tests/french_book with sage/tests/books/sagebook, containing
0b5b866python3 compatibility of doctests
065610dFix 0.00000000000000000 in doctests
3e8bd5aRename sagebook -> computational-mathematics-with-sagemath
f8e7c1fThis example is inherently non-deterministic between systems, by design. So it
111af39Fix gp tests

comment:163 Changed 10 months ago by git

  • Commit changed from 111af39340990402e8bb726e2a0b44bed8142736 to 1c4747b0c16716f7d5ea7c95af6000ccf47212c9

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

1c4747bFix gp tests

comment:164 Changed 10 months ago by git

  • Commit changed from 1c4747b0c16716f7d5ea7c95af6000ccf47212c9 to 192ecd677f255ed988049495182312de4e9913fd

Branch pushed to git repo; I updated commit sha1. New commits:

192ecd6Add/increase a few tolerances

comment:165 Changed 10 months ago by git

  • Commit changed from 192ecd677f255ed988049495182312de4e9913fd to d93a151f071e012476d2a894f0307de3b7de657d

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

d93a151More doctest fixes

comment:166 Changed 10 months ago by jdemeyer

On my laptop, I get

File "src/sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py", line 112, in sage.tests.books.computational-mathematics-with-sagemath.graphique_doctest
Failed example:
    for i in srange(-2, 2, 0.2):
        g += line(desolve_rk4(DE, y(x), ics=[1, i],\
                          step=0.05, end_points=[0,2]))
        g += line(desolve_rk4(DE, y(x), ics=[-1, i],\
                          step=0.05, end_points=[-2,0]))
Exception raised:
    Traceback (most recent call last):
      File "/usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 671, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 1086, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.tests.books.computational-mathematics-with-sagemath.graphique_doctest[50]>", line 3, in <module>
        step=RealNumber('0.05'), end_points=[Integer(0),Integer(2)]))
      File "/usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/calculus/desolvers.py", line 1378, in desolve_rk4
        sol_2=maxima(cmd).sage()
      File "/usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 1074, in sage
        return self._sage_(*args, **kwds)
      File "/usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/interfaces/maxima_abstract.py", line 1238, in _sage_
        maxima=self.parent())
      File "/usr/local/src/sage-git/local/lib/python2.7/site-packages/sage/calculus/calculus.py", line 2163, in symbolic_expression_from_maxima_string
        raise TypeError("unable to make sense of Maxima expression '%s' in Sage"%s)
    TypeError: unable to make sense of Maxima expression '(kill(sage4)$o44)[[1.0,-2.0],[1.05,-2.149874965475482],[1.1,-2.298999939830521],[1.15,-2.446624921487998],[1.2,-2.591999909207452],[1.25,-2.7343749020044],[1.3,-2.872999899091065],[1.35,-3.007124899832311],[1.4,-3.135999903712506],[1.45,-3.258874910310362],[1.5,-3.374999919279643],[1.55,-3.483624930334245],[1.6,-3.58399994323656],[1.65,-3.675374957788335],[1.7,-3.756999973823437],[1.75,-3.828124991202094],[1.8,-3.888000009806273],[1.85,-3.935875029535953],[1.9,-3.971000050306113],[1.95,-3.992625072044261],[2.0,-4.000000094688424]]' in Sage

comment:167 Changed 10 months ago by git

  • Commit changed from d93a151f071e012476d2a894f0307de3b7de657d to 64c8fd9411e1f5a555478b43ba77da99269d64c0

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

64c8fd9More doctest fixes

comment:168 Changed 10 months ago by git

  • Commit changed from 64c8fd9411e1f5a555478b43ba77da99269d64c0 to 4e07cba7119fb36f71056df8adcc8f97229bd5a4

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

4e07cbaMore doctest fixes

comment:169 Changed 10 months ago by jdemeyer

  • Authors changed from Erik Bray, Frédéric Chapoton to Erik Bray, Frédéric Chapoton, Jeroen Demeyer
  • Status changed from needs_work to needs_review

All tests pass on 32 bits. I don't know what's up with Maxima in 166. That error is reproducible, but only on 1 system so far.

comment:170 Changed 10 months ago by jdemeyer

The error in 166 is because of GC happening at the "wrong" time.

comment:171 Changed 10 months ago by jdemeyer

Ping. Needs review.

comment:172 Changed 9 months ago by chapoton

  • Status changed from needs_review to positive_review

ok, looks good enough. Let us try again

comment:173 Changed 9 months ago by jdemeyer

To the release manager: please merge this ASAP.

comment:174 Changed 9 months ago by vbraun

  • Status changed from positive_review to needs_work

Please merge in #27066

sage -t --long src/sage/tests/books/computational-mathematics-with-sagemath/sol/polynomes_doctest.py
**********************************************************************
File "src/sage/tests/books/computational-mathematics-with-sagemath/sol/polynomes_doctest.py", line 79, in sage.tests.books.computational-mathematics-with-sagemath.sol.polynomes_doctest
Failed example:
    berlekamp_massey([1, 1, 2, 3, 8, 11, 34, 39, 148, 127])
Expected:
    x^3 - 5*x + 2
Got:
    doctest:warning
      File "/mnt/disk/home/release/Sage/src/bin/sage-runtests", line 163, in <module>
        err = DC.run()
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/control.py", line 1225, in run
        self.run_doctests()
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/control.py", line 929, in run_doctests
        self.dispatcher.dispatch()
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 2000, in dispatch
        self.parallel_dispatch()
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 1897, in parallel_dispatch
        w.start()  # This might take some time
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 2183, in start
        super(DocTestWorker, self).start()
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/multiprocessing/process.py", line 130, in start
        self._popen = Popen(self)
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/multiprocessing/forking.py", line 126, in __init__
        code = process_obj._bootstrap()
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/multiprocessing/process.py", line 267, in _bootstrap
        self.run()
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 2139, in run
        task(self.options, self.outtmpfile, msgpipe, self.result_queue)
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 2477, in __call__
        doctests, extras = self._run(runner, options, results)
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 2526, in _run
        result = runner.run(test)
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 869, in run
        return self._run(test, compileflags, out)
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 671, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 1095, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.tests.books.computational-mathematics-with-sagemath.sol.polynomes_doctest[22]>", line 1, in <module>
        berlekamp_massey([Integer(1), Integer(1), Integer(2), Integer(3), Integer(8), Integer(11), Integer(34), Integer(39), Integer(148), Integer(127)])
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/misc/superseded.py", line 102, in deprecation
        warning(trac_number, message, DeprecationWarning, stacklevel)
      File "/mnt/disk/home/release/Sage/local/lib/python2.7/site-packages/sage/misc/superseded.py", line 148, in warning
        warn(message, warning_class, stacklevel)
    :
    DeprecationWarning: 
    Importing berlekamp_massey from here is deprecated. If you need to use it, please import it directly from sage.matrix.berlekamp_massey
    See https://trac.sagemath.org/27066 for details.
    x^3 - 5*x + 2
**********************************************************************
1 item had failures:
   1 of  33 in sage.tests.books.computational-mathematics-with-sagemath.sol.polynomes_doctest
    [32 tests, 1 failure, 18.18 s]
sage -t --long src/sage/tests/books/computational-mathematics-with-sagemath/combinat_doctest.py
    [265 tests, 39.67 s]
----------------------------------------------------------------------
sage -t --long src/sage/tests/books/computational-mathematics-with-sagemath/sol/polynomes_doctest.py  # 1 doctest failed
----------------------------------------------------------------------

comment:175 Changed 9 months ago by git

  • Commit changed from 4e07cba7119fb36f71056df8adcc8f97229bd5a4 to 3e2e949901b68c3da92ae266f9c5c274e272451c

Branch pushed to git repo; I updated commit sha1. New commits:

2107963Merge branch 'public/french_book_python3' in 8.7.b2
473c626Merge branch 'u/chapoton/27066' in french book branch
3e2e949fix doctest using berlekamp

comment:176 Changed 9 months ago by chapoton

  • Dependencies set to #27066
  • Status changed from needs_work to positive_review

done and tested, setting back to positive


New commits:

2107963Merge branch 'public/french_book_python3' in 8.7.b2
473c626Merge branch 'u/chapoton/27066' in french book branch
3e2e949fix doctest using berlekamp

New commits:

2107963Merge branch 'public/french_book_python3' in 8.7.b2
473c626Merge branch 'u/chapoton/27066' in french book branch
3e2e949fix doctest using berlekamp

comment:177 Changed 9 months ago by vbraun

  • Status changed from positive_review to needs_work

Here is a (hopefully final) 32-bit numerical noise nugget:

**********************************************************************
File "src/sage/tests/books/computational-mathematics-with-sagemath/sol/integration_doctest.py", line 53, in sage.tests.books.computational-mathematics-with-sagemath.sol.integration_doctest
Failed example:
    [N(QuadNC(lambda x: sqrt(1-x^2), 0, 1, n) - pi/4)
     for n in [2, 8, 16]]
Expected:
    [-0.285398163397448, -0.00524656673640445, -0.00125482109302663]
Got:
    [-0.285398163397448, -0.00524656673640433, -0.00125482109302577]
**********************************************************************
1 item had failures:
   1 of  13 in sage.tests.books.computational-mathematics-with-sagemath.sol.integration_doctest
    [12 tests, 1 failure, 2.52 s]
----------------------------------------------------------------------
sage -t --long src/sage/tests/books/computational-mathematics-with-sagemath/sol/integration_doctest.py  # 1 doctest failed
----------------------------------------------------------------------
Total time for all tests: 8302.0 seconds
Last edited 9 months ago by vbraun (previous) (diff)

comment:178 Changed 9 months ago by git

  • Commit changed from 3e2e949901b68c3da92ae266f9c5c274e272451c to ae3604981449d425841ff188904cf641397307a8

Branch pushed to git repo; I updated commit sha1. New commits:

05a659dMerge branch 'public/french_book_python3' in 8.7.B3
ae36049one more abs tol in the book

comment:179 Changed 9 months ago by chapoton

  • Status changed from needs_work to positive_review

ok, done. This ticket is a pain..

comment:180 Changed 9 months ago by vbraun

  • Branch changed from public/french_book_python3 to ae3604981449d425841ff188904cf641397307a8
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.