archive/issues_020509.json:
{
"assignees": [],
"body": "<div id=\"comment:0\"></div>\n\nImplement the following pushout\n\n```\nsage: K.<a> = NumberField(x^2 - 3, embedding=AA(3)**(1/2))\nsage: L.<b> = NumberField(x^2 - 2, embedding=AA(2)**(1/2))\nsage: a+b\n3.146264369941973?\nsage: parent(_)\nAlgebraic Real Field\nsage: a < b\nFalse\n```\n\nCC: @jdemeyer @tscrim\n\nComponent: **number fields**\n\nKeywords: **days74, days84**\n\nAuthor: **Vincent Delecroix**\n\nBranch/Commit: **[`4a52745`](https://github.com/sagemath/sagetrac-mirror/commit/4a52745b734543ca8e65f2ac3050c9a73f223edd)**\n\nReviewer: **Jean-Philippe Labb\u00e9**\n\n_Issue created by migration from https://trac.sagemath.org/ticket/20746_\n\n",
"closed_at": "2017-03-08T18:45:56Z",
"created_at": "2016-06-01T10:28:19Z",
"labels": [
"https://github.com/sagemath/sage/labels/c%3A%20number%20fields",
"https://github.com/sagemath/sage/labels/p%3A%20major%20/%203",
"https://github.com/sagemath/sage/labels/enhancement"
],
"milestone": "https://github.com/sagemath/sage/milestones/sage-7.3",
"reactions": [],
"repository": "https://github.com/sagemath/sage",
"title": "Pushout for real embedded number fields",
"type": "issue",
"updated_at": "2017-03-08T18:45:56Z",
"url": "https://github.com/sagemath/sage/issues/20746",
"user": "https://github.com/videlec"
}
Implement the following pushout
sage: K.<a> = NumberField(x^2 - 3, embedding=AA(3)**(1/2))
sage: L.<b> = NumberField(x^2 - 2, embedding=AA(2)**(1/2))
sage: a+b
3.146264369941973?
sage: parent(_)
Algebraic Real Field
sage: a < b
False
CC: @jdemeyer @tscrim
Component: number fields
Keywords: days74, days84
Author: Vincent Delecroix
Branch/Commit: 4a52745
Reviewer: Jean-Philippe Labbé
Issue created by migration from https://trac.sagemath.org/ticket/20746
archive/issue_events_289522.json:
{
"actor": "https://github.com/videlec",
"created_at": "2016-06-01T10:28:19Z",
"event": "milestoned",
"issue": "https://github.com/sagemath/sage/issues/20746",
"milestone_number": null,
"milestone_title": "sage-7.3",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20746#event-289522"
}
archive/issue_events_289523.json:
{
"actor": "https://github.com/videlec",
"created_at": "2016-06-01T10:28:19Z",
"event": "labeled",
"issue": "https://github.com/sagemath/sage/issues/20746",
"label": "https://github.com/sagemath/sage/labels/c%3A%20number%20fields",
"label_color": "0000ff",
"label_name": "c: number fields",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20746#event-289523"
}
archive/issue_events_289524.json:
{
"actor": "https://github.com/videlec",
"created_at": "2016-06-01T10:28:19Z",
"event": "labeled",
"issue": "https://github.com/sagemath/sage/issues/20746",
"label": "https://github.com/sagemath/sage/labels/p%3A%20major%20/%203",
"label_color": "ffbb00",
"label_name": "p: major / 3",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20746#event-289524"
}
archive/issue_events_289525.json:
{
"actor": "https://github.com/videlec",
"created_at": "2016-06-01T10:28:19Z",
"event": "labeled",
"issue": "https://github.com/sagemath/sage/issues/20746",
"label": "https://github.com/sagemath/sage/labels/enhancement",
"label_color": "696969",
"label_name": "enhancement",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20746#event-289525"
}
archive/issue_comments_300771.json:
{
"body": "Branch: **[u/vdelecroix/20746](https://github.com/sagemath/sagetrac-mirror/tree/u/vdelecroix/20746)**",
"created_at": "2016-06-01T10:29:10Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20746",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20746#issuecomment-300771",
"user": "https://github.com/videlec"
}
Branch: u/vdelecroix/20746
archive/issue_comments_300772.json:
{
"body": "Commit: **[`4a52745`](https://github.com/sagemath/sagetrac-mirror/commit/4a52745b734543ca8e65f2ac3050c9a73f223edd)**",
"created_at": "2016-06-01T10:29:10Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20746",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20746#issuecomment-300772",
"user": "https://github.com/videlec"
}
Commit: 4a52745
archive/issue_events_289526.json:
{
"actor": "https://github.com/videlec",
"created_at": "2016-06-01T10:29:10Z",
"event": "labeled",
"issue": "https://github.com/sagemath/sage/issues/20746",
"label": "https://github.com/sagemath/sage/labels/needs%20review",
"label_color": "7fff00",
"label_name": "needs review",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20746#event-289526"
}
archive/issue_comments_300773.json:
{
"body": "<div id=\"comment:1\"></div>\n\nNew commits:\n<table><tr><td><a href=\"https://github.com/sagemath/sagetrac-mirror/commit/4a52745b734543ca8e65f2ac3050c9a73f223edd\"><code>4a52745</code></a></td><td><code>Trac 20746: pushout for real embedded number fields</code></td></tr></table>\n",
"created_at": "2016-06-01T10:29:10Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20746",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20746#issuecomment-300773",
"user": "https://github.com/videlec"
}
New commits:
4a52745 | Trac 20746: pushout for real embedded number fields |
archive/issue_comments_300774.json:
{
"body": "Description changed:\n``````diff\n--- \n+++ \n@@ -7,4 +7,6 @@\n 3.146264369941973?\n sage: parent(_)\n Algebraic Real Field\n+sage: a < b\n+False\n ```\n``````\n",
"created_at": "2016-06-01T10:34:13Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20746",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20746#issuecomment-300774",
"user": "https://github.com/videlec"
}
Description changed:
---
+++
@@ -7,4 +7,6 @@
3.146264369941973?
sage: parent(_)
Algebraic Real Field
+sage: a < b
+False
```
archive/issue_events_289527.json:
{
"actor": "https://github.com/pjbruin",
"created_at": "2016-06-01T11:23:15Z",
"event": "unlabeled",
"issue": "https://github.com/sagemath/sage/issues/20746",
"label": "https://github.com/sagemath/sage/labels/needs%20review",
"label_color": "7fff00",
"label_name": "needs review",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20746#event-289527"
}
archive/issue_events_289528.json:
{
"actor": "https://github.com/pjbruin",
"created_at": "2016-06-01T11:23:15Z",
"event": "labeled",
"issue": "https://github.com/sagemath/sage/issues/20746",
"label": "https://github.com/sagemath/sage/labels/needs%20work",
"label_color": "ffff00",
"label_name": "needs work",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20746#event-289528"
}
archive/issue_comments_300775.json:
{
"body": "<div id=\"comment:4\" align=\"right\">comment:4</div>\n\nIsn't it a bit drastic to declare `AA` to be the pushout rather than to create a suitable number field? I think a better solution would be to use the existing `composite_fields()` method, which respects embeddings:\n\n```diff\n--- a/src/sage/rings/number_field/number_field_base.pyx\n+++ b/src/sage/rings/number_field/number_field_base.pyx\n@@ -350,3 +350,7 @@ cdef class NumberField(Field):\n else:\n raise ValueError(\"No embedding set. You need to specify a a real embedding.\")\n \n+ def _pushout_(self, other):\n+ if (isinstance(other, NumberField) and self._embedded_real and\n+ (<NumberField>other)._embedded_real):\n+ return self.composite_fields(other)[0]\n```\nThis makes the examples in the current branch work just as well (you can see the numerical values after coercing into `AA`).",
"created_at": "2016-06-01T11:23:15Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20746",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20746#issuecomment-300775",
"user": "https://github.com/pjbruin"
}
Isn't it a bit drastic to declare AA
to be the pushout rather than to create a suitable number field? I think a better solution would be to use the existing composite_fields()
method, which respects embeddings:
--- a/src/sage/rings/number_field/number_field_base.pyx
+++ b/src/sage/rings/number_field/number_field_base.pyx
@@ -350,3 +350,7 @@ cdef class NumberField(Field):
else:
raise ValueError("No embedding set. You need to specify a a real embedding.")
+ def _pushout_(self, other):
+ if (isinstance(other, NumberField) and self._embedded_real and
+ (<NumberField>other)._embedded_real):
+ return self.composite_fields(other)[0]
This makes the examples in the current branch work just as well (you can see the numerical values after coercing into AA
).
archive/issue_comments_300776.json:
{
"body": "<div id=\"comment:5\" align=\"right\">comment:5</div>\n\nFair enough. Though it is more expensive.",
"created_at": "2016-06-01T12:00:57Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20746",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20746#issuecomment-300776",
"user": "https://github.com/videlec"
}
Fair enough. Though it is more expensive.
archive/issue_comments_300777.json:
{
"body": "<div id=\"comment:6\" align=\"right\">comment:6</div>\n\nAnd this is order dependent\n\n```\nsage: K.<a> = NumberField(x^2 - 3, embedding=AA(3)**(1/2))\nsage: L.<b> = NumberField(x^2 - 2, embedding=AA(2)**(1/2))\nsage: a+b\nab^3 - 10*ab\n```\nversus\n\n```\nsage: K.<a> = NumberField(x^2 - 3, embedding=AA(3)**(1/2))\nsage: L.<b> = NumberField(x^2 - 2, embedding=AA(2)**(1/2))\nsage: b+a\n-ba^3 + 10*ba\n```",
"created_at": "2016-06-01T12:08:05Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20746",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20746#issuecomment-300777",
"user": "https://github.com/videlec"
}
And this is order dependent
sage: K.<a> = NumberField(x^2 - 3, embedding=AA(3)**(1/2))
sage: L.<b> = NumberField(x^2 - 2, embedding=AA(2)**(1/2))
sage: a+b
ab^3 - 10*ab
versus
sage: K.<a> = NumberField(x^2 - 3, embedding=AA(3)**(1/2))
sage: L.<b> = NumberField(x^2 - 2, embedding=AA(2)**(1/2))
sage: b+a
-ba^3 + 10*ba
archive/issue_events_289529.json:
{
"actor": "https://github.com/videlec",
"created_at": "2016-06-02T04:20:05Z",
"event": "unlabeled",
"issue": "https://github.com/sagemath/sage/issues/20746",
"label": "https://github.com/sagemath/sage/labels/needs%20work",
"label_color": "ffff00",
"label_name": "needs work",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20746#event-289529"
}
archive/issue_events_289530.json:
{
"actor": "https://github.com/videlec",
"created_at": "2016-06-02T04:20:05Z",
"event": "labeled",
"issue": "https://github.com/sagemath/sage/issues/20746",
"label": "https://github.com/sagemath/sage/labels/needs%20review",
"label_color": "7fff00",
"label_name": "needs review",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20746#event-289530"
}
archive/issue_comments_300778.json:
{
"body": "<div id=\"comment:8\" align=\"right\">comment:8</div>\n\nThis coercion has its advantages:\n\n- makes it possible to do arithmetic operations with elements with two different `NumberFields` as parents. Right now returns a TypeError:\n\n```\n sage: J = NumberField(x^2 - 2,'s')\n sage: s = J.gens()[0]\n sage: K = NumberField(x^3 - 2,'t')\n sage: t = K.gens()[0]\n sage: s * t\n Traceback (most recent call last):\n ...\n TypeError: unsupported operand parent(s) for *: ...\n```\n- It is lazy, it does have to compute the join.\n\nDepending on the usage, one may want to get the join of the fields using `composite_field`, this introduces another variable and is order dependant. I guess that if one wants to do computations on the long run with that field, one would already use the right field from start.\n\nIMHO, this ticket already fixes an operation that one would naturally want to have at hand. So, I would make this a positive review.",
"created_at": "2017-03-05T23:33:56Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20746",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20746#issuecomment-300778",
"user": "https://github.com/jplab"
}
This coercion has its advantages:
- makes it possible to do arithmetic operations with elements with two different
NumberFields
as parents. Right now returns a TypeError:
sage: J = NumberField(x^2 - 2,'s')
sage: s = J.gens()[0]
sage: K = NumberField(x^3 - 2,'t')
sage: t = K.gens()[0]
sage: s * t
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for *: ...
- It is lazy, it does have to compute the join.
Depending on the usage, one may want to get the join of the fields using composite_field
, this introduces another variable and is order dependant. I guess that if one wants to do computations on the long run with that field, one would already use the right field from start.
IMHO, this ticket already fixes an operation that one would naturally want to have at hand. So, I would make this a positive review.
archive/issue_events_289531.json:
{
"actor": "https://github.com/jplab",
"created_at": "2017-03-05T23:34:10Z",
"event": "unlabeled",
"issue": "https://github.com/sagemath/sage/issues/20746",
"label": "https://github.com/sagemath/sage/labels/needs%20review",
"label_color": "7fff00",
"label_name": "needs review",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20746#event-289531"
}
archive/issue_events_289532.json:
{
"actor": "https://github.com/jplab",
"created_at": "2017-03-05T23:34:10Z",
"event": "labeled",
"issue": "https://github.com/sagemath/sage/issues/20746",
"label": "https://github.com/sagemath/sage/labels/positive%20review",
"label_color": "dfffc0",
"label_name": "positive review",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20746#event-289532"
}
archive/issue_comments_300779.json:
{
"body": "Reviewer: **Jean-Philippe Labb\u00e9**",
"created_at": "2017-03-05T23:34:37Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20746",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20746#issuecomment-300779",
"user": "https://github.com/jplab"
}
Reviewer: Jean-Philippe Labbé
archive/issue_comments_300780.json:
{
"body": "Changed keywords from **days74** to **days74, days84**",
"created_at": "2017-03-05T23:35:01Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20746",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20746#issuecomment-300780",
"user": "https://github.com/jplab"
}
Changed keywords from days74 to days74, days84
archive/issue_events_289533.json:
{
"actor": "https://github.com/vbraun",
"created_at": "2017-03-08T18:45:56Z",
"event": "unlabeled",
"issue": "https://github.com/sagemath/sage/issues/20746",
"label": "https://github.com/sagemath/sage/labels/positive%20review",
"label_color": "dfffc0",
"label_name": "positive review",
"label_text_color": "ffffff",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20746#event-289533"
}
archive/issue_events_289534.json:
{
"actor": "https://github.com/vbraun",
"commit_id": "915772c2074ea7eda42f7b777001eaf2c3b8f923",
"commit_repository": "https://github.com/sagemath/sage",
"created_at": "2017-03-08T18:45:56Z",
"event": "closed",
"issue": "https://github.com/sagemath/sage/issues/20746",
"type": "issue_event",
"url": "https://github.com/sagemath/sage/issues/20746#event-289534"
}
archive/issue_comments_300781.json:
{
"body": "Changed branch from **[u/vdelecroix/20746](https://github.com/sagemath/sagetrac-mirror/tree/u/vdelecroix/20746)** to **[`4a52745`](https://github.com/sagemath/sagetrac-mirror/commit/4a52745b734543ca8e65f2ac3050c9a73f223edd)**",
"created_at": "2017-03-08T18:45:56Z",
"formatter": "markdown",
"issue": "https://github.com/sagemath/sage/issues/20746",
"type": "issue_comment",
"url": "https://github.com/sagemath/sage/issues/20746#issuecomment-300781",
"user": "https://github.com/vbraun"
}
Changed branch from u/vdelecroix/20746 to 4a52745