Re: [sage-devel] Bug in .subgroup?

2024-04-04 Thread Dima Pasechnik
On Thu, Apr 4, 2024 at 11:07 AM Dima Pasechnik  wrote:
>
> Yes, it's surely a bug; this example gives |gg|=2^27 (wow!), or a smaller one:
>
> sage: g=AbelianGroup([2,2])
> sage: gg=g.subgroup(g.list())
> sage: gg.cardinality().factor() # what?
> 2^3
> sage: g.cardinality().factor()
> 2^2
>
> Maybe related to https://github.com/sagemath/sage/pull/36986 ?

yes, indeed, it came from https://github.com/sagemath/sage/pull/36986
I've opened https://github.com/sagemath/sage/issues/37744

>
> On Thu, Apr 4, 2024 at 10:24 AM 'B. L.' via sage-devel
>  wrote:
> >
> > Hello,
> > to me it seems that with 10.3 there might be a bug in ".subgroup", see 
> > example below. The subgroup cardinality is wrong and the equality test of 
> > the group and the subgroup generated by all group elements yields "False". 
> > In previous versionls of SAGE this worked as expected.
> > Can anybody help?
> > Thanks and kind regards,
> > Barbara
> >
> >
> > sage: g = AbelianGroup([4, 4])
> > sage: gg = g.subgroup(g.list())
> > sage: g
> > Multiplicative Abelian group isomorphic to C4 x C4
> > sage: gg
> > Multiplicative Abelian subgroup isomorphic to C4 x C4 generated by {f1, 
> > f1^2, f1^3, f0, f0*f1, f0*f1^2, f0*f1^3, f0^2, f0^2*f1, f0^2*f1^2, 
> > f0^2*f1^3, f0^3, f0^3*f1, f0^3*f1^2, f0^3*f1^3}
> > sage: g.cardinality()
> > 16
> > sage: gg.cardinality()
> > 134217728
> > sage: g==gg
> > False
> >
> > --
> > 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/55ecbb00-3927-4339-8cb3-f68347358446n%40googlegroups.com.

-- 
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/CAAWYfq17xtj%2BroU9QWBMF6DV4HmPRg4EmgpXnLRzsad%2BZ8k6MA%40mail.gmail.com.


Re: [sage-devel] Bug in .subgroup?

2024-04-04 Thread Dima Pasechnik
Yes, it's surely a bug; this example gives |gg|=2^27 (wow!), or a smaller one:

sage: g=AbelianGroup([2,2])
sage: gg=g.subgroup(g.list())
sage: gg.cardinality().factor() # what?
2^3
sage: g.cardinality().factor()
2^2

Maybe related to https://github.com/sagemath/sage/pull/36986 ?

On Thu, Apr 4, 2024 at 10:24 AM 'B. L.' via sage-devel
 wrote:
>
> Hello,
> to me it seems that with 10.3 there might be a bug in ".subgroup", see 
> example below. The subgroup cardinality is wrong and the equality test of the 
> group and the subgroup generated by all group elements yields "False". In 
> previous versionls of SAGE this worked as expected.
> Can anybody help?
> Thanks and kind regards,
> Barbara
>
>
> sage: g = AbelianGroup([4, 4])
> sage: gg = g.subgroup(g.list())
> sage: g
> Multiplicative Abelian group isomorphic to C4 x C4
> sage: gg
> Multiplicative Abelian subgroup isomorphic to C4 x C4 generated by {f1, f1^2, 
> f1^3, f0, f0*f1, f0*f1^2, f0*f1^3, f0^2, f0^2*f1, f0^2*f1^2, f0^2*f1^3, f0^3, 
> f0^3*f1, f0^3*f1^2, f0^3*f1^3}
> sage: g.cardinality()
> 16
> sage: gg.cardinality()
> 134217728
> sage: g==gg
> False
>
> --
> 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/55ecbb00-3927-4339-8cb3-f68347358446n%40googlegroups.com.

-- 
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/CAAWYfq12wP_ANzFv7RqPVrw1CTDRa8MuU0MA%2BXBXS6RnUGSKHQ%40mail.gmail.com.


[sage-devel] Bug in .subgroup?

2024-04-04 Thread 'B. L.' via sage-devel
Hello,
to me it seems that with 10.3 there might be a bug in ".subgroup", see 
example below. The subgroup cardinality is wrong and the equality test of 
the group and the subgroup generated by all group elements yields "False". 
In previous versionls of SAGE this worked as expected.
Can anybody help?
Thanks and kind regards,
Barbara


sage: g = AbelianGroup([4, 4])
sage: gg = g.subgroup(g.list())
sage: g
Multiplicative Abelian group isomorphic to C4 x C4
sage: gg
Multiplicative Abelian subgroup isomorphic to C4 x C4 generated by {f1, 
f1^2, f1^3, f0, f0*f1, f0*f1^2, f0*f1^3, f0^2, f0^2*f1, f0^2*f1^2, 
f0^2*f1^3, f0^3, f0^3*f1, f0^3*f1^2, f0^3*f1^3}
sage: g.cardinality()
16
sage: gg.cardinality()
134217728
sage: g==gg
False

-- 
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/55ecbb00-3927-4339-8cb3-f68347358446n%40googlegroups.com.


Re: [sage-devel] Bug with subgroup method?

2021-06-26 Thread Mickaël Hamdad
Thank you


Le jeu. 24 juin 2021 à 22:00, David Roe  a écrit :

> H.0 is Sage notation for the 1st generator of H.
>
> sage: preparse("H.0")
>
> 'H.gen(0)'
>
> As for getting the value, it depends on what kind of element you have.
>
> sage: H.0._exponents
>
> (2,)
> sage: H.0.value()
>
> 2
> sage: H([1])._exponents
>
> (1,)
> sage: H([1]).value()
> Traceback (most recent call last):
> ...
> AttributeError...
>
> Also remember that the exponent vectors depend on the context: H.0 is an
> element of G (inappropriately in my opinion) and is thus expressed in terms
> of a generator of G, while H([1]) is in terms of a generator H.
> David
>
>
>
> On Thu, Jun 24, 2021 at 3:53 PM Mickaël Hamdad 
> wrote:
>
>> And Is there a way to list H directly with numerical values ?
>>
>> Le jeu. 24 juin 2021 à 21:48, Mickaël Hamdad 
>> a écrit :
>>
>>> Thank you very much
>>> Just what H.0 mean ?
>>>
>>> Le jeu. 24 juin 2021 à 10:21, Samuel Lelievre 
>>> a écrit :
>>>
 Also discussed at Ask Sage:

 - Ask Sage question 57703
   Multiplicative group of Zmod(n)
   https://ask.sagemath.org/question/57703

 --
 You received this message because you are subscribed to a topic in the
 Google Groups "sage-devel" group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/sage-devel/D3zdWqswrFo/unsubscribe.
 To unsubscribe from this group and all its topics, 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/0989e81f-6497-4f09-8a51-5311c838773an%40googlegroups.com
 
 .

>>> --
>> 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/CAHJeuofvY5btZv%2BT3gWeb4C8hU7aTiNUHrsD%2BdhTDcbKpnn2Xw%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-devel" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-devel/D3zdWqswrFo/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAChs6_n76QpcABp7uzmMTXJ%3D-pdybPi7uyZQhu%3Dkad1kmZN2sA%40mail.gmail.com
> 
> .
>

-- 
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/CAHJeuociSAdvYRXX%2BxFrBKa311y820okqWTbQ1YE3KvCBJuyfQ%40mail.gmail.com.


Re: [sage-devel] Bug with subgroup method?

2021-06-24 Thread David Roe
H.0 is Sage notation for the 1st generator of H.

sage: preparse("H.0")

'H.gen(0)'

As for getting the value, it depends on what kind of element you have.

sage: H.0._exponents

(2,)
sage: H.0.value()

2
sage: H([1])._exponents

(1,)
sage: H([1]).value()
Traceback (most recent call last):
...
AttributeError...

Also remember that the exponent vectors depend on the context: H.0 is an
element of G (inappropriately in my opinion) and is thus expressed in terms
of a generator of G, while H([1]) is in terms of a generator H.
David



On Thu, Jun 24, 2021 at 3:53 PM Mickaël Hamdad 
wrote:

> And Is there a way to list H directly with numerical values ?
>
> Le jeu. 24 juin 2021 à 21:48, Mickaël Hamdad  a
> écrit :
>
>> Thank you very much
>> Just what H.0 mean ?
>>
>> Le jeu. 24 juin 2021 à 10:21, Samuel Lelievre 
>> a écrit :
>>
>>> Also discussed at Ask Sage:
>>>
>>> - Ask Sage question 57703
>>>   Multiplicative group of Zmod(n)
>>>   https://ask.sagemath.org/question/57703
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "sage-devel" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/sage-devel/D3zdWqswrFo/unsubscribe.
>>> To unsubscribe from this group and all its topics, 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/0989e81f-6497-4f09-8a51-5311c838773an%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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/CAHJeuofvY5btZv%2BT3gWeb4C8hU7aTiNUHrsD%2BdhTDcbKpnn2Xw%40mail.gmail.com
> 
> .
>

-- 
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/CAChs6_n76QpcABp7uzmMTXJ%3D-pdybPi7uyZQhu%3Dkad1kmZN2sA%40mail.gmail.com.


Re: [sage-devel] Bug with subgroup method?

2021-06-24 Thread Mickaël Hamdad
And Is there a way to list H directly with numerical values ?

Le jeu. 24 juin 2021 à 21:48, Mickaël Hamdad  a
écrit :

> Thank you very much
> Just what H.0 mean ?
>
> Le jeu. 24 juin 2021 à 10:21, Samuel Lelievre 
> a écrit :
>
>> Also discussed at Ask Sage:
>>
>> - Ask Sage question 57703
>>   Multiplicative group of Zmod(n)
>>   https://ask.sagemath.org/question/57703
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "sage-devel" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/sage-devel/D3zdWqswrFo/unsubscribe.
>> To unsubscribe from this group and all its topics, 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/0989e81f-6497-4f09-8a51-5311c838773an%40googlegroups.com
>> 
>> .
>>
>

-- 
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/CAHJeuofvY5btZv%2BT3gWeb4C8hU7aTiNUHrsD%2BdhTDcbKpnn2Xw%40mail.gmail.com.


Re: [sage-devel] Bug with subgroup method?

2021-06-24 Thread Mickaël Hamdad
Thank you very much
Just what H.0 mean ?

Le jeu. 24 juin 2021 à 10:21, Samuel Lelievre  a
écrit :

> Also discussed at Ask Sage:
>
> - Ask Sage question 57703
>   Multiplicative group of Zmod(n)
>   https://ask.sagemath.org/question/57703
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-devel" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-devel/D3zdWqswrFo/unsubscribe.
> To unsubscribe from this group and all its topics, 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/0989e81f-6497-4f09-8a51-5311c838773an%40googlegroups.com
> 
> .
>

-- 
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/CAHJeuoeZ2kdbTTAJbJydPpsJ5Nc4uM-85-2Yt-uA2O9Ec%2Bbr4g%40mail.gmail.com.


Re: [sage-devel] Bug with subgroup method?

2021-06-24 Thread Samuel Lelievre
Also discussed at Ask Sage:

- Ask Sage question 57703
  Multiplicative group of Zmod(n)
  https://ask.sagemath.org/question/57703

-- 
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/0989e81f-6497-4f09-8a51-5311c838773an%40googlegroups.com.


Re: [sage-devel] Bug with subgroup method?

2021-06-23 Thread 'Travis Scrimshaw' via sage-devel
+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  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
>>  
>> 
>> .
>>
>

-- 
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.


Re: [sage-devel] Bug with subgroup method?

2021-06-23 Thread David Roe
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  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+unsubscr...@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
> 
> .
>

-- 
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/CAChs6_%3DEmycxmMizgfos5Zy%3D3-7TaVzQOGuFsQaLzRZoOE8ASw%40mail.gmail.com.


[sage-devel] Bug with subgroup method?

2021-06-23 Thread Altario
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+unsubscr...@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.