Opened 8 months ago

Closed 8 months ago

#27574 closed enhancement (fixed)

py3: fix one doctest in French book

Reported by: chapoton Owned by:
Priority: major Milestone: sage-8.8
Component: python3 Keywords:
Cc: tscrim, vklein Merged in:
Authors: Frédéric Chapoton Reviewers: Travis Scrimshaw
Report Upstream: N/A Work issues:
Branch: f81acd9 (Commits) Commit: f81acd951b977a257be0df276b15c47c18ae4942
Dependencies: Stopgaps:

Description

by marking it as random

Change History (9)

comment:1 Changed 8 months ago by chapoton

  • Branch set to u/chapoton/27574
  • Commit set to f81acd951b977a257be0df276b15c47c18ae4942
  • Status changed from new to needs_review

New commits:

f81acd9py3: mark one doctest as random in the French book

comment:2 Changed 8 months ago by chapoton

  • Cc tscrim added

please review

comment:3 Changed 8 months ago by chapoton

  • Cc vklein added

green bot, please review

comment:4 Changed 8 months ago by tscrim

I don't really like marking tests as random when there is exact output. I think the better thing to do is to change the test to check that the output matches something explicit.

comment:5 Changed 8 months ago by chapoton

Well, I have not read the book, but this precise doctest is probably here to display an example of bad answer, by lack of sufficient precision...

comment:6 Changed 8 months ago by chapoton

page 201 of the book (http://sagebook.gforge.inria.fr/english.html)

Let us continue. For the following system, J.variety() computes (exactly) a
triangular decomposition of J, then finds numerically the real solutions of the
obtained system(s). This yields a unique real solution:

sage: R.<x,y> = QQ[]; J = ideal([ x^7-(100*x-1)^2, y-x^7+1 ])
sage: J.variety(RealField(51))
[{y: 396340.890166545, x: -14.1660266425312}]

Yet, by performing the computation exactly until the end, we see there are three
real solutions, and the value of x in the above numerical solution is completely
wrong:

comment:7 Changed 8 months ago by tscrim

Based on that, I am more convinced that we should make sure it is testing the correct output and not just something from a valid computation. However, there is something very annoying happening when I try to test against the value exactly. The x value does not quite match despite having the same digits displayed. So I guess we just have to let this be with # random. :/

comment:8 Changed 8 months ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

comment:9 Changed 8 months ago by vbraun

  • Branch changed from u/chapoton/27574 to f81acd951b977a257be0df276b15c47c18ae4942
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.