#6079: [with patch, needs review] modernize base inclusion morphism of relative
number fields
---------------------------+------------------------------------------------
Reporter: ncalexan | Owner: was
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.0.1
Component: number theory | Keywords: base inclusion morphism relative
number field
---------------------------+------------------------------------------------
Comment(by fwclarke):
Some remarks about `recognize_in_subfield`
The function works fine for absolute fields and some
relative cases. But
{{{
sage: L.<a0, b0> = NumberField([x^4 + 2, x^4 + 3])
sage: K.<c> = NumberField(x^2 + 3)
sage: psi = K.embeddings(L)[0]
sage: psi(c)
b0^2
sage: L.recognize_in_subfield([2*b0^2 + 3])
Traceback (most recent call last)
...
TypeError: unsupported operand parent(s) for '*':
'Full MatrixSpace of 1 by 2 dense matrices over Number Field in b0 with
defining polynomial x^4 + 3'
and 'Vector space of dimension 2 over Number Field in c with defining
polynomial x^2 + 3'
}}}
I believe that this is solved by the following revision:
{{{
def recognize_in_subfield(self, K_into_self, elements_of_self):
V, _, self_into_V = self.absolute_vector_space()
K = K_into_self.domain()
U, U_into_K, _ = K.absolute_vector_space()
M = matrix(map(self_into_V * K_into_self * U_into_K, U.basis()))
es = matrix([ self_into_V(e) for e in elements_of_self ])
try:
vs = M.solve_left(es)
except:
raise ValueError, "Not all elements are in subfield"
return map(U_into_K, vs * U.basis())
}}}
so that, for example, the following works
{{{
sage: PQ.<X> = QQ[]
sage: F.<a, b> = NumberField([X^2 - 2, X^2 - 3])
sage: K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b)
sage: phi = F.embeddings(K)[2]; phi
Relative number field morphism:
From: Number Field in a with defining polynomial X^2 - 2 over its base
field
To: Number Field in c with defining polynomial Y^2 + (-2*b - 3)*a -
2*b - 6 over its base field
Defn: a |--> -a
b |--> b
sage: K.recognize_in_subfield(phi, [a, b])
[-a, b]
}}}
Another issue: `recognize_in_subfield` is a useful function, but I
don't think it should be defined to apply to a ''list'' of elements.
Conceptually
it is a function of a single element (and an inclusion), and the error
message "Not all elements are in subfield" is particularly unhelpful. I
know that since it uses linear algebra it is quicker to solve a list
all at once than one by one, but it's rather unlikely that this function
is
ever going to be used for a particularly large list, and a user for
whom speed was crucial could easily write an alternative.
I found the doctests for this function rather too technical, and too long
(in `number_field.py` only `NumberField` and `composite_fields` have
longer
doctests). A user who'd not used this function would suffer information
overload (129 lines of doctest). In particular, I don't understand the
first example at all. What is the section `n` doing there?
I would start off with a simple example (which as written depends
on the patch in #6091) like:
{{{
sage: L.<z> = NumberField(x^4 + 10*x^2 + 1)
sage: K.<a>, phi = L.subfield(z^3 + 11*z)
sage: L.recognize_in_subfield(phi, [3*z^3 + 33*z + 7])
(3*a + 7)
sage: phi(3*a + 7)
3*z^3 + 33*z + 7
sage: L.recognize_in_subfield(phi, [z^2])
Traceback (most recent call last):
...
ValueError: Not all elements are in subfield
}}}
Though, as I said, think I think the two applications of the function
should read:
{{{
sage: L.recognize_in_subfield(phi, 3*z^3 + 33*z + 7)
3*a + 7
}}}
and
{{{
sage: L.recognize_in_subfield(phi, z^2)
Traceback (most recent call last):
...
ValueError: z^2 is not in the image of
Ring morphism:
From: Number Field in a with defining polynomial x^2 + 12
To: Number Field in z with defining polynomial x^4 + 10*x^2 + 1
Defn: a |--> z^3 + 11*z
}}}
And then include a few more variants.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6079#comment:11>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---