Number fields bug?

19 views
Skip to first unread message

Mike OS

unread,
Jan 30, 2012, 6:07:46 PM1/30/12
to sage-support
Hi All,
I'm writing an intro to fields in sage for my students, starting with
number fields.
Experimenting a bit with different ways to define a number field to
see if there are differences.
I would like to choose one method for my students.

Do any of you have a preferred method?

I discovered the following, which seems buggy

sage: K.<a> = NumberField(x^3-2)
sage: K1 = QQ[2^(1/3)]
sage: K == K1
True
sage: K
Number Field in a with defining polynomial x^3 - 2
sage: K1
Number Field in a with defining polynomial x^3 - 2

sage: K.<a> = NumberField(x^2-2)
sage: K1 = QQ[2^(1/2)]
sage: K == K1
False
sage: K1
Number Field in sqrt2 with defining polynomial x^2 - 2
sage: K
Number Field in a with defining polynomial x^2 - 2

If anything the quadratic fields should be equal, since there is a
unique embedding,
and the cubic fields not equal since 2^(1/3) is understood to be the
unique real root,
and x^3-2 defines an unembedded field.

Thoughts?

Mike

Jeroen Demeyer

unread,
Jan 31, 2012, 11:47:57 AM1/31/12
to sage-s...@googlegroups.com
You are probably looking for

sage: K.is_isomorphic(K1)
True

The equality test == also checks that the name of the generator is the
same. In your case, they differ: "a" versus "sqrt2".

Mike OS

unread,
Feb 1, 2012, 12:28:00 AM2/1/12
to sage-support
Why does sage handle the two examples: 2^(1/3) and 2^(1/2)
differently?

I'm trying to understand when the are considered equal, as opposed to
just isomorphic.

Jeroen Demeyer

unread,
Feb 11, 2012, 4:18:48 PM2/11/12
to sage-s...@googlegroups.com
On 2012-02-01 06:28, Mike OS wrote:
> Why does sage handle the two examples: 2^(1/3) and 2^(1/2)
> differently?
It doesn't treat them differently.

Sage picks "a" as generator name which just happens to be the same
letter you used.

Keshav Kini

unread,
Feb 12, 2012, 5:40:06 AM2/12/12
to sage-s...@googlegroups.com
I guess his question is why Sage picks "a" (generic) as a generator name for QQ[2^(1/3)] but "sqrt2" (hard-coded) for QQ[2^(1/2)].

-Keshav

----
Join us in #sagemath on irc.freenode.net !

Mike OS

unread,
Feb 12, 2012, 2:46:18 PM2/12/12
to sage-support

On Feb 12, 2:40 am, Keshav Kini <keshav.k...@gmail.com> wrote:
> I guess his question is why Sage picks "a" (generic) as a generator name
> for QQ[2^(1/3)] but "sqrt2" (hard-coded) for QQ[2^(1/2)].
>
> -Keshav
>

Thanks for the comments, but let me explain the question a bit more
carefully.

As the code below shows, it doesnt seem to matter what I name the
generator.
In the case of 2^(1/3) the two fields, constructed differently and of
course isomorphic,
are actually equal.
In the case of 2^(1/2) they are not equal.

sage: F.<a> = NumberField(x^3-2)
sage: K.<b> = QQ[2^(1/3)]
sage: F == K
True
sage: F.<a> = NumberField(x^2-2)
sage: K.<b> = QQ[2^(1/2)]
sage: F == K
False

This is reversed from how I might imagine it should work.
I expect that QQ[x]/m(x) is abstractly defined, not necessarily
embedded into CC.
On the other hand QQ[ a ] for some algebraic number a is a specific
embedding.

In the case of deg m(x) = 2 there is only one embedding into CC, so I
can see
that sage might consider QQ[2^(1/2)] and NumberField(x^2-2) to be
equal.
(although there are two embeddings!)

For x^3-2 there is more than one embedding into CC, so I would not
expect
sage to consider the two constructions equal.

My main motivation is that I want to illustrate the theory of number
fields with
my students, including subtleties like the difference between a field,
defined
as the quotient of a polynomial ring, and a particular embedding.
In sage there are often many ways to construct the same object.
In some cases they are pseudonyms, in others there are fine
distinctions,
which can lead to confusion. I want to make this as smooth as
possible
for my students.

Thanks in advance for any insight offered.

Mike

Dima Pasechnik

unread,
Feb 13, 2012, 9:22:28 AM2/13/12
to sage-s...@googlegroups.com, sag...@googlegroups.com
In gmane.comp.mathematics.sage.support, you wrote:
>
> On Feb 12, 2:40 am, Keshav Kini <keshav.k...@gmail.com> wrote:
>> I guess his question is why Sage picks "a" (generic) as a generator name
>> for QQ[2^(1/3)] but "sqrt2" (hard-coded) for QQ[2^(1/2)].
>>
>> -Keshav
>>
>
> Thanks for the comments, but let me explain the question a bit more
> carefully.
>
> As the code below shows, it doesnt seem to matter what I name the
> generator.
> In the case of 2^(1/3) the two fields, constructed differently and of
> course isomorphic,
> are actually equal.
> In the case of 2^(1/2) they are not equal.
>
> sage: F.<a> = NumberField(x^3-2)
> sage: K.<b> = QQ[2^(1/3)]
> sage: F == K
> True
> sage: F.<a> = NumberField(x^2-2)
> sage: K.<b> = QQ[2^(1/2)]
> sage: F == K
> False

looks weird to me.
I cc this to sage-nt, just in case.

Dima

Marco Streng

unread,
Feb 13, 2012, 10:02:07 AM2/13/12
to sag...@googlegroups.com, sage-s...@googlegroups.com
On 13/02/2012 14:22, Dima Pasechnik wrote:
> In gmane.comp.mathematics.sage.support, you wrote:
>> On Feb 12, 2:40 am, Keshav Kini<keshav.k...@gmail.com> wrote:
>>> I guess his question is why Sage picks "a" (generic) as a generator name
>>> for QQ[2^(1/3)] but "sqrt2" (hard-coded) for QQ[2^(1/2)].
>>>
>>> -Keshav
>>>
>> Thanks for the comments, but let me explain the question a bit more
>> carefully.
>>
>> As the code below shows, it doesnt seem to matter what I name the
>> generator.
>> In the case of 2^(1/3) the two fields, constructed differently and of
>> course isomorphic,
>> are actually equal.
>> In the case of 2^(1/2) they are not equal.
>>
>> sage: F.<a> = NumberField(x^3-2)
>> sage: K.<b> = QQ[2^(1/3)]
>> sage: F == K
>> True

This is because "b" in K.<b> = ... is not really used in the
construction of QQ[2^(1/3)]:

sage: QQ[2^(1/3)]


Number Field in a with defining polynomial x^3 - 2

So QQ[2^(1/3)] constructs a number field with generator name "a" and
defining polynomial x^3-2. As you already have a field with generator
name "a" and polynomial x^3-2, they are identified. The fact that you
supplied the letter "b" is not used (which I think is a bug):

sage: K.<b> = QQ[2^(1/3)]

sage: K
Number Field in a with defining polynomial x^3 - 2

sage: b
a


>> sage: F.<a> = NumberField(x^2-2)
>> sage: K.<b> = QQ[2^(1/2)]
>> sage: F == K
>> False

Here it is slightly different. The number 2^(1/2) is sqrt(2), and Sage
then does not use the generic name "a", but the more useful name "sqrt2":

sage: QQ[2^(1/2)]


Number Field in sqrt2 with defining polynomial x^2 - 2

This time, F and K do not have the same generator name ("a" versus
"sqrt2").

If you now type
sage: L.<sqrt2> = NumberField(x^2-2)
sage: L == K
True

So it does matter what you name the variable. Testing equality of number
fields in Sage here just means: are variable names, defining polynomials
equal?

Reply all
Reply to author
Forward
0 new messages