[sage-support] Working with roots of unity in sage

2012-04-15 Thread Andrew Mathas
Hi, Can some one please tell me what is the best/most efficient way to do calculations with roots of unity inside sage. I want to do calculations inside with with a family of algebras which are defined over a field K which contains a primitive e-th root of unity, where the characteristic of K

[sage-support] Calculating with primitive roots of unity in sage

2012-04-15 Thread Andrew Mathas
Hi, I was wondering if some one can tell me the most efficient way of doing calculations with roots of unity inside sage. Specifically, I want to do some calculations with some algebras defined over fields K which contain prescribed roots of unity, where K has arbitrary characteristic. In char

[sage-support] Re: Calculating with primitive roots of unity in sage

2012-04-15 Thread Andrew Mathas
Thanks for the replies! Over other fields it's no good just extending by a root of the n'th > cyclotomic polynomial, since that need not be irreducible! The example you > gave was particularly unfortunate since over GF(5) the 5th cyclotomic poly > has only 1 root with multiplicity 4. So it's

[sage-support] Re: Calculating with primitive roots of unity in sage

2012-04-15 Thread Andrew Mathas
> For fields of characteristic p>0, I need to work in GF(p^a) for some a so > I guess that my question really is: does anyone know how to construct the > smallest extension of GF(p) which contains a primitive eth root of unity > when gcd(e,p)=1? > Oops, when I phrase my question this way the

[sage-support] Localising at a prime ideal

2012-05-02 Thread Andrew Mathas
Hi All, Is there any way in sage to construct the localisation (or localization if you prefer) of a ring at a prime ideal? For example, I would like to do the following: sage: R=ZZ.extension(cyclotomic_polynomial(6),'xi') sage: xi=R.gen(1) sage: I=R.ideal(7,xi+4) sage: RI = R.localise(I) Andre

[sage-support] Re: swtich Gap to Sage

2012-11-02 Thread Andrew Mathas
I think that this does the same as your code, although it seems to me that this is not want you really want because the pairs (A,B) of subgroups that you return will not in general have the property that G=A x B. I have not played at all with groups in sage before so this may be far from optimal

[sage-support] Re: Monoid algebra

2012-11-12 Thread Andrew Mathas
I think that this does want you want and it's just the absence of documentation that is letting you down. Try: sage: M = FreeMonoid(3,['a','b','c']) sage: a,b,c=M.gens() # or use M.inject_variables() sage: A=M.algebra(QQ) sage: A(a)*A(b)+ A(c) B[c] + B[a*b] Andrew -- You received

[sage-support] Constructing subsapces of vector spaces

2012-12-02 Thread Andrew Mathas
Hi All, I have been playing with some code where I want to find a submodule of a module V which is annihilated by a bunch of maps. What I want to do something like the following: V= some free submodule of rank v inside a space of rank d\ge v. mat=[[0 for col in range(w)] for row in range(v)] #

[sage-support] Re: Constructing subsapces of vector spaces

2012-12-03 Thread Andrew Mathas
Hi John, Thanks for the reply, but you have my problem "upside down" as I don't need to restrict from the ambient space to the subspace but rather to extend from the subspace to the ambient space. For example, I could have: sage: V Free module of degree 4 and rank 3 over Integer Ring User bas

[sage-support] Re: Constructing subsapces of vector spaces

2012-12-04 Thread Andrew Mathas
Thanks Nils. I this is similar to, but more elegant than, what I tried earlier. I went back to the solution above, however, I thought that there was probably a lot of overhead in creating the space ZZ^3 and the homomorphism. Indeed, %timeit V.hom([(ZZ^3)(v) for v in [[1,2,3],[2,1,4],[3,3,7]]]).

[sage-support] Problems with multivariate Laurent polynomial subtitution

2013-09-18 Thread Andrew Mathas
Hello All, I have some polynomials in two varaibles, say u and v, and I want to apply the map which u to u^-1 and v to v^-1. Sadly, I run to problems insude sage: With one variable it is OK: sage: R.=LaurentPolynomialRing(ZZ) sage: p=u**-1 sage: p.substitute(u=u^-1) u but when I go to tw

[sage-support] Re: Problems with multivariate Laurent polynomial subtitution

2013-09-18 Thread Andrew Mathas
As I posted in sage-dev the problem actually is with the coefficients and I found a somewhat heavy handed solution: sage: R.=LaurentPolynomialRing(ZZ,2) sage: p=2*u**-1*v**-1+u*v sage: sum( R(c)*u**-exp[0]*v**-exp[1] for (exp,c) in p.dict().iteritems() ) 2*u*v + u^-1*v^-1 Andrew -- You receive

[sage-support] Re: Comment in python code [[cloud.sagemath.com]]

2013-11-03 Thread Andrew Mathas
This is not a bug. Rather it is a consequence of the syntax require by python. To quote from the python documentation : Leading whitespace (spaces and tabs) at the beginning of a logical line is used to compute the indentation level of