Re: [sage-support] Re: Rendering tables in jupyter notebook

2022-11-20 Thread Emmanuel Charpentier

Le dimanche 20 novembre 2022 à 19:16:44 UTC+1, gauri...@gmail.com a écrit :

> Thanks! I will ask on the Jupyter mailing list. 
>
>>
>> Also is it possible for me to write [image: x^k-1] for various powers of 
>> [image: 
>> k] in latex in place of [image: x^k+2]. i.e. I want to write -1 wherever 
>> there is a 2 in the left column. Sure I can do this with print, but the 
>> output won’t be Latex rendered.
>
>
> I apologize that it was terribly worded.   It was just a dumb question 
> that occured while trying to understand how the `table` function outputs 
> data into a jupyter notebook cell. 
>
> I basically wanted the left hand-side to contain [image: x^k-1] in place 
> of [image: x^k+2] for different values of [image: k] i.e. [image: x-1] in 
> place of [image: x+2]  
>  [image: x^2-1] in place of [image: x^2+2] and so on.  I *know* of course 
> -1 and 2  are identical in Z/3Z, but I was wondering if there was a  way to 
> *display* (-1) in place of 2 while using the `table` command and working 
> Z/3Z. 
>

I doubt it : Sage is strngly opinionated (you could say asinine) about its 
presentation choices, and, for example, systematically rewrite `1/sqrt(2)` 
as `sqrt(2)/2`. Even if you sacrifice a goat ;-)...
 

> Regards
> G
>
> On Sun, Nov 20, 2022 at 3:36 PM Emmanuel Charpentier <
> emanuel.c...@gmail.com> wrote:
>
>> > How can I ask Sage to place each factorization in the right column on a 
>> single line.
>>
>> Both the display in a console and the LaTeX display given by `view` are 
>> single-lined. I can reproduce your problem in Jupyter ; therefore, I think 
>> that the question should be directed to a Jupyter-centered mailing list, 
>> newsgroup, forum or whatever...
>>
>> > Also is it possible for me to write x^k-1 for various powers of k in 
>> latex in place of x^k+2. i.e. I want to write -1 wherever there is a 2 in 
>> the left column. Sure I can do this with print, but the output won’t be 
>> Latex rendered.
>>
>> I cant't make head or tail of this gibberish. Could you rephrase ?
>>
>> HTH,
>>
>> Le dimanche 20 novembre 2022 à 07:39:27 UTC+1, gauri...@gmail.com a 
>> écrit :
>>
>>> I want to create a neat table of the factorization of several 
>>> polynomials of the form [image: x^n-1] in the ring Z/3Z [x]. 
>>>
>>> This is my code, which I am using inside of a Jupyter notebook that 
>>> works as expected:
>>>
>>> R = IntegerModRing(3) 
>>> x = PolynomialRing(R, 'x').gen()
>>>
>>> rows  = []
>>> for k in range(1,10):
>>> f = x^k - 1
>>> factor = f.factor()
>>> rows.append((f,factor))
>>>
>>> table(rows, header_row=["Polynomial ", "Factorization"], frame=True)
>>>
>>> However, the output produced is ugly and looks like the one in the 
>>> attachment; it leaves a lot of space on the right but the factorization is 
>>> spread across multiple rows. How can I ask Sage to place each factorization 
>>> in the right column on a single line. 
>>>
>>> Also is it possible for me to write [image: x^k-1] for various powers 
>>> of [image: k] in latex in place of [image: x^k+2]. i.e. I want to write 
>>> -1 wherever there is a 2 in the left column. Sure I can do this with 
>>> print, but the output won’t be Latex rendered. 
>>>
>>> ​
>>>
>> -- 
>> 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 sage-support...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-support/a737f888-3397-4be7-aab6-1e9e8230b20en%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/270ea155-ea95-4b25-858e-02ed76796d90n%40googlegroups.com.


Re: [sage-support] Re: Listing elements of a finite ring.

2022-11-20 Thread John H Palmieri
You can also do `list(S)`, or depending on what you're doing it might be 
better to iterate over its elements, as Emmanuel wrote: `for u in S...`


On Sunday, November 20, 2022 at 8:54:25 AM UTC-8 gauri...@gmail.com wrote:

> Oh wow! That was easy! 
>
> Thanks so much! 
> G
>
> On Sun, Nov 20, 2022 at 3:12 PM Emmanuel Charpentier <
> emanuel.c...@gmail.com> wrote:
>
>> No predefined method, but listing S’s elements seems easy :
>>
>> sage: R1.=GF(97)[]
>> sage: p=lambda x:x^2+2
>> sage: S=R1.quotient(p(t),'a')
>> sage: L=[u for u in S]
>> sage: len(L)
>> 9409
>>
>> HTH,
>> ​
>> Le dimanche 20 novembre 2022 à 07:39:27 UTC+1, gauri...@gmail.com a 
>> écrit :
>>
>>> I am afraid I cannot seem to find the answer to the following question 
>>> in the docs. 
>>>
>>> Suppose I have finite ring? How do I list all its elements? e.g.
>>>
>>> ```
>>> R = PolynomialRing(GF(97),'x')
>>> x = R.gen()
>>>
>>> p = lambda x: x^2+2
>>> S = R.quotient(p(x), 'a')
>>> ```
>>>
>>> I would like to list all the elements of the quotient ring S. Is there a 
>>> function/method that allows listing elements of S?
>>>
>>>  
>>>
>> -- 
>> 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 sage-support...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-support/5288658d-8d36-454f-9f07-8a6cadf056edn%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/d1d641f6-894b-4026-b37a-efb528786779n%40googlegroups.com.


[sage-support] Strange bug connected to GAP as a backend

2022-11-20 Thread 'Peter Mueller' via sage-support
Start with

g = SymmetricGroup(3)
chi = g.trivial_character()
u = g.subgroup([])

Next

reg = u.trivial_character().induct(g)
print(chi.scalar_product(reg))

yields as expected the answer 1.

Now repeat the very same two lines, but before doing so compute the  
representatives of conjugacy classes of subgroups:

lg = g.conjugacy_classes_subgroups()
reg = u.trivial_character().induct(g)
print(chi.scalar_product(reg))

This results in
---
GAPError  Traceback (most recent call last)
[...]
GAPError: Error, no method found! Error, no 1st choice method found for `=' 
on 2 arguments

I omit the full traceback, because it is very well reproducible in versions 
9.7 and 9.8.beta3, and also on the SageCell.

-- Peter Müller

-- 
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 sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/d381c4c3-0a3a-495b-8953-4802639ede50n%40googlegroups.com.


Re: [sage-support] Re: Rendering tables in jupyter notebook

2022-11-20 Thread Gaurish Telang
Thanks! I will ask on the Jupyter mailing list.

>
> Also is it possible for me to write [image: x^k-1] for various powers of 
> [image:
> k] in latex in place of [image: x^k+2]. i.e. I want to write -1 wherever
> there is a 2 in the left column. Sure I can do this with print, but the
> output won’t be Latex rendered.


I apologize that it was terribly worded.   It was just a dumb question that
occured while trying to understand how the `table` function outputs data
into a jupyter notebook cell.

I basically wanted the left hand-side to contain [image: x^k-1] in
place of [image:
x^k+2] for different values of [image: k] i.e. [image: x-1] in place of [image:
x+2]
 [image: x^2-1] in place of [image: x^2+2] and so on.  I *know* of course
-1 and 2  are identical in Z/3Z, but I was wondering if there was a  way to
*display* (-1) in place of 2 while using the `table` command and working
Z/3Z.

Regards
G

On Sun, Nov 20, 2022 at 3:36 PM Emmanuel Charpentier <
emanuel.charpent...@gmail.com> wrote:

> > How can I ask Sage to place each factorization in the right column on a
> single line.
>
> Both the display in a console and the LaTeX display given by `view` are
> single-lined. I can reproduce your problem in Jupyter ; therefore, I think
> that the question should be directed to a Jupyter-centered mailing list,
> newsgroup, forum or whatever...
>
> > Also is it possible for me to write x^k-1 for various powers of k in
> latex in place of x^k+2. i.e. I want to write -1 wherever there is a 2 in
> the left column. Sure I can do this with print, but the output won’t be
> Latex rendered.
>
> I cant't make head or tail of this gibberish. Could you rephrase ?
>
> HTH,
>
> Le dimanche 20 novembre 2022 à 07:39:27 UTC+1, gauri...@gmail.com a
> écrit :
>
>> I want to create a neat table of the factorization of several polynomials
>> of the form [image: x^n-1] in the ring Z/3Z [x].
>>
>> This is my code, which I am using inside of a Jupyter notebook that works
>> as expected:
>>
>> R = IntegerModRing(3)
>> x = PolynomialRing(R, 'x').gen()
>>
>> rows  = []
>> for k in range(1,10):
>> f = x^k - 1
>> factor = f.factor()
>> rows.append((f,factor))
>>
>> table(rows, header_row=["Polynomial ", "Factorization"], frame=True)
>>
>> However, the output produced is ugly and looks like the one in the
>> attachment; it leaves a lot of space on the right but the factorization is
>> spread across multiple rows. How can I ask Sage to place each factorization
>> in the right column on a single line.
>>
>> Also is it possible for me to write [image: x^k-1] for various powers of 
>> [image:
>> k] in latex in place of [image: x^k+2]. i.e. I want to write -1 wherever
>> there is a 2 in the left column. Sure I can do this with print, but the
>> output won’t be Latex rendered.
>>
>> ​
>>
> --
> 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 sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/a737f888-3397-4be7-aab6-1e9e8230b20en%40googlegroups.com
> 
> .
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAC4%2BK-QWoZJYbbsm7C8k_3-9pfj%2BFghVTLAvEtqrkO41WMj8-Q%40mail.gmail.com.


Re: [sage-support] Re: Listing elements of a finite ring.

2022-11-20 Thread Gaurish Telang
Oh wow! That was easy!

Thanks so much!
G

On Sun, Nov 20, 2022 at 3:12 PM Emmanuel Charpentier <
emanuel.charpent...@gmail.com> wrote:

> No predefined method, but listing S’s elements seems easy :
>
> sage: R1.=GF(97)[]
> sage: p=lambda x:x^2+2
> sage: S=R1.quotient(p(t),'a')
> sage: L=[u for u in S]
> sage: len(L)
> 9409
>
> HTH,
> ​
> Le dimanche 20 novembre 2022 à 07:39:27 UTC+1, gauri...@gmail.com a
> écrit :
>
>> I am afraid I cannot seem to find the answer to the following question in
>> the docs.
>>
>> Suppose I have finite ring? How do I list all its elements? e.g.
>>
>> ```
>> R = PolynomialRing(GF(97),'x')
>> x = R.gen()
>>
>> p = lambda x: x^2+2
>> S = R.quotient(p(x), 'a')
>> ```
>>
>> I would like to list all the elements of the quotient ring S. Is there a
>> function/method that allows listing elements of S?
>>
>>
>>
> --
> 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 sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/5288658d-8d36-454f-9f07-8a6cadf056edn%40googlegroups.com
> 
> .
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAC4%2BK-RtNPqqwpFXEPnka6U%2BvC0nNtUqEibbfbh6F%3Dpm4FRrjA%40mail.gmail.com.


[sage-support] Re: Rendering tables in jupyter notebook

2022-11-20 Thread Emmanuel Charpentier
> How can I ask Sage to place each factorization in the right column on a 
single line.

Both the display in a console and the LaTeX display given by `view` are 
single-lined. I can reproduce your problem in Jupyter ; therefore, I think 
that the question should be directed to a Jupyter-centered mailing list, 
newsgroup, forum or whatever...

> Also is it possible for me to write x^k-1 for various powers of k in 
latex in place of x^k+2. i.e. I want to write -1 wherever there is a 2 in 
the left column. Sure I can do this with print, but the output won’t be 
Latex rendered.

I cant't make head or tail of this gibberish. Could you rephrase ?

HTH,

Le dimanche 20 novembre 2022 à 07:39:27 UTC+1, gauri...@gmail.com a écrit :

> I want to create a neat table of the factorization of several polynomials 
> of the form [image: x^n-1] in the ring Z/3Z [x]. 
>
> This is my code, which I am using inside of a Jupyter notebook that works 
> as expected:
>
> R = IntegerModRing(3) 
> x = PolynomialRing(R, 'x').gen()
>
> rows  = []
> for k in range(1,10):
> f = x^k - 1
> factor = f.factor()
> rows.append((f,factor))
>
> table(rows, header_row=["Polynomial ", "Factorization"], frame=True)
>
> However, the output produced is ugly and looks like the one in the 
> attachment; it leaves a lot of space on the right but the factorization is 
> spread across multiple rows. How can I ask Sage to place each factorization 
> in the right column on a single line. 
>
> Also is it possible for me to write [image: x^k-1] for various powers of 
> [image: 
> k] in latex in place of [image: x^k+2]. i.e. I want to write -1 wherever 
> there is a 2 in the left column. Sure I can do this with print, but the 
> output won’t be Latex rendered. 
>
> ​
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/a737f888-3397-4be7-aab6-1e9e8230b20en%40googlegroups.com.


[sage-support] Re: Listing elements of a finite ring.

2022-11-20 Thread Emmanuel Charpentier


No predefined method, but listing S’s elements seems easy :

sage: R1.=GF(97)[]
sage: p=lambda x:x^2+2
sage: S=R1.quotient(p(t),'a')
sage: L=[u for u in S]
sage: len(L)
9409

HTH,
​
Le dimanche 20 novembre 2022 à 07:39:27 UTC+1, gauri...@gmail.com a écrit :

> I am afraid I cannot seem to find the answer to the following question in 
> the docs. 
>
> Suppose I have finite ring? How do I list all its elements? e.g.
>
> ```
> R = PolynomialRing(GF(97),'x')
> x = R.gen()
>
> p = lambda x: x^2+2
> S = R.quotient(p(x), 'a')
> ```
>
> I would like to list all the elements of the quotient ring S. Is there a 
> function/method that allows listing elements of S?
>
>  
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/5288658d-8d36-454f-9f07-8a6cadf056edn%40googlegroups.com.