+1 for having the ambient group having a coercion from a subgroup. One 
other bug is that

sage: H.gen(0).parent() is G
True

sage: H([2])
f^2
sage: _.parent()
Multiplicative Abelian subgroup isomorphic to C3 generated by {f^2}

Best,
Travis


On Thursday, June 24, 2021 at 5:24:40 AM UTC+10 David Roe wrote:

> I agree that this is a bug.  There are several issues, and I don't know if 
> there's an easy fix.
>
> 1. The elements of the enumeration are produced by passing in exponent 
> vectors in terms of the generators of H:
> sage: H([1])
> f
> sage: H([1])^3
> 1
> It's unfortunate that we choose the same letter to represent the generator 
> of H as we do for the generator of G; this is just the default variable 
> name for multiplicative groups.
>
> 2. The generators of H are elements of G, not of H, but they print in a 
> reasonable way:
> sage: H.0
> f^2
> sage: (H.0).parent()
> Multiplicative Abelian group isomorphic to C6
> sage: H.0.parent() is G                                                   
>                                                               
> True
> I think that they should be elements of H, but that will mean they print 
> incorrectly unless we update the element class.
>
> 3. There is no coercion from H to G:
> sage: G.has_coerce_map_from(H)                                             
>                                                              
> False
> There should be.
>
> I'm not going to be able to work on this soon, but am happy to help advise 
> anyone who wants to.
> David
>
> On Wed, Jun 23, 2021 at 2:36 PM Altario <hamdad....@gmail.com> wrote:
>
>> SageMath version 9.0, Release Date: 2020-01-01
>> Using Python 3.8.5. 
>> Ubuntu 20.04 LTS 
>> 64bit
>>
>> Hi,
>>
>> I want to create the multiplicative group (Z/7Z)*={1,2,3,4,5,6}
>>
>> I did these steps:
>>
>> sage: 
>> n=7                                                                          
>>                  
>>  
>>
>> sage: 
>> Zn=Zmod(n)                                                                   
>>                  
>>  
>>
>> sage: G=Zn.unit_group()  
>>
>> sage: list(G) 
>>
>> [1, f, f^2, f^3, f^4, f^5]                                                   
>>                  
>>
>>
>> sage: 
>> G.inject_variables()                                                         
>>                  
>>  
>> Defining f
>>
>> Then I want to create the subgroups H generated by f^2=2 mod 7 which is {
>> 1,2,4}.
>>
>> I did the following steps:
>> sage: H = 
>> G.subgroup([f^2])                                                            
>>              
>>  
>>
>> sage: 
>> list(H)                                                                      
>>                  
>>  
>>
>> [1, f, f^2]
>>
>> sage: 
>> Zn(f)                                                                        
>>                  
>>  
>>
>> 3
>>
>> "There seems to be a bug in the subgroup method: H should consist of [1, 
>> f^2, f^4]."
>>  cf:
>>
>> https://ask.sagemath.org/question/57703/how-can-i-manipulate-a-multiplicative-group-of-zmodn/
>>
>> Is there a solution for this ? Or I miss something?
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "sage-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sage-devel+...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-devel/a5c47bce-605c-4c6f-93b5-8db638c30c2an%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/sage-devel/a5c47bce-605c-4c6f-93b5-8db638c30c2an%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/56e993ba-71ef-47e6-a896-451b69fbb819n%40googlegroups.com.

Reply via email to