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.Tue, 04 May 2021 14:51:09 +0200quotient ring in Sagehttps://ask.sagemath.org/question/56944/quotient-ring-in-sage/ How to calculate quotient ring Z2[x,y,z]/(2x,y^3,xy,x^2-4z] in sage? Thanks!wittenheTue, 04 May 2021 14:51:09 +0200https://ask.sagemath.org/question/56944/Product of finite rings in sagehttps://ask.sagemath.org/question/56441/product-of-finite-rings-in-sage/ How to implement the cartesian product of finite commutative rings with 1 with pointwise multiplication in sage?
As far as I know, it is not there yet. So please help me with this. Thank you.GA3165Wed, 31 Mar 2021 04:24:31 +0200https://ask.sagemath.org/question/56441/Referring to elements of a polynomial ring as integers.https://ask.sagemath.org/question/56295/referring-to-elements-of-a-polynomial-ring-as-integers/Suppose I create a polynomial ring:
F.<a> = GF(2^4)
R.<x> = PolynomialRing(F)
The syntax above is slightly incorrect, I couldn't figure out how to preserve the brackets around the 'a' and 'x'.
For the work I'm doing the references typically refer to elements of the ring in 4 different manners (within the same reference). An example of this is the BBC white paper, "Reed-Solomon Error Correction" by C. K. P. Clarke.
They use index form:
a^11
They use polynomial form:
a^3 + a^2 + a
They use binary form:
1110
They use decimal form:
14
I would like to map what they call decimal form to the polynomial form, because it's very convenient. For instance in the previously mentioned paper they encode a message: x^10 + 2*x^9 + 3*x^9 + ... 10*x + 11.
In sagemath this would be:
x^10 + a*x^9 + a^4*x^8 + ... a^9*x + a^7
The decimal form is very helpful for me. My eventual goal is to use sagemath to implement a Reed-Solomon encoder/decoder, and write code that parses that implementation and creates System Verilog code that gets implemented in an ASIC (application specific integrated circuit)jderyckSun, 21 Mar 2021 10:16:30 +0100https://ask.sagemath.org/question/56295/Indexing variables in a list comprehensionhttps://ask.sagemath.org/question/54503/indexing-variables-in-a-list-comprehension/ Suppose I create the polynomial ring R = PolynomialRing(QQ, ['lambda%s'%i for i in [1 .. g]] + ['psi%s'%i for i in [1 .. n]]).
If I want to create a list comprehension which creates a list of perhaps all the lambdas, what is the notation used at the beginning of the list comprehension?
i.e. [lambdai for i in [1 .. g]]. Laughematician760Tue, 01 Dec 2020 23:03:40 +0100https://ask.sagemath.org/question/54503/Tensor product over polynomial ringshttps://ask.sagemath.org/question/52715/tensor-product-over-polynomial-rings/I'm writing code for Fully Homomorphic Encryption multiplication routine.
I'm trying to calculate tensor product over polynomial rings.
Let's say I have elements in `R = Z[x]/[x^n+1]` where coefficients are modulo `q`.
I want to calculate tensor product of `m1_q = (ct0 + sk * ct1)`
and `m2_q = (ct2 + sk * ct3)` and scale it down by `(q/2)`.
Each element `ct0`, `ct1`, `ct2`, `ct3`, `sk`, `m1_q`
and `m2_q` are elements of `Rq`.
Just for `m1_q` and `m2_q`, it is working out well:
`(2/q)*(m1_q tensor_product m2_q)`.
How can I calculate it in terms of `ct*`?
I tried writing it as:
c0 = (2/q)*(ct0 tensor_product ct2)
c1 = (2/q)*( (ct0 tensor_product ct3) + (ct2 tensor_product ct1) )
c2 = (2/q)*(ct1 tensor_product ct3)
m_out = (2/q)*(m1_q tensor_product m2_q)
Then I converted `c0`, `c1`, `c2` and `m_out` into `Rq`.
Now I was testing:
c0 + c1 * sk + c2 * sk^2 == m_out
But these are not matching. Appreciate your help.niranjanMon, 27 Jul 2020 16:53:47 +0200https://ask.sagemath.org/question/52715/does sage allow computation of a groebner basis of an ideal J in the quotient ring Z/pZ[X_1,...X_r]/I?https://ask.sagemath.org/question/52493/does-sage-allow-computation-of-a-groebner-basis-of-an-ideal-j-in-the-quotient-ring-zpzx_1x_ri/I define the following rings and ideals:
sage: F = ZZ.quo(3*ZZ); F
Ring of integers modulo 3
sage: A.<X, Y, Z> = PolynomialRing(F); A
Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
sage: I = ideal(X^2 - 1, Y^2 - 1, Z^2 - 1); I
Ideal (X^2 + 2, Y^2 + 2, Z^2 + 2)
of Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
sage: R = A.quotient_ring(I); R
Quotient of Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
by the ideal (X^2 + 2, Y^2 + 2, Z^2 + 2)
sage: x, y, z = R.gens()
sage: J = ideal(x*y + z, x + x*z, x*z + y); J
Ideal (Xbar*Ybar + Zbar, Xbar*Zbar + Xbar, Xbar*Zbar + Ybar)
of Quotient of Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
by the ideal (X^2 + 2, Y^2 + 2, Z^2 + 2)
I then compute:
sage: B = J.groebner_basis()
and examine the result of that computation:
sage: B
[Xbar + 2*Ybar, Zbar + 1]
Is it really the Groebner basis of `J`?
Did Sage really compute in A/I and not in A?andriamThu, 16 Jul 2020 11:50:36 +0200https://ask.sagemath.org/question/52493/how to evaluate a polynomial in a quotient ring ?https://ask.sagemath.org/question/52596/how-to-evaluate-a-polynomial-in-a-quotient-ring/I define a polynomial ring and its quotient by an ideal:
sage: F = ZZ.quo(3*ZZ); F
Ring of integers modulo 3
sage: A.<X, Y, Z> = PolynomialRing(F); A
Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
sage: R.<x, y, z> = A.quotient(ideal(X^2 - 1, Y^2 - 1, Z^2 - 1)); R
Quotient of Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
by the ideal (X^2 + 2, Y^2 + 2, Z^2 + 2)
I define an element in this quotient ring:
sage: f = x*y*z; f
x*y*z
sage: f.parent()
Quotient of Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
by the ideal (X^2 + 2, Y^2 + 2, Z^2 + 2)
I want to evaluate this element at $(x, y, z) = (2, 3, 4)$.
I tried this, and got this error message:
sage: f(2, 3, 4)
Traceback (most recent call last)
...
TypeError: 'QuotientRing_generic_with_category.element_class' object is not callable
How can I calculate `f(2, 3, 4)` with Sage?andriamTue, 21 Jul 2020 12:22:20 +0200https://ask.sagemath.org/question/52596/Finding polynomial solutions that belong to an idealhttps://ask.sagemath.org/question/50713/finding-polynomial-solutions-that-belong-to-an-ideal/I have a system of equations in which the variables belong to a certain ideal of a polynomial ring over a field. We can call this ideal $I$ and its generators $c_1$, $c_2$ and $c_3$. Let's take the ring to be $\mathbb{F}_2[x_1,x_2,x_3]$ and the ideal to be $I=<x_1x_2x_3-1,x_2-x_1,x_1-1>$ . Let's say the equations are $g_1+x_1w_2+x_2w_3 = x_1-1$, $g_2+x_2w_1+x_3w_3 = x_2-1$ and $g_3+x_1w_1+w_2 = x_3-1$ and one needs to find solution to the above set of equations with variables $g_i$ and $w_i$ inside the ideal $I$. There are of course more variables than equations here. One obvious solution is $g_1=x_1-1,g_2=x_2-1, g_3=x_3-1$. How does one find the full set of solutions? I thought of implementing this as a syzygy problem where I take $x_1-1$ and so on on the left but that seems to be not ideal since it is not clear whether I find all solutions or not. To simplify the problem, we can choose a cut-off for degree of polynomial solutions, for example, 1 or 2.arpitMon, 13 Apr 2020 00:57:46 +0200https://ask.sagemath.org/question/50713/center lift of a polynomial?https://ask.sagemath.org/question/49613/center-lift-of-a-polynomial/Hello! I am trying to code up the NTRU example in Hoffstein, Pipher and Silverman. Anyone know if the "center lift" of a polynomial is implemented in Sage? I am working the quotient ring:
Z_7[x] / x^5 - 1
I have a(x) = 5 + 3x - 6x^2 + 2x^3 + 4x^4
The center lift takes this a polynomial with coefficients in the range of - 7/2 < coeff <= 7/2.
Thus a(x) -> -2 + 3x + x^2 + 2x^3 - 3x^4
But what I get is:
N = 5
q = 7
P.<x> = GF(q)[]
Q = QuotientRing(P, x^N - 1)
a = 5 + 3*x - 6*x^2 + 2*x^3 + 4*x^4
aa = Q(a)
aa.lift()
4*x^4 + 2*x^3 + x^2 + 3*x + 5
Any thoughts? I guess I could write my own function to do the center lifting...
Thanks!
Susansusan_in_AnnapolisTue, 21 Jan 2020 01:55:52 +0100https://ask.sagemath.org/question/49613/matrix base ring changes by a complex multiplicationhttps://ask.sagemath.org/question/49557/matrix-base-ring-changes-by-a-complex-multiplication/The complex multiplication of matrix changes the base ring.
A = matrix(CDF,[[1,2],[3,4]]); print(A)
B = 2*A
C = I*A
print(type(A))
print(type(B))
print(type(C))
The result is
[1.0 2.0]
[3.0 4.0]
<class 'sage.matrix.matrix_complex_double_dense.Matrix_complex_double_dense'>
<class 'sage.matrix.matrix_complex_double_dense.Matrix_complex_double_dense'>
<class 'sage.matrix.matrix_symbolic_dense.Matrix_symbolic_dense'>
So the multiplication by an imaginary number breaks the CDF property.
This is very inconvenient for numerical calculations, because the symbolic computation is very slow.cxrjddWed, 15 Jan 2020 10:59:29 +0100https://ask.sagemath.org/question/49557/Using Singular's ring normalization inside Sagehttps://ask.sagemath.org/question/49239/using-singulars-ring-normalization-inside-sage/How to use the following Singular's code in Sage?
LIB "normal.lib";
ring r=0,(x,y,z),dp;
ideal i=y^2-x^2*z;
list NN=normal(i);
def N=NN[1];
setring N;
PP;
The original code can be found on this Singular page:
[Ring Normalization](https://www.singular.uni-kl.de/DEMOS/GMG-Mainz_DMV-99/Examples/normal.html)
I figured out how to write it in Sage only for the first half of the code:
Input:
singular.lib('normal.lib')
R = singular.ring(0,'(x,y,z)','dp')
i = singular.ideal('y^2-x^2*z')
NN=singular.normal(i)
NN
Output:
[1]:
[1]:
// coefficients: QQ
// number of vars : 4
// block 1 : ordering dp
// : names T(1)
// block 2 : ordering dp
// : names x y z
// block 3 : ordering C
[2]:
[1]:
_[1]=x*z
_[2]=y
But then I can not figure out how to use the commands 'list', 'def', 'setring' and 'PP'.
Any suggestions?azerbajdzanSat, 28 Dec 2019 00:17:43 +0100https://ask.sagemath.org/question/49239/How to properly declare indeterminates so that they exist in the coefficient ring.https://ask.sagemath.org/question/40918/how-to-properly-declare-indeterminates-so-that-they-exist-in-the-coefficient-ring/I'm working on a project regarding generalization of symmetric polynomials.
For the sake of simplicity, I will ask my question in the context of a minimalistic (not) working example.
Let say I am working with Symmetric Functions, I'll write an erroneous code so that you get the idea of what I'm looking for
QQt = QQ['t'].fraction_field()
Sym = SymmetricFunctions(QQt); Sym.inject_shorthands()
a0 = var('a0')
expr1 = m[1,1]
expr2 = m[2] + a0*m[1,1]
eqsys = expr1.scalar_jack(expr2)
solve(eqsys, a0)
The I get the error ```unsupported operand parent(s) for *: 'Symbolic Ring' and 'Symmetric Functions over Fraction Field of Univariate Polynomial Ring in alpha over Rational Field in the monomial basis'```
OK, so I tried this instead
QQt = QQ['t,a0'].fraction_field()
t, a0 = QQt.gens()
Sym = SymmetricFunctions(QQt); Sym.inject_shorthands()
expr1 = m[1,1]
expr2 = m[2] + a0*m[1,1]
eqsys = expr1.scalar_jack(expr2)
solve(eqsys, a0)
```a0 is not a valid variable```
So then I did the following
sln = solve(SR(eqsys), SR(a0))
and it works. But the probleme is that I can't convert the solution back
QQt(sln)
```('cannot convert {!r}/{!r} to an element of {}', {a0: 2/(t + 1)}, 1, Fraction Field of Multivariate Polynomial Ring in t, a0 over Rational Field)```
And anyway this last solution does not seem very canonical. How should I proceed?
I guess that somehow what I am asking is how to declare ```a0, a1, ...``` as symbols element of QQt. LAVThu, 01 Feb 2018 15:48:50 +0100https://ask.sagemath.org/question/40918/Test for zero cup producthttps://ask.sagemath.org/question/33331/test-for-zero-cup-product/How can I check whether the cohomology ring H^*(X) of a simplicial complex X has zero cup product (like, say, for X a wedge of spheres). I have a long list of simplicial complexes, so I need a fully algorithmic approach. I probably should start with X.cohomology_ring(QQ) but I don't know what to do next...
Btw, I am a sage newbie.
MathrocksFri, 06 May 2016 18:50:24 +0200https://ask.sagemath.org/question/33331/Help with matrices over multivariable polynomial ringhttps://ask.sagemath.org/question/33310/help-with-matrices-over-multivariable-polynomial-ring/ I want to work with matrices over a multivariable polynomial ring.
I want the matrix
[x0^2,x1^2,x2^2]<br>
[x0^4,x1^4,x2^4]<br>
[x0^8,x1^8,x2^8]
so I can take the determinate of it. I have
R = PolynomialRing(GF(2), 3, 'x')
which is a "Multivariate Polynomial Ring in x0, x1, x2 over Finite Field of size 2". I try
M = MatrixSpace(R,3,3,sparse=True)
which is the "Full MatrixSpace of 3 by 3 sparse matrices over Multivariate Polynomial Ring in x0, x1, x2 over Finite Field of size 2". I am not even sure what "sparse" is.
Then I try
A = M([x0^2,x1^2,x2^2, x0^4,x1^4,x2^4, x0^8,x1^8,x2^8])<br>
or<br>
A = M([[x0^2,x1^2,x2^2], [x0^4,x1^4,x2^4], [x0^8,x1^8,x2^8]])
And it says "name 'x0' is not defined"
I have looked for examples in the Sage documentation, but I just can get Sage to make the matrix above.
Eventually, I want to do arbitrate number of variables and arbitrary n-by-n matrices.
Thank you for your help. MrotsliahTue, 03 May 2016 20:04:31 +0200https://ask.sagemath.org/question/33310/Save boolean polynomial ring to file and read it againhttps://ask.sagemath.org/question/30432/save-boolean-polynomial-ring-to-file-and-read-it-again/ I have BooleanPolynomialRing of 256 variables and I need many thick polynomials. Generate them is very time consuming so I want to save them to file and when needed read again. Is there some good way? Till now I have found out something like this (simplified)
variables=[]
for i in range(1,257):
variables.append('x'+str(i))
R = BooleanPolynomialRing(names=variables)
R.inject_variables()
fw = open('/home/pro/Desktop/polynomials.txt', 'w')
polynomial = R.random_element(degree=2,terms=+infinity)
fw.write(str(polynomial) + "\n")
fr = open('/home/pro/Desktop/polynomials.txt', 'r')
polynomial = fr.readline()
How can I convert string back to polynomial?
Thanks
f.close()
ProTue, 03 Nov 2015 21:14:56 +0100https://ask.sagemath.org/question/30432/Rings, Ideals, Quotient Rings in Sagehttps://ask.sagemath.org/question/29990/rings-ideals-quotient-rings-in-sage/Hi everybody.
I am new to sage. I want to construct rings, ideals, and quotient rings.
I used Z.IntegerRing() to generate the ring of integers.
Question 1:
Then I used I = Z.ideal(2) to get the ideal generated by 2 (even numbers).
Question: How can I display the Elements. E.g. I(2) does not work in order to display the second element of the ideal.
Question 2:
To generate the quotientring Z/2Z i used S = Z.quotient_ring(I).
What if I want to generate the quotientring 2Z/6Z ? S = I.quotient_ring(J) does not work (I = Z.ideal(2), J = Z.ideal(6).
Thanks for any help
DesperateUserWed, 14 Oct 2015 09:38:47 +0200https://ask.sagemath.org/question/29990/Filtration on Ringhttps://ask.sagemath.org/question/28593/filtration-on-ring/Hi,
I am considering filtered modules over filtered rings. A filtration of a ring are certain subsets,
that are indexed by multi-indices in N^n. How are filtrations in rings handled in Sage? Are there additional packages available to deal with filtered rings?
BR,
Christoph christoph123Fri, 17 Jul 2015 17:36:13 +0200https://ask.sagemath.org/question/28593/How to flatten polynomial rings?https://ask.sagemath.org/question/26969/how-to-flatten-polynomial-rings/ It is possible in Sage to create a polynomial ring over a polynomial ring. But Sage stores this as a two-tiered structure that is sometimes inconvenient. I would like to flatten it.
For example,
sage: P = PolynomialRing(QQ, 'c', 6)
sage: S = PolynomialRing(P, 't', 6)
creates a polynomial ring in t0, t1, t2, ...., t5 over a polynomial ring in c0, c1, ..., c5. But then
sage: clist = list( P.gens()[i] for i in range(6)) # get names for variables
sage: tlist = list( S.gens()[i] for i in range(6))
sage: poly = clist[0]*tlist[0] # produces polynomial c0*t0 in S
sage: poly.polynomial(clist[0]) # asks for poly as a polynomial in c0
fails with "var must be one of the generators of the parent polynomial
ring."
I would like to `flatten' S so it is simply a single polynomial ring over QQ in 12 variables.
You may ask, why don't I just construct a single ring in the first place? In this instance, because I want to create a polynomial ring in c0, ...., cn and t0, ...., tn where n is a variable, and I don't know how to do this (I'd prefer to avoid just making c0, ..., c2n and trying to keep track of which are actually t's). I can imagine other situations where one would like to be able to flatten also.Kate StangeThu, 28 May 2015 17:44:37 +0200https://ask.sagemath.org/question/26969/complex, real, common ring, crash in 'vector' constructorhttps://ask.sagemath.org/question/26473/complex-real-common-ring-crash-in-vector-constructor/ (x,y,z) = var('x,y,z')
x = z.real_part()
y = z.imag_part()
test = vector((x,1,1))
test = vector((x,y,1))
test = vector((z.real_part,1,1))
Last line causes an error, can't find common ring for all elements.
These variables all have type "Expression"; but some expressions denote
complex numbers and some denote real numbers. How do I tell sage about that?
(Sage 6.5 on Mac OS 10).beesonWed, 08 Apr 2015 21:11:48 +0200https://ask.sagemath.org/question/26473/How to define / create a new Ringhttps://ask.sagemath.org/question/26299/how-to-define-create-a-new-ring/Hi!
I just installed the version 6.5 of Sage. Then I saw in the help some page/tutorial about Basic Rings but I could not find an article (I googled) or an answer for the following:
How can I create a new ring? For example: How can I create a kind of ring of Integers (called ZZ in Sage) where I have only , say, even numbers?
Examples:
sage: sqrt(4) in myZZ
True
sage: 3 in myZZ
False
Thank you for any help!LRMTue, 24 Mar 2015 08:58:46 +0100https://ask.sagemath.org/question/26299/Sum of two vectorshttps://ask.sagemath.org/question/25331/sum-of-two-vectors/ Hi everybody, i've got this functions and variables:
v = function('v',t)
a_V_ra = function('a_V_ra',t)
a_a_ra=function('a_a_ra',t)
g = var('g')
r_V_ra = vector([v,0,0])
a_V_ra = R_ra*r_V_ra.column()
where R is a matrix and a_V_ra is the vector [cos(psi(t))v(t), sin(psi(t))v(t),0].
But when i do this:
a_a_ra = diff(a_V_ra)+vector([0,0,-g])
it says: *TypeError: unsupported operand parent(s) for '+': 'Full MatrixSpace of 3 by 1 dense matrices over Symbolic Ring' and 'Vector space of dimension 3 over Symbolic Ring'*
I guess it's saying that i'm summing a matrix and a vector, but they're both vectors! What can I do to make it work?
Thank you.
SilviaTue, 23 Dec 2014 10:42:05 +0100https://ask.sagemath.org/question/25331/All Ideals of Ringhttps://ask.sagemath.org/question/24892/all-ideals-of-ring/ For given group G, by G.subgroups(), we can list all subgroups.
now my question is :
Is there something for subgroups() for finding all left ideals of a given ring.
For instance,
k = GF(5);
M = MatrixSpace(k,2,2)
How can I have all left ideals?BabgenMon, 17 Nov 2014 08:54:16 +0100https://ask.sagemath.org/question/24892/construction of product rings Z/nZ x Z/mZhttps://ask.sagemath.org/question/10347/construction-of-product-rings-znz-x-zmz/Hello,
is it possible in Sage to construct a product ring of two integer modulo rings?
When just creating an cartesian_product,
it is for example not possible to add its elements:
R5=Integers(5)
R3=Integers(3)
CR=R5.cartesian_product(R3)
elem=CR((3,2)) # ok, element construction
elem*elem # ok
elem+elem # fails
CR.list() # not implemented
CR.list_of_elements_of_multiplicative_group # not implemented
jack77Thu, 11 Jul 2013 18:46:09 +0200https://ask.sagemath.org/question/10347/ideal primality in a polynomial ring with integer coefficientshttps://ask.sagemath.org/question/10313/ideal-primality-in-a-polynomial-ring-with-integer-coefficients/Hello,
how primality of an ideal in a polynomial ring with integer coefficients can be checked?
SageMath (5.7) tells me 'notImplementedError'.
Example:
R = ZZ[x]
I = R.ideal(7)
I.is_prime()
# leads to NotImplementedError
In addition, does someone know a good reference to the related theory?
Thanks,
Jackjack77Wed, 03 Jul 2013 07:24:03 +0200https://ask.sagemath.org/question/10313/Integer vs ZZhttps://ask.sagemath.org/question/9968/integer-vs-zz/What's the difference between sage class ZZ (rings/integer_ring.pyx) and Integer (rings/integer.pyx)?
Is one preferred over the other in some cases? Do they provide different functionality?
Maybe instances of Integer are elements of ZZ?!
# Example:
a = ZZ(10)
b = Integer(3)
c = a + b
print a, b, c
print "Type of elements:", type(a), "vs", type(b), "vs", type(c)
print "Type of classes: ", ZZ, "vs", Integermatthew.weippertTue, 02 Apr 2013 10:46:47 +0200https://ask.sagemath.org/question/9968/non-commutative algebra with formal functionshttps://ask.sagemath.org/question/9595/non-commutative-algebra-with-formal-functions/I'd like to look at the following: the set of formal functions with 2 variables f(x,y) and the real numbers a,b,c..., including an addition and a non-commutative multiplication, such that things like
expand((a+f(x,y))*(b+c*f(u,v))) = a*b + a*c*f(u,v) + b*f(x,y) + c*f(x,y)*f(u,v)
are possible (and vice versa), and with the multiplication of the functions
f(x,y)*f(u,v) != f(u,v)*f(x,y)
being non-commutative, however with the multiplication of the functions by the real scalars
a*f(x,y) == f(x,y)*a
still commutative. Can I construct something like that with sage?
MarkSat, 01 Dec 2012 18:37:19 +0100https://ask.sagemath.org/question/9595/Quotienting a ring of integershttps://ask.sagemath.org/question/9556/quotienting-a-ring-of-integers/I was trying to play within the ring of integers of a number field, when I decided to quotient by an ideal. It raised an "IndexError: the number of names must equal the number of generators" exception, which was quite unexpected ; here is an example:
K=NumberField(x**2+1,x)
O=K.ring_of_integers()
O.quo(O.ideal(3))
as you see, I'm using the same ring to define the ideal I want to quotient with, so there is mathematically no problem... so I think either I found a bug or something needs to be documented better. How does one work in a quotient of a ring of integers?SnarkThu, 22 Nov 2012 01:52:30 +0100https://ask.sagemath.org/question/9556/Comparing objects in Pythonhttps://ask.sagemath.org/question/9475/comparing-objects-in-python/ sage: R = ZZ
sage: S = ZZ
sage: R == S
<False>
No really this comes up as "True", but for my class which I derived from the Ring Class, something like this comes up as False. How can I avoid this?SLOtoSFSun, 28 Oct 2012 04:22:44 +0100https://ask.sagemath.org/question/9475/polynomial ring instance checkhttps://ask.sagemath.org/question/8644/polynomial-ring-instance-check/Hi there, folks. How do i check if something is an instance of a polynomial ring (univariate or multivariate)?araichevWed, 18 Jan 2012 17:32:10 +0100https://ask.sagemath.org/question/8644/Finding integer solutions to systems of polynomial equationshttps://ask.sagemath.org/question/8360/finding-integer-solutions-to-systems-of-polynomial-equations/Hi,
I am trying to do something very simple but have been struggling.
Here is a simplified example that I can't get to work. I want to define polynomials with integer coefficients, say
f(A,B) = A+B,
g(A,B) = a*A+b*B,
where I want to assume that a and b are intgers. I want the solver to give me the values of a and b so that f-g is equal to zero as a polynomial in A and B. So, I want it to give me a== 1, b== 1.
I have tried something like this-
R.< A,B > = ZZ[]
f = A+B
var('a', domain = ZZ)
var('b', domain = ZZ)
g = a*A+b*B
solve(f-g==0,a,b),
but what it gives me is [a == -((b-1)*B-A)/A, [1]].
How do I define variables a and b which are integers, but unknown integers? No matter what I seem to do, they are put in Symbolic Ring. How do I get the solve command to give me integer solutions to a set of linear equations?NathanFri, 07 Oct 2011 12:52:03 +0200https://ask.sagemath.org/question/8360/