ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 11 Jul 2022 22:45:31 +0200define a finite semiringhttps://ask.sagemath.org/question/63217/define-a-finite-semiring/What would be the simplest way to define the semiring with elements $\\{0, 1\\}$ with the logical OR ($|$) operation as addition and the standard integer multiplication?
At very least it should be accepted by `PolynomialRing` as the domain for coefficients.Max AlekseyevMon, 11 Jul 2022 22:45:31 +0200https://ask.sagemath.org/question/63217/All the solutions of a polynomial system over a finite ringhttps://ask.sagemath.org/question/62787/all-the-solutions-of-a-polynomial-system-over-a-finite-ring/Let $E$ be a finite list of polynomial equations with variables $t_0, \dots, t_r$ over the finite ring of integers modulo $n$ (for some $n$). We can compute the Groebner basis as follows:
ZN=Integers(n)
R=PolynomialRing(ZN,r,"t")
R.inject_variables()
Id=R.ideal(E)
G=Id.groebner_basis()
Usually, over a field and if `Id.dimension()=0` then we can get all the solutions by `Id.variety()`. But here the dimension is not necessarily $0$ and moreover it is not over a field but a ring, the finite ring of integers modulo $n$. By finiteness of the ring, there still have finitely many solutions. How to get them all?
*Example*: $n=248832$, $r=10$ and:
sage: G
[t4*t7, t7*t8, t7*t9, t0, t1, t2, t3 + 248831*t4, 2*t4, t5 + 248783*t7, t6 + 11*t7, 9*t7, 4*t8 + 248828*t9, 16*t9]Sébastien PalcouxSat, 11 Jun 2022 12:47:46 +0200https://ask.sagemath.org/question/62787/why can't sage row reduce in a composite modulohttps://ask.sagemath.org/question/61971/why-cant-sage-row-reduce-in-a-composite-modulo/ Sage handles finite rings pretty well, as in taking determinants and inverses, but I can't row reduce in anything but a prime finite field. This can be done by hand, but who wants to do that?BsamuelsThu, 14 Apr 2022 20:15:56 +0200https://ask.sagemath.org/question/61971/Solving a polynomial system in a quotient ringhttps://ask.sagemath.org/question/52254/solving-a-polynomial-system-in-a-quotient-ring/I want to compute all solutions in $\mathbb{Z}_9[\sqrt2,x]$, where $x$ is such that $(x+\sqrt2)^2=2(x+\sqrt2)$, of the equation
$$X^2=1.$$
I'm first defining the polynomial ring over $\mathbb{Z}_9$ in variables $x,y$, then factoring by the ideal generated by
$$y^2-2, (x+y)^2-2(x+y),$$
to get the ring $S$, but then I don't know which command to use in order to get the solutions of $X^2-1$. I have tried "solve" and "variety" (defining $S[X]$ first and then the ideal of $X^2-1$), but they do not seem to work. The code up to this point is just
R.<x,y> = PolynomialRing(IntegerModRing(9),order='lex')
J= R.ideal(x^2-2,(x+y)^2-2*(x+y))
S=R.quotient(J)
Which function should I use?Jose BroxMon, 29 Jun 2020 16:55:09 +0200https://ask.sagemath.org/question/52254/Linear code over a finite ringhttps://ask.sagemath.org/question/45640/linear-code-over-a-finite-ring/The command
LinearCode(M)
works well on a Finite Field `F`, but doesn't work for a finite ring.
Is there any way to construct a linear code over a finite ring using sage?
In other words, could we construct a module over ZZ/nZZ?
I try to understand the trac tickets [#6452](https://trac.sagemath.org/ticket/6452) and [#19345](https://trac.sagemath.org/ticket/19345) for constructing a linear code over a finite ring.
Unfortunately, I failed to understand.nur_hamidMon, 04 Mar 2019 12:01:18 +0100https://ask.sagemath.org/question/45640/Is there a way to make sage print out all monomials of a Boolean Ring?https://ask.sagemath.org/question/44921/is-there-a-way-to-make-sage-print-out-all-monomials-of-a-boolean-ring/Hi all,
In a finite ring, is there a way to get Sage to print out all possible monomials of the ring? I have a method, but it's very crude. It's simply doing something like taking a random variable to mutiply with a random ring element from B.random_element(). But this is obviously not what I want.
Below is the ring I'm working with.
B = BooleanPolynomialRing(20,'x', order = 'lex')
Is there a Sage function to put every monomial of the ring into a list? I can't seem to find it in Sage documentation.Stockfish3709Mon, 07 Jan 2019 09:55:20 +0100https://ask.sagemath.org/question/44921/Inverse of a number modulo 2**255 -19https://ask.sagemath.org/question/43738/inverse-of-a-number-modulo-2255-19/ I don't understand this code to solve the inverse of a number:
b = 256;
q = 2**255 - 19
def expmod(b,e,m):
if e == 0: return 1
t = expmod(b,e/2,m)**2 % m
if e & 1: t = (t*b) % m
return t
def inv(x):
return expmod(x,q-2,q)`
Finally, If I want to put: $\frac{2}{3}$ I can to do this: `aux=2*inv(3)`
What does the variable `e` mean?
Could you explain me this code, please?
Thank you so much.ZacariasSatrusteguiMon, 24 Sep 2018 19:26:43 +0200https://ask.sagemath.org/question/43738/Examining the quotients of a module $R\times R$ where $R$ is a finite ring.https://ask.sagemath.org/question/41421/examining-the-quotients-of-a-module-rtimes-r-where-r-is-a-finite-ring/I'm new to Sage, and I've been struggling to get started with (what I thought) should be a basic construction.
I have an $8$-element commutative ring $R$ which is constructed as a quotient of a polynomial ring in two variables. I need to examine all of the quotient of the right $R$ module $R\times R$.
I tried to use `M=R^2` and got something that looked promising, but when I tried to use the `quotient_module` method, I kept getting errors. I saw in the docs for that method that quotient_module isn't fully supported, so I started looking at the CombinatorialFreeModule class too.
> Can someone recommend an idiomatic way to accomplish the task?
I have been plagued by NotImplemented errors and a myriad of other error messages every step of the way, even when just attempting to find a method to list all elements of my $8$ element ring. All the examples I've seen really look like they stick to basic linear algebra, or free $\mathbb Z$ modules. I just want to do something similar for my small ring of $8$ elements.
Here's what I've been trying:
k # <- (finite field of size 2)
R.<x,y>=PolynomialRing(k)
S = R.quotient([x^2, x*y, y^3])
list(S) # <-- NotImplementedError("object does not support iteration") I noticed it worked for the univariate case though. What's a good way to recover the elements?
M = S^2
v = M.gens()
M.quotient_module([v[0]]) # <- ValueError("unable to compute the row reduced echelon form") TypeError("self must be an integral domain.")
Had the same problem with a univariate polynomial ring over $F_2$ mod $(x^3)$.
Obviously the messages are informative enough about what they think is wrong. But this seems like such an elementary task... is there some other class that can handle such a construction?rschwiebWed, 07 Mar 2018 15:28:00 +0100https://ask.sagemath.org/question/41421/Listing elements of (Z/nZ)*https://ask.sagemath.org/question/35006/listing-elements-of-znz/ I want to find all the elements of (Z/nZ)*. Is there a command for that ?
For example if the user gives input 8, the the output will be
{1,3,5,7}.nebuckandazzerSat, 01 Oct 2016 18:28:42 +0200https://ask.sagemath.org/question/35006/