ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 05 Oct 2019 20:02:20 -0500subquotient of modulehttp://ask.sagemath.org/question/48198/subquotient-of-module/how can I take a quotient of a submodule? I was expecting the following to work:
<pre><code>sage: M = CombinatorialFreeModule(QQ, [1,2], prefix='x'); x = M.basis()
sage: A = M.submodule([x[2]])
sage: A.quotient_module(A)
Free module generated by {1} over Rational Field
</code></pre>
Which is clearly taking the quotient over the ambient space of `A` and not the image
<pre><code>sage: A.quotient_module(A) == M.quotient_module(A)
True</code></pre>
Replacing `A` with `A.lift.image()` is the same.
EDIT: well, reading now in `Modules.WithBasis.FiniteDimensional.ParentMethods.quotient_modules` this is simply a call to `QuotientModuleWithBasis(A,category)` which will infer the parent of `A`.
As a side observation, I find it disturbing that there is not even a check that `submodule` is indeed a submodule of `self` in that call.heluaniSat, 05 Oct 2019 20:02:20 -0500http://ask.sagemath.org/question/48198/Determinants of Matrices with Symmetric Functionshttp://ask.sagemath.org/question/47774/determinants-of-matrices-with-symmetric-functions/I'm interested in calculating the determinant of the matrix $ A = (a_{i+j})$ for $0\leq i,j\leq n$ in which $a_{k} = \frac{h_k}{e_k}$ where $h_k, e_k$ are the homogeneous (elementary, resp.) symmetric functions of degree $k$. I would like to express the numerator of $\det(A)$ in terms of monomial symmetric functions.
I have written some code that I think does the job, but it seems an incredibly hacky way of doing it in my opinion. Since I am quite new to sage I was wondering whether someone might be able to take a look at what I've done and suggest a more sage-like way to tackle this problem? My code is below.
I define a set of functions:
# set up two matrices containing symbolic functions hh(i+j), ee(i+j), which are later replaced with symmetric functions h and e
def heMatrices(N):
hh = function('hh')
ee = function('ee')
H = matrix(SR,N,N,lambda i,j:hh(i+j))
E = matrix(SR,N,N,lambda i,j:ee(i+j))
return H,E
# Pointwise divides two matrices (a bit like Hadamard division??)
def elementwiseDivision( M, N ):
assert( M.parent() == N.parent() )
nc, nr = M.ncols(), M.nrows()
A = copy( M.parent().zero() )
for r in range(nr):
for c in range(nc):
A[r,c] = M[r,c] / N[r,c]
return A
# extracts numerator of determinant
def extractNumerator(M):
return det(M).numerator()
# extracts denominator of determinant
def extractDenominator(M):
return det(M).denominator()
# This is dodgy - treates expression as a python string and replaces e(x) with e[x], h(x) with h[x]
def convertToSymmetricString(expr):
st = str(expr)
st = st.replace('(','[')
st = st.replace(')',']')
st = st.replace('ee','e')
st = st.replace('hh','h')
return st
# Puts together the above functions.
def evaluateDeterminant(N):
h,e = heMatrices(N)
A = elementwiseDivision(h,e)
srExpression = extractNumerator(A)
sageExpression = convertToSymmetricString(srExpression)
return sageExpression
Then I open sage in the command line and type the following:
sage: Sym = SymmetricFunctions(QQ)
sage: Sym.inject_shorthands(verbose=False)
sage: ee = evaluateDeterminant(2)
sage: ans = sage_eval(ee, locals=vars())
sage: ans = m(ans)
which returns
2*m[2, 1, 1] + 2*m[2, 2] + 2*m[3, 1] + m[4]
which I believe is what I'm after.WubbaLubbaDubDubFri, 06 Sep 2019 04:24:50 -0500http://ask.sagemath.org/question/47774/Unexpected result: quotient of algebra of free monoid by idealhttp://ask.sagemath.org/question/45824/unexpected-result-quotient-of-algebra-of-free-monoid-by-ideal/I'm hoping to use SAGE to calculate some asymptotic results in a larger problem. Along the way, I ran into some unexpected behavior. In the minimal example below, I am trying to create a simple FreeMonoid and expand it to an Algebra where the following constraint holds: a^2 - 1 == 0.
# Create monoid + corresponding algebra
M.<a,b> = FreeMonoid(2)
F = M.algebra(QQ)
# Create two sided ideal and quotient
I = F*[F(a)^2-F(1)]*F
A = F.quotient(I)
# Returns false
A(a^2) == A(1)
This returns False, and looks like it may be related to an older bug (trac ticket 24808; can't post link b/c new user with low karma). I'm using SageMath version 8.5.
It's quite possible I'm doing something bone-headed; I haven't thought about abstract algebra in over a decade. Any suggestions would be helpful!
Thanks,
Dustin
Dustin01Mon, 18 Mar 2019 13:52:28 -0500http://ask.sagemath.org/question/45824/Quotient of non-commutative ringhttp://ask.sagemath.org/question/45480/quotient-of-non-commutative-ring/ I'm trying to make a non-commutative ring, where X^2 = -1 ; XY = -YX and Y^2 = 0, something like this ;
R[X,Y] / (X^2 + 1 , XY + YX , Y^2)
To get the non-commutative part, I did :
A.<x,y> = FreeAlgebra(QQ,2)
P.<x,y> = A.g_algebra(relations={y*x:-x*y})
What is the next command to have the quotient by (X^2+1 , Y^2) ? Or maybe an other way to build the entire ring, if there exists a simpler method :) thanks !
franslagSat, 16 Feb 2019 14:54:16 -0600http://ask.sagemath.org/question/45480/weird behavior quotient operatorhttp://ask.sagemath.org/question/45099/weird-behavior-quotient-operator/Hello,
i am calculating the quotient of a really big number using the operator //
the fact is: if the big number is in a variable, let's say x, and i write x//2, it won't work (it'll return x/2).
But if i copy/paste the big number and write //2 at the end, it works.
I don't understand it.
I wanted to post a picture as example, but it seems that i need more karma to do it...
so instead i put a copy/paste of the problem at the end of this post. The variable's name is "test", so i first print it, then do the //2; as you can see it doesn't work, i got the same number with /2 at the end. Then i copy/paste the number and use //2 again and here it works. The point is: when i use it in a programm, i can't copy/paste the number, it'll be in a variable. And then it fails.
sage: test
837852367160941686882182203279810821534331590056292182065749220359229900094799322306853693706463088872767820405170018794451898101765853614283153521412505365960228304480760794688517092896652646155467604050167410281621256684893277033624912312765082826592417694451712096609637026970174504593832198908321736540951
sage: test//2
837852367160941686882182203279810821534331590056292182065749220359229900094799322306853693706463088872767820405170018794451898101765853614283153521412505365960228304480760794688517092896652646155467604050167410281621256684893277033624912312765082826592417694451712096609637026970174504593832198908321736540951/2
sage: 83785236716094168688218220327981082153433159005629218206574922035922990009479932230685369370646
....: 30888727678204051700187944518981017658536142831535214125053659602283044807607946885170928966526
....: 46155467604050167410281621256684893277033624912312765082826592417694451712096609637026970174504
....: 593832198908321736540951//2
418926183580470843441091101639905410767165795028146091032874610179614950047399661153426846853231544436383910202585009397225949050882926807141576760706252682980114152240380397344258546448326323077733802025083705140810628342446638516812456156382541413296208847225856048304818513485087252296916099454160868270475AbliaFri, 18 Jan 2019 10:26:41 -0600http://ask.sagemath.org/question/45099/Identity in a quotient Grouphttp://ask.sagemath.org/question/44965/identity-in-a-quotient-group/ Hello everyone, I have the following groups
F3.<a1,b1,a2,b2,a3,b3> = FreeGroup()
H3 = F3.quotient([a1*b1/a1/b1*a2*b2/a2/b2*a3*b3/a3/b3])
Then I inject the variables to $H3$
H3.inject_variables()
Now when every element that I write have parent $H3$, but when I write the word `a1*b1/a1/b1*a2*b2/a2/b2*a3*b3/a3/b3`
this does not return the identity of $H3$, although if I put
a1*b1/a1/b1*a2*b2/a2/b2*a3*b3/a3/b3 == H3.one()
this is true. Does anyone know why this happen and how can I get sage to reduce this word to identity of $H3$?
MarioMTue, 08 Jan 2019 18:03:52 -0600http://ask.sagemath.org/question/44965/Quotient Group constructionhttp://ask.sagemath.org/question/42747/quotient-group-construction/ I have created a group in the category - finite enumerated commutative subgroup. But it doesn't have an option of quotient group ( it has but shows Not Implemented Error)
I wanted to know why implementing a quotient group is not possible if quotient ring is done already?
Actually, I was thinking to implement it myself, but I thought it will be good to ask here first if people have tried that.
Also, does anyone know how I can track the current progress being done in sage.mathjainTue, 26 Jun 2018 19:49:42 -0500http://ask.sagemath.org/question/42747/Examining the quotients of a module $R\times R$ where $R$ is a finite ring.http://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 08:28:00 -0600http://ask.sagemath.org/question/41421/How can you operate in a quotient of a group finitely presented?http://ask.sagemath.org/question/37511/how-can-you-operate-in-a-quotient-of-a-group-finitely-presented/Hello everyone, I have the following groups
G.<a,b> = FreeGroup()
H = G.quotient([a*b*a.inverse()*b.inverse()])
I would like SAGE to understand the product of to lateral clases in H? It is that possible?
Thanks in advance!NCAThu, 04 May 2017 12:56:13 -0500http://ask.sagemath.org/question/37511/Writing elements as a linear combination in a basis in a quotient ringhttp://ask.sagemath.org/question/33322/writing-elements-as-a-linear-combination-in-a-basis-in-a-quotient-ring/I have an explicit ideal in a multivariable polynomial ring R. I know a priori that the quotient
ring R/I is finite dimensional (as a vector space). In fact I have an explicit basis in R/I. I have all this programmed into sage. Is there a way to find the linear combination for a given element in R/I in the given basis?
example:
sage: R.<e1,e2>=PolynomialRing(QQ)
sage: I = ideal(e1^3 -2 * e2 * e1 +1, e2 * e1^2 - e2^2 - e1)
sage: I.vector_space_dimension()
6
sage: f22= e2^2 - e1; f21 = e2*e1 - 1; f11 = e1^2 - e2; f1= e1; f2 = e2; f0 = 1;
sage: I.reduce(f21*f21)
e1*e2
sage: I.reduce(f21*f21) == f21 + f0
True
I have an ideal I in R and I know that the quotient ring R/I is 6 dimensional over the field. I have the basis
f22,f21,f11,f2,f1,f0 of R/I as a vector space over QQ. I would like to find the structure constants of this finite dimensional algebra. For example compute f21^2 in the quotient ring, and write it in the basis, we get f21^2=f21+f0.
But I only get it by hand and would like to compute it with sage, so that I could get the whole set of structure constants. mathworkerThu, 05 May 2016 14:07:11 -0500http://ask.sagemath.org/question/33322/How to find a particular coset?http://ask.sagemath.org/question/33317/how-to-find-a-particular-coset/I am in the situation where I have groups $A,G$ with $G$ normal in $A$ such that $A/G$ is cyclic. I would like to find the coset of $G$ corresponding to a generator of $A/G$. AsvinWed, 04 May 2016 11:17:55 -0500http://ask.sagemath.org/question/33317/Rings, Ideals, Quotient Rings in Sagehttp://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 02:38:47 -0500http://ask.sagemath.org/question/29990/Quotient of Polynomial rings reduction not workinghttp://ask.sagemath.org/question/27068/quotient-of-polynomial-rings-reduction-not-working/<code>
<br>R.<x>=PolynomialRing(QQ)
<br>R.ideal(x^4).reduce(x^8+1)
<br>R.<x>=PolynomialRing(ZZ)
<br>R.ideal(x^4).reduce(x^8+1)
1
x^8 + 1
</code>
Why am I not getting the result 1 in both cases?WizqTue, 09 Jun 2015 08:44:26 -0500http://ask.sagemath.org/question/27068/Mysterious behavior for quotient rings and cover()http://ask.sagemath.org/question/10944/mysterious-behavior-for-quotient-rings-and-cover/I don't understand this:
R.<T,U>=PolynomialRing(QQ)
Q=R.quo((T^2))
pi=Q.cover()
pi(T)
-- returns Tbar
However:
R.<T>=PolynomialRing(QQ)
Q=R.quo((T^2))
pi=Q.cover()
pi(T)
-- returns an error.jeremy9959Sat, 18 Jan 2014 01:49:36 -0600http://ask.sagemath.org/question/10944/preorders and posetshttp://ask.sagemath.org/question/10866/preorders-and-posets/I am looking for a module having to do with preorders (sets with reflexive and transitive relations, also called quasi-orders). I'd like to use a few of the poset methods on preorders, but this doesn't seem to work. That is, I get
Traceback (click to the left of this block for traceback)
...
ValueError: Hasse diagram contains cycles.
I figure that either there is a way to indirectly use the poset methods on preorders more generally, or else someone has implemented the quotient operation. (This turns a preorder (A,\leq) into a poset by taking the quotient under the equivalence relation \equiv on A by a \equiv b iff a \leq b and b \leq a.Larry MossSun, 29 Dec 2013 05:02:55 -0600http://ask.sagemath.org/question/10866/Power of a polynomial mod (n, X^r - 1)http://ask.sagemath.org/question/8742/power-of-a-polynomial-mod-n-xr-1/I need to calculate (X + a)^n mod (n, X^r - 1), where n can be very large.
I use the following code:
R.<x>=PolynomialRing(Integers(n))
pow(x + a, n, X^r - 1)
A better (i.e. faster) solution?
Thanks.mcl1962Mon, 27 Feb 2012 00:39:15 -0600http://ask.sagemath.org/question/8742/