On 23 November 2016 at 14:49, Simon King <[email protected]> wrote:
> Hi,
>
> On 2016-11-23, Friedrich Wiemer <[email protected]> wrote:
>> not sure if this make sense: I would like to convert elements
>> from a ring to elements in the ring's unit group (with raising
>> exceptions, if the ring element is not in the unit group).
>> So what I'm looking for is basically the "inversion" of:
>> R(R.unit_group().random_element())
>
> Does R.unit_group()(R.random_element()) not do what you describe?
>
> That said, I am not sure if R.unit_group() is implemented for any
> interesting class of rings in Sage. According to
> sage: search_def("unit_group")
> there is only one method called "unit_group", which is for number
> fields. Rather strange for me, because the algebraic notion of a unit
> group is not very interesting for a *field*! But perhaps the number
> theorists have a different notion-
Inded we do. The unit group of a number field means the group of
units of its ring of integers. e.g. the unit group of QQ is {-1,+1}.
> --which one are you talking about?
>
> Anyway.
>
> Looking at the example of the "unit_group" method, I get this:
> sage: x = QQ['x'].0
> sage: A = x^4 - 10*x^3 + 20*5*x^2 - 15*5^2*x + 11*5^3
> sage: K.<a> = NumberField(A)
> sage: U = K.unit_group()
> sage: U(a)
> Traceback (most recent call last)
> ...
> ValueError: a is not a unit
> sage: ~a
> -1/1375*a^3 + 2/275*a^2 - 4/55*a + 3/11
>
> Hence, if we talk about the algebraic notion of a unit of the ring K,
> the above is wrong. However, it seems that the unit group of a number
> field is meant to be the unit group of the ring of integers of the
> number field. So, let's try again:
>
> sage: R = K.ring_of_integers()
> sage: while 1:
> ....: u = R.random_element()
> ....: if u != 0 and ~u in R:
> ....: break
> ....:
> sage: u
> 1
> sage: U(u)
> 1
>
> More interesting example:
>
> sage: U.gens_values()
> [-7/275*a^3 + 1/11*a^2 - 9/11*a - 1, 7/275*a^3 - 1/11*a^2 +
> 9/11*a + 2]
> sage: u = (7/275*a^3 - 1/11*a^2 + 9/11*a + 2)^2
> sage: u
> 13/275*a^3 - 14/55*a^2 + 23/11*a - 1
> sage: u.parent()
> Number Field in a with defining polynomial x^4 - 10*x^3 +
> 100*x^2 - 375*x + 1375
> sage: U(u)
> u1^2
> sage: _.parent()
> Unit group with structure C10 x Z of Number Field in a with
> defining polynomial x^4 - 10*x^3 + 100*x^2 - 375*x + 1375
>
> So, in summary, the usual conversion syntax should just work.
Here is another example:
sage: R = Integers(10)
sage: R.unit_group()
Multiplicative Abelian group isomorphic to C4
but unfortunately
sage: G = R.unit_group()
sage: R(3)
3
sage: G(R(3))
...
TypeError: 'sage.rings.finite_rings.integer_mod.IntegerMod_int' object
is not iterable
shows that this is not us useful as yo uwould like. And this might
surprise you too:
sage: G
Multiplicative Abelian group isomorphic to C4
sage: G.list()
(1, f, f^2, f^3)
i.e. G is an abstract multiplcative cyclic group. But is does
remember where its elements really live:
sage: [g.value() for g in G.list()]
[1, 7, 9, 3]
John
>
> Best regards,
> Simon
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.