Mark several tests as random to avoid test failure#39153
Merged
vbraun merged 4 commits intosagemath:developfrom Jan 18, 2025
Merged
Mark several tests as random to avoid test failure#39153vbraun merged 4 commits intosagemath:developfrom
vbraun merged 4 commits intosagemath:developfrom
Conversation
|
Documentation preview for this PR (built with commit 7e0ebbe; changes) is ready! 🎉 |
626f726 to
8f58440
Compare
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Dec 23, 2024
sagemathgh-39153: Mark several tests as random to avoid test failure This fails sometimes in e.g. https://github.com/sagemath/sage/actions/ru ns/12388661556/job/34580166155?pr=39152#step:10:9714 Marking this as random looks reasonable because one of the test above (specifying the exact embedding) is also marked as random, and if the embedding is random then of course the element representation in terms of the generator `a` should also be random. More context: * the first `# random` is added first in https://github.com/sagemath/sag e/commit/37fc8e88689a0197c5513161b85b8bbadd5630ab#diff- c63508ebde0716605e6cdac05e43c8945616c2245158d30ff5ae39936ff4d9a0R1892 * then the note that `number_field_elements_from_algebraics` is OS- dependent ("32 versus 64 bit") is removed at https://github.com/sagemath /sage/commit/61e4df9fabf9e06a21d75eb6320ab3179bc28096 for reasons I can't figure out. (how to find out the discussion around a commit? it was before trac to GitHub migration) ------ Should the entry in `/.github/workflows/ci-conda-known-test- failures.json` be removed? ``` "sage.rings.qqbar": { "failed": "unreported failure on macOS seen in https://github.co m/sagemath/sage/actions/runs/9525536510/job/26259809272?pr=37998" }, ``` ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> ------ Other failing tests: ``` TESTS: Number fields defined by non-monic and non-integral polynomials are supported (:issue:`252`):: sage: K.<a> = NumberField(2*x^4 + 6*x^2 + 1/2) sage: K.optimized_subfields() [ (Number Field in a0 with defining polynomial x, Ring morphism: From: Number Field in a0 with defining polynomial x To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: 0 |--> 0, None), (Number Field in a1 with defining polynomial x^2 - 2*x + 2, Ring morphism: From: Number Field in a1 with defining polynomial x^2 - 2*x + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a1 |--> a^3 + 7/2*a + 1, None), (Number Field in a2 with defining polynomial x^2 - 2*x + 2, Ring morphism: From: Number Field in a2 with defining polynomial x^2 - 2*x + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a2 |--> -a^3 - 7/2*a + 1, None), (Number Field in a3 with defining polynomial x^2 - 2, Ring morphism: From: Number Field in a3 with defining polynomial x^2 - 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a3 |--> a^2 + 3/2, None), (Number Field in a4 with defining polynomial x^2 + 1, Ring morphism: From: Number Field in a4 with defining polynomial x^2 + 1 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a4 |--> a^3 + 7/2*a, None), (Number Field in a5 with defining polynomial x^2 + 2, Ring morphism: From: Number Field in a5 with defining polynomial x^2 + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a5 |--> 2*a^3 + 5*a, None), (Number Field in a6 with defining polynomial x^4 + 1, Ring morphism: From: Number Field in a6 with defining polynomial x^4 + 1 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a6 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4, Ring morphism: From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 To: Number Field in a6 with defining polynomial x^4 + 1 Defn: a |--> -1/2*a6^3 + a6^2 - 1/2*a6) ] ``` I look into what determines the ordering. It uses `_subfields_helper` which uses either `f.polred(2)` or `f.nfsubfields(degree)`, and there's no sorting going on. Conclusion: marking as `random sort order` is fine. In fact it doesn't even say which subfields should be returned exactly, and other tests in that function are marked as `# random` anyway, so marking as `# random` is fine. ------ ``` 2024-12-18T08:35:49.0399180Z File "src/sage/rings/number_field/number_field.py", line 8777, in sage.rings.number_field.number_field.NumberField_absolute.subfields 2024-12-18T08:35:49.0500510Z Failed example: 2024-12-18T08:35:49.0601390Z K.subfields() 2024-12-18T08:35:49.0707380Z Expected: 2024-12-18T08:35:49.0829700Z [ 2024-12-18T08:35:49.1013090Z (Number Field in a0 with defining polynomial x, Ring morphism: 2024-12-18T08:35:49.1114120Z From: Number Field in a0 with defining polynomial x 2024-12-18T08:35:49.1215190Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.1319910Z Defn: 0 |--> 0, None), 2024-12-18T08:35:49.1426370Z (Number Field in a1 with defining polynomial x^2 - 2, Ring morphism: 2024-12-18T08:35:49.1528730Z From: Number Field in a1 with defining polynomial x^2 - 2 2024-12-18T08:35:49.1631010Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.1659980Z Defn: a1 |--> a^2 + 3/2, None), 2024-12-18T08:35:49.1761220Z (Number Field in a2 with defining polynomial x^2 + 4, Ring morphism: 2024-12-18T08:35:49.1862420Z From: Number Field in a2 with defining polynomial x^2 + 4 2024-12-18T08:35:49.1970640Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2072220Z Defn: a2 |--> 2*a^3 + 7*a, None), 2024-12-18T08:35:49.2173950Z (Number Field in a3 with defining polynomial x^2 + 2, Ring morphism: 2024-12-18T08:35:49.2275370Z From: Number Field in a3 with defining polynomial x^2 + 2 2024-12-18T08:35:49.2368240Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2476650Z Defn: a3 |--> 2*a^3 + 5*a, None), 2024-12-18T08:35:49.2570570Z (Number Field in a4 with defining polynomial x^4 + 1, Ring morphism: 2024-12-18T08:35:49.2672100Z From: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.2774030Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2875400Z Defn: a4 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4, Ring morphism: 2024-12-18T08:35:49.2977450Z From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.3080080Z To: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.3179890Z Defn: a |--> -1/2*a4^3 + a4^2 - 1/2*a4) 2024-12-18T08:35:49.3281410Z ] 2024-12-18T08:35:49.3382370Z Got: 2024-12-18T08:35:49.3483260Z [ 2024-12-18T08:35:49.3584610Z (Number Field in a0 with defining polynomial x, Ring morphism: 2024-12-18T08:35:49.3643330Z From: Number Field in a0 with defining polynomial x 2024-12-18T08:35:49.3714430Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.3816090Z Defn: 0 |--> 0, None), 2024-12-18T08:35:49.3923670Z (Number Field in a1 with defining polynomial x^2 - 2, Ring morphism: 2024-12-18T08:35:49.4037810Z From: Number Field in a1 with defining polynomial x^2 - 2 2024-12-18T08:35:49.4142230Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4289560Z Defn: a1 |--> -a^2 - 3/2, None), 2024-12-18T08:35:49.4391330Z (Number Field in a2 with defining polynomial x^2 + 4, Ring morphism: 2024-12-18T08:35:49.4492300Z From: Number Field in a2 with defining polynomial x^2 + 4 2024-12-18T08:35:49.4602960Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4705310Z Defn: a2 |--> -2*a^3 - 7*a, None), 2024-12-18T08:35:49.4793770Z (Number Field in a3 with defining polynomial x^2 + 2, Ring morphism: 2024-12-18T08:35:49.4794540Z From: Number Field in a3 with defining polynomial x^2 + 2 2024-12-18T08:35:49.4795030Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4795830Z Defn: a3 |--> 2*a^3 + 5*a, None), 2024-12-18T08:35:49.4796320Z (Number Field in a4 with defining polynomial x^4 + 1, Ring morphism: 2024-12-18T08:35:49.4796780Z From: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.4797230Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4797760Z Defn: a4 |--> a^3 - 1/2*a^2 + 5/2*a - 3/4, Ring morphism: 2024-12-18T08:35:49.4798180Z From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4852940Z To: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.4987040Z Defn: a |--> -1/2*a4^3 - a4^2 - 1/2*a4) 2024-12-18T08:35:49.5088200Z ] ``` Uses https://pari.math.u- bordeaux.fr/dochtml/html/General_number_fields.html#se:nfsubfields internally. It doesn't state any resulting sort order, so I just reorder them (the discriminants are all distincts so it's fine). Alternatively it looks like just doctest against the `set()` of it might work. ------ URL: sagemath#39153 Reported by: user202729 Reviewer(s): Tobias Diez
Contributor
Author
|
Apparently merge upstream from |
Contributor
|
Done! |
Contributor
Author
|
Merge conflict with #39027 prevents this one from being merged from 10.6.beta3 . Fixed now. |
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jan 7, 2025
sagemathgh-39153: Mark several tests as random to avoid test failure This fails sometimes in e.g. https://github.com/sagemath/sage/actions/ru ns/12388661556/job/34580166155?pr=39152#step:10:9714 Marking this as random looks reasonable because one of the test above (specifying the exact embedding) is also marked as random, and if the embedding is random then of course the element representation in terms of the generator `a` should also be random. More context: * the first `# random` is added first in https://github.com/sagemath/sag e/commit/37fc8e88689a0197c5513161b85b8bbadd5630ab#diff- c63508ebde0716605e6cdac05e43c8945616c2245158d30ff5ae39936ff4d9a0R1892 * then the note that `number_field_elements_from_algebraics` is OS- dependent ("32 versus 64 bit") is removed at https://github.com/sagemath /sage/commit/61e4df9fabf9e06a21d75eb6320ab3179bc28096 for reasons I can't figure out. (how to find out the discussion around a commit? it was before trac to GitHub migration) ------ Should the entry in `/.github/workflows/ci-conda-known-test- failures.json` be removed? ``` "sage.rings.qqbar": { "failed": "unreported failure on macOS seen in https://github.co m/sagemath/sage/actions/runs/9525536510/job/26259809272?pr=37998" }, ``` ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> ------ Other failing tests: ``` TESTS: Number fields defined by non-monic and non-integral polynomials are supported (:issue:`252`):: sage: K.<a> = NumberField(2*x^4 + 6*x^2 + 1/2) sage: K.optimized_subfields() [ (Number Field in a0 with defining polynomial x, Ring morphism: From: Number Field in a0 with defining polynomial x To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: 0 |--> 0, None), (Number Field in a1 with defining polynomial x^2 - 2*x + 2, Ring morphism: From: Number Field in a1 with defining polynomial x^2 - 2*x + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a1 |--> a^3 + 7/2*a + 1, None), (Number Field in a2 with defining polynomial x^2 - 2*x + 2, Ring morphism: From: Number Field in a2 with defining polynomial x^2 - 2*x + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a2 |--> -a^3 - 7/2*a + 1, None), (Number Field in a3 with defining polynomial x^2 - 2, Ring morphism: From: Number Field in a3 with defining polynomial x^2 - 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a3 |--> a^2 + 3/2, None), (Number Field in a4 with defining polynomial x^2 + 1, Ring morphism: From: Number Field in a4 with defining polynomial x^2 + 1 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a4 |--> a^3 + 7/2*a, None), (Number Field in a5 with defining polynomial x^2 + 2, Ring morphism: From: Number Field in a5 with defining polynomial x^2 + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a5 |--> 2*a^3 + 5*a, None), (Number Field in a6 with defining polynomial x^4 + 1, Ring morphism: From: Number Field in a6 with defining polynomial x^4 + 1 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a6 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4, Ring morphism: From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 To: Number Field in a6 with defining polynomial x^4 + 1 Defn: a |--> -1/2*a6^3 + a6^2 - 1/2*a6) ] ``` I look into what determines the ordering. It uses `_subfields_helper` which uses either `f.polred(2)` or `f.nfsubfields(degree)`, and there's no sorting going on. Conclusion: marking as `random sort order` is fine. In fact it doesn't even say which subfields should be returned exactly, and other tests in that function are marked as `# random` anyway, so marking as `# random` is fine. ------ ``` 2024-12-18T08:35:49.0399180Z File "src/sage/rings/number_field/number_field.py", line 8777, in sage.rings.number_field.number_field.NumberField_absolute.subfields 2024-12-18T08:35:49.0500510Z Failed example: 2024-12-18T08:35:49.0601390Z K.subfields() 2024-12-18T08:35:49.0707380Z Expected: 2024-12-18T08:35:49.0829700Z [ 2024-12-18T08:35:49.1013090Z (Number Field in a0 with defining polynomial x, Ring morphism: 2024-12-18T08:35:49.1114120Z From: Number Field in a0 with defining polynomial x 2024-12-18T08:35:49.1215190Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.1319910Z Defn: 0 |--> 0, None), 2024-12-18T08:35:49.1426370Z (Number Field in a1 with defining polynomial x^2 - 2, Ring morphism: 2024-12-18T08:35:49.1528730Z From: Number Field in a1 with defining polynomial x^2 - 2 2024-12-18T08:35:49.1631010Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.1659980Z Defn: a1 |--> a^2 + 3/2, None), 2024-12-18T08:35:49.1761220Z (Number Field in a2 with defining polynomial x^2 + 4, Ring morphism: 2024-12-18T08:35:49.1862420Z From: Number Field in a2 with defining polynomial x^2 + 4 2024-12-18T08:35:49.1970640Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2072220Z Defn: a2 |--> 2*a^3 + 7*a, None), 2024-12-18T08:35:49.2173950Z (Number Field in a3 with defining polynomial x^2 + 2, Ring morphism: 2024-12-18T08:35:49.2275370Z From: Number Field in a3 with defining polynomial x^2 + 2 2024-12-18T08:35:49.2368240Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2476650Z Defn: a3 |--> 2*a^3 + 5*a, None), 2024-12-18T08:35:49.2570570Z (Number Field in a4 with defining polynomial x^4 + 1, Ring morphism: 2024-12-18T08:35:49.2672100Z From: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.2774030Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2875400Z Defn: a4 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4, Ring morphism: 2024-12-18T08:35:49.2977450Z From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.3080080Z To: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.3179890Z Defn: a |--> -1/2*a4^3 + a4^2 - 1/2*a4) 2024-12-18T08:35:49.3281410Z ] 2024-12-18T08:35:49.3382370Z Got: 2024-12-18T08:35:49.3483260Z [ 2024-12-18T08:35:49.3584610Z (Number Field in a0 with defining polynomial x, Ring morphism: 2024-12-18T08:35:49.3643330Z From: Number Field in a0 with defining polynomial x 2024-12-18T08:35:49.3714430Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.3816090Z Defn: 0 |--> 0, None), 2024-12-18T08:35:49.3923670Z (Number Field in a1 with defining polynomial x^2 - 2, Ring morphism: 2024-12-18T08:35:49.4037810Z From: Number Field in a1 with defining polynomial x^2 - 2 2024-12-18T08:35:49.4142230Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4289560Z Defn: a1 |--> -a^2 - 3/2, None), 2024-12-18T08:35:49.4391330Z (Number Field in a2 with defining polynomial x^2 + 4, Ring morphism: 2024-12-18T08:35:49.4492300Z From: Number Field in a2 with defining polynomial x^2 + 4 2024-12-18T08:35:49.4602960Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4705310Z Defn: a2 |--> -2*a^3 - 7*a, None), 2024-12-18T08:35:49.4793770Z (Number Field in a3 with defining polynomial x^2 + 2, Ring morphism: 2024-12-18T08:35:49.4794540Z From: Number Field in a3 with defining polynomial x^2 + 2 2024-12-18T08:35:49.4795030Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4795830Z Defn: a3 |--> 2*a^3 + 5*a, None), 2024-12-18T08:35:49.4796320Z (Number Field in a4 with defining polynomial x^4 + 1, Ring morphism: 2024-12-18T08:35:49.4796780Z From: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.4797230Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4797760Z Defn: a4 |--> a^3 - 1/2*a^2 + 5/2*a - 3/4, Ring morphism: 2024-12-18T08:35:49.4798180Z From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4852940Z To: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.4987040Z Defn: a |--> -1/2*a4^3 - a4^2 - 1/2*a4) 2024-12-18T08:35:49.5088200Z ] ``` Uses https://pari.math.u- bordeaux.fr/dochtml/html/General_number_fields.html#se:nfsubfields internally. It doesn't state any resulting sort order, so I just reorder them (the discriminants are all distincts so it's fine). Alternatively it looks like just doctest against the `set()` of it might work. ------ URL: sagemath#39153 Reported by: user202729 Reviewer(s): Tobias Diez
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jan 9, 2025
sagemathgh-39153: Mark several tests as random to avoid test failure This fails sometimes in e.g. https://github.com/sagemath/sage/actions/ru ns/12388661556/job/34580166155?pr=39152#step:10:9714 Marking this as random looks reasonable because one of the test above (specifying the exact embedding) is also marked as random, and if the embedding is random then of course the element representation in terms of the generator `a` should also be random. More context: * the first `# random` is added first in https://github.com/sagemath/sag e/commit/37fc8e88689a0197c5513161b85b8bbadd5630ab#diff- c63508ebde0716605e6cdac05e43c8945616c2245158d30ff5ae39936ff4d9a0R1892 * then the note that `number_field_elements_from_algebraics` is OS- dependent ("32 versus 64 bit") is removed at https://github.com/sagemath /sage/commit/61e4df9fabf9e06a21d75eb6320ab3179bc28096 for reasons I can't figure out. (how to find out the discussion around a commit? it was before trac to GitHub migration) ------ Should the entry in `/.github/workflows/ci-conda-known-test- failures.json` be removed? ``` "sage.rings.qqbar": { "failed": "unreported failure on macOS seen in https://github.co m/sagemath/sage/actions/runs/9525536510/job/26259809272?pr=37998" }, ``` ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> ------ Other failing tests: ``` TESTS: Number fields defined by non-monic and non-integral polynomials are supported (:issue:`252`):: sage: K.<a> = NumberField(2*x^4 + 6*x^2 + 1/2) sage: K.optimized_subfields() [ (Number Field in a0 with defining polynomial x, Ring morphism: From: Number Field in a0 with defining polynomial x To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: 0 |--> 0, None), (Number Field in a1 with defining polynomial x^2 - 2*x + 2, Ring morphism: From: Number Field in a1 with defining polynomial x^2 - 2*x + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a1 |--> a^3 + 7/2*a + 1, None), (Number Field in a2 with defining polynomial x^2 - 2*x + 2, Ring morphism: From: Number Field in a2 with defining polynomial x^2 - 2*x + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a2 |--> -a^3 - 7/2*a + 1, None), (Number Field in a3 with defining polynomial x^2 - 2, Ring morphism: From: Number Field in a3 with defining polynomial x^2 - 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a3 |--> a^2 + 3/2, None), (Number Field in a4 with defining polynomial x^2 + 1, Ring morphism: From: Number Field in a4 with defining polynomial x^2 + 1 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a4 |--> a^3 + 7/2*a, None), (Number Field in a5 with defining polynomial x^2 + 2, Ring morphism: From: Number Field in a5 with defining polynomial x^2 + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a5 |--> 2*a^3 + 5*a, None), (Number Field in a6 with defining polynomial x^4 + 1, Ring morphism: From: Number Field in a6 with defining polynomial x^4 + 1 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a6 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4, Ring morphism: From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 To: Number Field in a6 with defining polynomial x^4 + 1 Defn: a |--> -1/2*a6^3 + a6^2 - 1/2*a6) ] ``` I look into what determines the ordering. It uses `_subfields_helper` which uses either `f.polred(2)` or `f.nfsubfields(degree)`, and there's no sorting going on. Conclusion: marking as `random sort order` is fine. In fact it doesn't even say which subfields should be returned exactly, and other tests in that function are marked as `# random` anyway, so marking as `# random` is fine. ------ ``` 2024-12-18T08:35:49.0399180Z File "src/sage/rings/number_field/number_field.py", line 8777, in sage.rings.number_field.number_field.NumberField_absolute.subfields 2024-12-18T08:35:49.0500510Z Failed example: 2024-12-18T08:35:49.0601390Z K.subfields() 2024-12-18T08:35:49.0707380Z Expected: 2024-12-18T08:35:49.0829700Z [ 2024-12-18T08:35:49.1013090Z (Number Field in a0 with defining polynomial x, Ring morphism: 2024-12-18T08:35:49.1114120Z From: Number Field in a0 with defining polynomial x 2024-12-18T08:35:49.1215190Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.1319910Z Defn: 0 |--> 0, None), 2024-12-18T08:35:49.1426370Z (Number Field in a1 with defining polynomial x^2 - 2, Ring morphism: 2024-12-18T08:35:49.1528730Z From: Number Field in a1 with defining polynomial x^2 - 2 2024-12-18T08:35:49.1631010Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.1659980Z Defn: a1 |--> a^2 + 3/2, None), 2024-12-18T08:35:49.1761220Z (Number Field in a2 with defining polynomial x^2 + 4, Ring morphism: 2024-12-18T08:35:49.1862420Z From: Number Field in a2 with defining polynomial x^2 + 4 2024-12-18T08:35:49.1970640Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2072220Z Defn: a2 |--> 2*a^3 + 7*a, None), 2024-12-18T08:35:49.2173950Z (Number Field in a3 with defining polynomial x^2 + 2, Ring morphism: 2024-12-18T08:35:49.2275370Z From: Number Field in a3 with defining polynomial x^2 + 2 2024-12-18T08:35:49.2368240Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2476650Z Defn: a3 |--> 2*a^3 + 5*a, None), 2024-12-18T08:35:49.2570570Z (Number Field in a4 with defining polynomial x^4 + 1, Ring morphism: 2024-12-18T08:35:49.2672100Z From: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.2774030Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2875400Z Defn: a4 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4, Ring morphism: 2024-12-18T08:35:49.2977450Z From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.3080080Z To: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.3179890Z Defn: a |--> -1/2*a4^3 + a4^2 - 1/2*a4) 2024-12-18T08:35:49.3281410Z ] 2024-12-18T08:35:49.3382370Z Got: 2024-12-18T08:35:49.3483260Z [ 2024-12-18T08:35:49.3584610Z (Number Field in a0 with defining polynomial x, Ring morphism: 2024-12-18T08:35:49.3643330Z From: Number Field in a0 with defining polynomial x 2024-12-18T08:35:49.3714430Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.3816090Z Defn: 0 |--> 0, None), 2024-12-18T08:35:49.3923670Z (Number Field in a1 with defining polynomial x^2 - 2, Ring morphism: 2024-12-18T08:35:49.4037810Z From: Number Field in a1 with defining polynomial x^2 - 2 2024-12-18T08:35:49.4142230Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4289560Z Defn: a1 |--> -a^2 - 3/2, None), 2024-12-18T08:35:49.4391330Z (Number Field in a2 with defining polynomial x^2 + 4, Ring morphism: 2024-12-18T08:35:49.4492300Z From: Number Field in a2 with defining polynomial x^2 + 4 2024-12-18T08:35:49.4602960Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4705310Z Defn: a2 |--> -2*a^3 - 7*a, None), 2024-12-18T08:35:49.4793770Z (Number Field in a3 with defining polynomial x^2 + 2, Ring morphism: 2024-12-18T08:35:49.4794540Z From: Number Field in a3 with defining polynomial x^2 + 2 2024-12-18T08:35:49.4795030Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4795830Z Defn: a3 |--> 2*a^3 + 5*a, None), 2024-12-18T08:35:49.4796320Z (Number Field in a4 with defining polynomial x^4 + 1, Ring morphism: 2024-12-18T08:35:49.4796780Z From: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.4797230Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4797760Z Defn: a4 |--> a^3 - 1/2*a^2 + 5/2*a - 3/4, Ring morphism: 2024-12-18T08:35:49.4798180Z From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4852940Z To: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.4987040Z Defn: a |--> -1/2*a4^3 - a4^2 - 1/2*a4) 2024-12-18T08:35:49.5088200Z ] ``` Uses https://pari.math.u- bordeaux.fr/dochtml/html/General_number_fields.html#se:nfsubfields internally. It doesn't state any resulting sort order, so I just reorder them (the discriminants are all distincts so it's fine). Alternatively it looks like just doctest against the `set()` of it might work. ------ URL: sagemath#39153 Reported by: user202729 Reviewer(s): Tobias Diez
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jan 10, 2025
sagemathgh-39153: Mark several tests as random to avoid test failure This fails sometimes in e.g. https://github.com/sagemath/sage/actions/ru ns/12388661556/job/34580166155?pr=39152#step:10:9714 Marking this as random looks reasonable because one of the test above (specifying the exact embedding) is also marked as random, and if the embedding is random then of course the element representation in terms of the generator `a` should also be random. More context: * the first `# random` is added first in https://github.com/sagemath/sag e/commit/37fc8e88689a0197c5513161b85b8bbadd5630ab#diff- c63508ebde0716605e6cdac05e43c8945616c2245158d30ff5ae39936ff4d9a0R1892 * then the note that `number_field_elements_from_algebraics` is OS- dependent ("32 versus 64 bit") is removed at https://github.com/sagemath /sage/commit/61e4df9fabf9e06a21d75eb6320ab3179bc28096 for reasons I can't figure out. (how to find out the discussion around a commit? it was before trac to GitHub migration) ------ Should the entry in `/.github/workflows/ci-conda-known-test- failures.json` be removed? ``` "sage.rings.qqbar": { "failed": "unreported failure on macOS seen in https://github.co m/sagemath/sage/actions/runs/9525536510/job/26259809272?pr=37998" }, ``` ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> ------ Other failing tests: ``` TESTS: Number fields defined by non-monic and non-integral polynomials are supported (:issue:`252`):: sage: K.<a> = NumberField(2*x^4 + 6*x^2 + 1/2) sage: K.optimized_subfields() [ (Number Field in a0 with defining polynomial x, Ring morphism: From: Number Field in a0 with defining polynomial x To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: 0 |--> 0, None), (Number Field in a1 with defining polynomial x^2 - 2*x + 2, Ring morphism: From: Number Field in a1 with defining polynomial x^2 - 2*x + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a1 |--> a^3 + 7/2*a + 1, None), (Number Field in a2 with defining polynomial x^2 - 2*x + 2, Ring morphism: From: Number Field in a2 with defining polynomial x^2 - 2*x + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a2 |--> -a^3 - 7/2*a + 1, None), (Number Field in a3 with defining polynomial x^2 - 2, Ring morphism: From: Number Field in a3 with defining polynomial x^2 - 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a3 |--> a^2 + 3/2, None), (Number Field in a4 with defining polynomial x^2 + 1, Ring morphism: From: Number Field in a4 with defining polynomial x^2 + 1 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a4 |--> a^3 + 7/2*a, None), (Number Field in a5 with defining polynomial x^2 + 2, Ring morphism: From: Number Field in a5 with defining polynomial x^2 + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a5 |--> 2*a^3 + 5*a, None), (Number Field in a6 with defining polynomial x^4 + 1, Ring morphism: From: Number Field in a6 with defining polynomial x^4 + 1 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a6 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4, Ring morphism: From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 To: Number Field in a6 with defining polynomial x^4 + 1 Defn: a |--> -1/2*a6^3 + a6^2 - 1/2*a6) ] ``` I look into what determines the ordering. It uses `_subfields_helper` which uses either `f.polred(2)` or `f.nfsubfields(degree)`, and there's no sorting going on. Conclusion: marking as `random sort order` is fine. In fact it doesn't even say which subfields should be returned exactly, and other tests in that function are marked as `# random` anyway, so marking as `# random` is fine. ------ ``` 2024-12-18T08:35:49.0399180Z File "src/sage/rings/number_field/number_field.py", line 8777, in sage.rings.number_field.number_field.NumberField_absolute.subfields 2024-12-18T08:35:49.0500510Z Failed example: 2024-12-18T08:35:49.0601390Z K.subfields() 2024-12-18T08:35:49.0707380Z Expected: 2024-12-18T08:35:49.0829700Z [ 2024-12-18T08:35:49.1013090Z (Number Field in a0 with defining polynomial x, Ring morphism: 2024-12-18T08:35:49.1114120Z From: Number Field in a0 with defining polynomial x 2024-12-18T08:35:49.1215190Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.1319910Z Defn: 0 |--> 0, None), 2024-12-18T08:35:49.1426370Z (Number Field in a1 with defining polynomial x^2 - 2, Ring morphism: 2024-12-18T08:35:49.1528730Z From: Number Field in a1 with defining polynomial x^2 - 2 2024-12-18T08:35:49.1631010Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.1659980Z Defn: a1 |--> a^2 + 3/2, None), 2024-12-18T08:35:49.1761220Z (Number Field in a2 with defining polynomial x^2 + 4, Ring morphism: 2024-12-18T08:35:49.1862420Z From: Number Field in a2 with defining polynomial x^2 + 4 2024-12-18T08:35:49.1970640Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2072220Z Defn: a2 |--> 2*a^3 + 7*a, None), 2024-12-18T08:35:49.2173950Z (Number Field in a3 with defining polynomial x^2 + 2, Ring morphism: 2024-12-18T08:35:49.2275370Z From: Number Field in a3 with defining polynomial x^2 + 2 2024-12-18T08:35:49.2368240Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2476650Z Defn: a3 |--> 2*a^3 + 5*a, None), 2024-12-18T08:35:49.2570570Z (Number Field in a4 with defining polynomial x^4 + 1, Ring morphism: 2024-12-18T08:35:49.2672100Z From: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.2774030Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2875400Z Defn: a4 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4, Ring morphism: 2024-12-18T08:35:49.2977450Z From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.3080080Z To: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.3179890Z Defn: a |--> -1/2*a4^3 + a4^2 - 1/2*a4) 2024-12-18T08:35:49.3281410Z ] 2024-12-18T08:35:49.3382370Z Got: 2024-12-18T08:35:49.3483260Z [ 2024-12-18T08:35:49.3584610Z (Number Field in a0 with defining polynomial x, Ring morphism: 2024-12-18T08:35:49.3643330Z From: Number Field in a0 with defining polynomial x 2024-12-18T08:35:49.3714430Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.3816090Z Defn: 0 |--> 0, None), 2024-12-18T08:35:49.3923670Z (Number Field in a1 with defining polynomial x^2 - 2, Ring morphism: 2024-12-18T08:35:49.4037810Z From: Number Field in a1 with defining polynomial x^2 - 2 2024-12-18T08:35:49.4142230Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4289560Z Defn: a1 |--> -a^2 - 3/2, None), 2024-12-18T08:35:49.4391330Z (Number Field in a2 with defining polynomial x^2 + 4, Ring morphism: 2024-12-18T08:35:49.4492300Z From: Number Field in a2 with defining polynomial x^2 + 4 2024-12-18T08:35:49.4602960Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4705310Z Defn: a2 |--> -2*a^3 - 7*a, None), 2024-12-18T08:35:49.4793770Z (Number Field in a3 with defining polynomial x^2 + 2, Ring morphism: 2024-12-18T08:35:49.4794540Z From: Number Field in a3 with defining polynomial x^2 + 2 2024-12-18T08:35:49.4795030Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4795830Z Defn: a3 |--> 2*a^3 + 5*a, None), 2024-12-18T08:35:49.4796320Z (Number Field in a4 with defining polynomial x^4 + 1, Ring morphism: 2024-12-18T08:35:49.4796780Z From: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.4797230Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4797760Z Defn: a4 |--> a^3 - 1/2*a^2 + 5/2*a - 3/4, Ring morphism: 2024-12-18T08:35:49.4798180Z From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4852940Z To: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.4987040Z Defn: a |--> -1/2*a4^3 - a4^2 - 1/2*a4) 2024-12-18T08:35:49.5088200Z ] ``` Uses https://pari.math.u- bordeaux.fr/dochtml/html/General_number_fields.html#se:nfsubfields internally. It doesn't state any resulting sort order, so I just reorder them (the discriminants are all distincts so it's fine). Alternatively it looks like just doctest against the `set()` of it might work. ------ URL: sagemath#39153 Reported by: user202729 Reviewer(s): Tobias Diez
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jan 12, 2025
sagemathgh-39153: Mark several tests as random to avoid test failure This fails sometimes in e.g. https://github.com/sagemath/sage/actions/ru ns/12388661556/job/34580166155?pr=39152#step:10:9714 Marking this as random looks reasonable because one of the test above (specifying the exact embedding) is also marked as random, and if the embedding is random then of course the element representation in terms of the generator `a` should also be random. More context: * the first `# random` is added first in https://github.com/sagemath/sag e/commit/37fc8e88689a0197c5513161b85b8bbadd5630ab#diff- c63508ebde0716605e6cdac05e43c8945616c2245158d30ff5ae39936ff4d9a0R1892 * then the note that `number_field_elements_from_algebraics` is OS- dependent ("32 versus 64 bit") is removed at https://github.com/sagemath /sage/commit/61e4df9fabf9e06a21d75eb6320ab3179bc28096 for reasons I can't figure out. (how to find out the discussion around a commit? it was before trac to GitHub migration) ------ Should the entry in `/.github/workflows/ci-conda-known-test- failures.json` be removed? ``` "sage.rings.qqbar": { "failed": "unreported failure on macOS seen in https://github.co m/sagemath/sage/actions/runs/9525536510/job/26259809272?pr=37998" }, ``` ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> ------ Other failing tests: ``` TESTS: Number fields defined by non-monic and non-integral polynomials are supported (:issue:`252`):: sage: K.<a> = NumberField(2*x^4 + 6*x^2 + 1/2) sage: K.optimized_subfields() [ (Number Field in a0 with defining polynomial x, Ring morphism: From: Number Field in a0 with defining polynomial x To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: 0 |--> 0, None), (Number Field in a1 with defining polynomial x^2 - 2*x + 2, Ring morphism: From: Number Field in a1 with defining polynomial x^2 - 2*x + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a1 |--> a^3 + 7/2*a + 1, None), (Number Field in a2 with defining polynomial x^2 - 2*x + 2, Ring morphism: From: Number Field in a2 with defining polynomial x^2 - 2*x + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a2 |--> -a^3 - 7/2*a + 1, None), (Number Field in a3 with defining polynomial x^2 - 2, Ring morphism: From: Number Field in a3 with defining polynomial x^2 - 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a3 |--> a^2 + 3/2, None), (Number Field in a4 with defining polynomial x^2 + 1, Ring morphism: From: Number Field in a4 with defining polynomial x^2 + 1 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a4 |--> a^3 + 7/2*a, None), (Number Field in a5 with defining polynomial x^2 + 2, Ring morphism: From: Number Field in a5 with defining polynomial x^2 + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a5 |--> 2*a^3 + 5*a, None), (Number Field in a6 with defining polynomial x^4 + 1, Ring morphism: From: Number Field in a6 with defining polynomial x^4 + 1 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a6 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4, Ring morphism: From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 To: Number Field in a6 with defining polynomial x^4 + 1 Defn: a |--> -1/2*a6^3 + a6^2 - 1/2*a6) ] ``` I look into what determines the ordering. It uses `_subfields_helper` which uses either `f.polred(2)` or `f.nfsubfields(degree)`, and there's no sorting going on. Conclusion: marking as `random sort order` is fine. In fact it doesn't even say which subfields should be returned exactly, and other tests in that function are marked as `# random` anyway, so marking as `# random` is fine. ------ ``` 2024-12-18T08:35:49.0399180Z File "src/sage/rings/number_field/number_field.py", line 8777, in sage.rings.number_field.number_field.NumberField_absolute.subfields 2024-12-18T08:35:49.0500510Z Failed example: 2024-12-18T08:35:49.0601390Z K.subfields() 2024-12-18T08:35:49.0707380Z Expected: 2024-12-18T08:35:49.0829700Z [ 2024-12-18T08:35:49.1013090Z (Number Field in a0 with defining polynomial x, Ring morphism: 2024-12-18T08:35:49.1114120Z From: Number Field in a0 with defining polynomial x 2024-12-18T08:35:49.1215190Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.1319910Z Defn: 0 |--> 0, None), 2024-12-18T08:35:49.1426370Z (Number Field in a1 with defining polynomial x^2 - 2, Ring morphism: 2024-12-18T08:35:49.1528730Z From: Number Field in a1 with defining polynomial x^2 - 2 2024-12-18T08:35:49.1631010Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.1659980Z Defn: a1 |--> a^2 + 3/2, None), 2024-12-18T08:35:49.1761220Z (Number Field in a2 with defining polynomial x^2 + 4, Ring morphism: 2024-12-18T08:35:49.1862420Z From: Number Field in a2 with defining polynomial x^2 + 4 2024-12-18T08:35:49.1970640Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2072220Z Defn: a2 |--> 2*a^3 + 7*a, None), 2024-12-18T08:35:49.2173950Z (Number Field in a3 with defining polynomial x^2 + 2, Ring morphism: 2024-12-18T08:35:49.2275370Z From: Number Field in a3 with defining polynomial x^2 + 2 2024-12-18T08:35:49.2368240Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2476650Z Defn: a3 |--> 2*a^3 + 5*a, None), 2024-12-18T08:35:49.2570570Z (Number Field in a4 with defining polynomial x^4 + 1, Ring morphism: 2024-12-18T08:35:49.2672100Z From: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.2774030Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2875400Z Defn: a4 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4, Ring morphism: 2024-12-18T08:35:49.2977450Z From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.3080080Z To: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.3179890Z Defn: a |--> -1/2*a4^3 + a4^2 - 1/2*a4) 2024-12-18T08:35:49.3281410Z ] 2024-12-18T08:35:49.3382370Z Got: 2024-12-18T08:35:49.3483260Z [ 2024-12-18T08:35:49.3584610Z (Number Field in a0 with defining polynomial x, Ring morphism: 2024-12-18T08:35:49.3643330Z From: Number Field in a0 with defining polynomial x 2024-12-18T08:35:49.3714430Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.3816090Z Defn: 0 |--> 0, None), 2024-12-18T08:35:49.3923670Z (Number Field in a1 with defining polynomial x^2 - 2, Ring morphism: 2024-12-18T08:35:49.4037810Z From: Number Field in a1 with defining polynomial x^2 - 2 2024-12-18T08:35:49.4142230Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4289560Z Defn: a1 |--> -a^2 - 3/2, None), 2024-12-18T08:35:49.4391330Z (Number Field in a2 with defining polynomial x^2 + 4, Ring morphism: 2024-12-18T08:35:49.4492300Z From: Number Field in a2 with defining polynomial x^2 + 4 2024-12-18T08:35:49.4602960Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4705310Z Defn: a2 |--> -2*a^3 - 7*a, None), 2024-12-18T08:35:49.4793770Z (Number Field in a3 with defining polynomial x^2 + 2, Ring morphism: 2024-12-18T08:35:49.4794540Z From: Number Field in a3 with defining polynomial x^2 + 2 2024-12-18T08:35:49.4795030Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4795830Z Defn: a3 |--> 2*a^3 + 5*a, None), 2024-12-18T08:35:49.4796320Z (Number Field in a4 with defining polynomial x^4 + 1, Ring morphism: 2024-12-18T08:35:49.4796780Z From: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.4797230Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4797760Z Defn: a4 |--> a^3 - 1/2*a^2 + 5/2*a - 3/4, Ring morphism: 2024-12-18T08:35:49.4798180Z From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4852940Z To: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.4987040Z Defn: a |--> -1/2*a4^3 - a4^2 - 1/2*a4) 2024-12-18T08:35:49.5088200Z ] ``` Uses https://pari.math.u- bordeaux.fr/dochtml/html/General_number_fields.html#se:nfsubfields internally. It doesn't state any resulting sort order, so I just reorder them (the discriminants are all distincts so it's fine). Alternatively it looks like just doctest against the `set()` of it might work. ------ URL: sagemath#39153 Reported by: user202729 Reviewer(s): Tobias Diez
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jan 16, 2025
sagemathgh-39153: Mark several tests as random to avoid test failure This fails sometimes in e.g. https://github.com/sagemath/sage/actions/ru ns/12388661556/job/34580166155?pr=39152#step:10:9714 Marking this as random looks reasonable because one of the test above (specifying the exact embedding) is also marked as random, and if the embedding is random then of course the element representation in terms of the generator `a` should also be random. More context: * the first `# random` is added first in https://github.com/sagemath/sag e/commit/37fc8e88689a0197c5513161b85b8bbadd5630ab#diff- c63508ebde0716605e6cdac05e43c8945616c2245158d30ff5ae39936ff4d9a0R1892 * then the note that `number_field_elements_from_algebraics` is OS- dependent ("32 versus 64 bit") is removed at https://github.com/sagemath /sage/commit/61e4df9fabf9e06a21d75eb6320ab3179bc28096 for reasons I can't figure out. (how to find out the discussion around a commit? it was before trac to GitHub migration) ------ Should the entry in `/.github/workflows/ci-conda-known-test- failures.json` be removed? ``` "sage.rings.qqbar": { "failed": "unreported failure on macOS seen in https://github.co m/sagemath/sage/actions/runs/9525536510/job/26259809272?pr=37998" }, ``` ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> ------ Other failing tests: ``` TESTS: Number fields defined by non-monic and non-integral polynomials are supported (:issue:`252`):: sage: K.<a> = NumberField(2*x^4 + 6*x^2 + 1/2) sage: K.optimized_subfields() [ (Number Field in a0 with defining polynomial x, Ring morphism: From: Number Field in a0 with defining polynomial x To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: 0 |--> 0, None), (Number Field in a1 with defining polynomial x^2 - 2*x + 2, Ring morphism: From: Number Field in a1 with defining polynomial x^2 - 2*x + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a1 |--> a^3 + 7/2*a + 1, None), (Number Field in a2 with defining polynomial x^2 - 2*x + 2, Ring morphism: From: Number Field in a2 with defining polynomial x^2 - 2*x + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a2 |--> -a^3 - 7/2*a + 1, None), (Number Field in a3 with defining polynomial x^2 - 2, Ring morphism: From: Number Field in a3 with defining polynomial x^2 - 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a3 |--> a^2 + 3/2, None), (Number Field in a4 with defining polynomial x^2 + 1, Ring morphism: From: Number Field in a4 with defining polynomial x^2 + 1 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a4 |--> a^3 + 7/2*a, None), (Number Field in a5 with defining polynomial x^2 + 2, Ring morphism: From: Number Field in a5 with defining polynomial x^2 + 2 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a5 |--> 2*a^3 + 5*a, None), (Number Field in a6 with defining polynomial x^4 + 1, Ring morphism: From: Number Field in a6 with defining polynomial x^4 + 1 To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 Defn: a6 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4, Ring morphism: From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 To: Number Field in a6 with defining polynomial x^4 + 1 Defn: a |--> -1/2*a6^3 + a6^2 - 1/2*a6) ] ``` I look into what determines the ordering. It uses `_subfields_helper` which uses either `f.polred(2)` or `f.nfsubfields(degree)`, and there's no sorting going on. Conclusion: marking as `random sort order` is fine. In fact it doesn't even say which subfields should be returned exactly, and other tests in that function are marked as `# random` anyway, so marking as `# random` is fine. ------ ``` 2024-12-18T08:35:49.0399180Z File "src/sage/rings/number_field/number_field.py", line 8777, in sage.rings.number_field.number_field.NumberField_absolute.subfields 2024-12-18T08:35:49.0500510Z Failed example: 2024-12-18T08:35:49.0601390Z K.subfields() 2024-12-18T08:35:49.0707380Z Expected: 2024-12-18T08:35:49.0829700Z [ 2024-12-18T08:35:49.1013090Z (Number Field in a0 with defining polynomial x, Ring morphism: 2024-12-18T08:35:49.1114120Z From: Number Field in a0 with defining polynomial x 2024-12-18T08:35:49.1215190Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.1319910Z Defn: 0 |--> 0, None), 2024-12-18T08:35:49.1426370Z (Number Field in a1 with defining polynomial x^2 - 2, Ring morphism: 2024-12-18T08:35:49.1528730Z From: Number Field in a1 with defining polynomial x^2 - 2 2024-12-18T08:35:49.1631010Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.1659980Z Defn: a1 |--> a^2 + 3/2, None), 2024-12-18T08:35:49.1761220Z (Number Field in a2 with defining polynomial x^2 + 4, Ring morphism: 2024-12-18T08:35:49.1862420Z From: Number Field in a2 with defining polynomial x^2 + 4 2024-12-18T08:35:49.1970640Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2072220Z Defn: a2 |--> 2*a^3 + 7*a, None), 2024-12-18T08:35:49.2173950Z (Number Field in a3 with defining polynomial x^2 + 2, Ring morphism: 2024-12-18T08:35:49.2275370Z From: Number Field in a3 with defining polynomial x^2 + 2 2024-12-18T08:35:49.2368240Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2476650Z Defn: a3 |--> 2*a^3 + 5*a, None), 2024-12-18T08:35:49.2570570Z (Number Field in a4 with defining polynomial x^4 + 1, Ring morphism: 2024-12-18T08:35:49.2672100Z From: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.2774030Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.2875400Z Defn: a4 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4, Ring morphism: 2024-12-18T08:35:49.2977450Z From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.3080080Z To: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.3179890Z Defn: a |--> -1/2*a4^3 + a4^2 - 1/2*a4) 2024-12-18T08:35:49.3281410Z ] 2024-12-18T08:35:49.3382370Z Got: 2024-12-18T08:35:49.3483260Z [ 2024-12-18T08:35:49.3584610Z (Number Field in a0 with defining polynomial x, Ring morphism: 2024-12-18T08:35:49.3643330Z From: Number Field in a0 with defining polynomial x 2024-12-18T08:35:49.3714430Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.3816090Z Defn: 0 |--> 0, None), 2024-12-18T08:35:49.3923670Z (Number Field in a1 with defining polynomial x^2 - 2, Ring morphism: 2024-12-18T08:35:49.4037810Z From: Number Field in a1 with defining polynomial x^2 - 2 2024-12-18T08:35:49.4142230Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4289560Z Defn: a1 |--> -a^2 - 3/2, None), 2024-12-18T08:35:49.4391330Z (Number Field in a2 with defining polynomial x^2 + 4, Ring morphism: 2024-12-18T08:35:49.4492300Z From: Number Field in a2 with defining polynomial x^2 + 4 2024-12-18T08:35:49.4602960Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4705310Z Defn: a2 |--> -2*a^3 - 7*a, None), 2024-12-18T08:35:49.4793770Z (Number Field in a3 with defining polynomial x^2 + 2, Ring morphism: 2024-12-18T08:35:49.4794540Z From: Number Field in a3 with defining polynomial x^2 + 2 2024-12-18T08:35:49.4795030Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4795830Z Defn: a3 |--> 2*a^3 + 5*a, None), 2024-12-18T08:35:49.4796320Z (Number Field in a4 with defining polynomial x^4 + 1, Ring morphism: 2024-12-18T08:35:49.4796780Z From: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.4797230Z To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4797760Z Defn: a4 |--> a^3 - 1/2*a^2 + 5/2*a - 3/4, Ring morphism: 2024-12-18T08:35:49.4798180Z From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2 2024-12-18T08:35:49.4852940Z To: Number Field in a4 with defining polynomial x^4 + 1 2024-12-18T08:35:49.4987040Z Defn: a |--> -1/2*a4^3 - a4^2 - 1/2*a4) 2024-12-18T08:35:49.5088200Z ] ``` Uses https://pari.math.u- bordeaux.fr/dochtml/html/General_number_fields.html#se:nfsubfields internally. It doesn't state any resulting sort order, so I just reorder them (the discriminants are all distincts so it's fine). Alternatively it looks like just doctest against the `set()` of it might work. ------ URL: sagemath#39153 Reported by: user202729 Reviewer(s): Tobias Diez
Contributor
Author
|
Looks like sorting by discriminant isn't sufficient, the embedding may be somewhat arbitrary. For example versus of course they're the same subfield. I guess we can't make that much assumption about them. |
5 tasks
vbraun
pushed a commit
to vbraun/sage
that referenced
this pull request
Jan 26, 2025
Fix issue pointed out in sagemath#39153 (comment) ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39377 Reported by: user202729 Reviewer(s):
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fails sometimes in e.g. https://github.com/sagemath/sage/actions/runs/12388661556/job/34580166155?pr=39152#step:10:9714
Marking this as random looks reasonable because one of the test above (specifying the exact embedding) is also marked as random, and if the embedding is random then of course the element representation in terms of the generator
ashould also be random.More context:
# randomis added first in 37fc8e8#diff-c63508ebde0716605e6cdac05e43c8945616c2245158d30ff5ae39936ff4d9a0R1892number_field_elements_from_algebraicsis OS-dependent ("32 versus 64 bit") is removed at 61e4df9 for reasons I can't figure out. (how to find out the discussion around a commit? it was before trac to GitHub migration)Should the entry in
/.github/workflows/ci-conda-known-test-failures.jsonbe removed?📝 Checklist
⌛ Dependencies
Other failing tests:
I look into what determines the ordering.
It uses
_subfields_helperwhich uses eitherf.polred(2)orf.nfsubfields(degree),and there's no sorting going on.
Conclusion: marking as
random sort orderis fine. In fact it doesn't even say which subfieldsshould be returned exactly, and other tests in that function are marked as
# randomanyway,so marking as
# randomis fine.Uses https://pari.math.u-bordeaux.fr/dochtml/html/General_number_fields.html#se:nfsubfields internally. It doesn't state any resulting sort order, so I just reorder them (the discriminants are all distincts so it's fine).
Alternatively it looks like just doctest against the
set()of it might work.