Hey everyone:
So, Im going to be writing a program that needs to go through a loop and
store a polynomial from M2 through each loop. I wanted this to work as
quickly as possible, so I was comparing the speed of the toString function
in M2 to the to_sage() part I contributed here:
https://trac.sagemath.org/ticket/20936#comment:1
Note, I haven't quite fixed it up yet but it's working so far for my
purposes. Anyways, so here's the code I run in Sage:
macaulay2.eval("""
K = toField(QQ[zet]/(zet^8 - zet^6 + zet^4 - zet^2 + 1))
A=matrix{{zet^1,0,0},{0,zet^2,0},{0,0,zet^3}}
needsPackage "InvariantRing"
G=generateGroup({A},K)
P = molienSeries G
""")
I want to take the rational molein series, P, and convert it to a function
in Sage(so that, later, I can compute the series expansion of it). Here are
the two things I tried:
This is using my editted version of to_sage(), which converts P to a string:
sage: timeit('macaulay2("P").to_sage()')
125 loops, best of 3: 4.12 ms per loop
This is using M2's internal string conversion:
timeit('macaulay2.eval("toString molienSeries G")')
5 loops, best of 3: 3.97 s per loop
Why is the difference so huge? This makes me want to finish up that trac
contribution, because it seems like M2's internal string conversion
function is really slow. But, it could be that I'm doing something
incorrectly that is making is slower. If so, I'd love to know.
Also, on the matter on efficiency, I believe Dima mentioned a few months
ago in a post that GAP is far better at computing the molien series of
groups(which is exactly what I'm trying to do here). However, I couldn't
figure out how to do that in Sage. How do I generate a group in GAP and
calculate it's molien series, like I did in my above M2/Sage code? What I
need to do for my project is compile a list of all the molien series of all
the possible groups for a certain root of unity. So like, the matrices in
my group are 3x3, I was thinking that I would have 3 levels of nested
loops, where each would vary the exponent on zet up to the root of unity.
So, for example if I'm doing a 20th root of unity, it would be something
like (psuedocode):
So basically, as it iterates through the loop, the exponents in the matrix
"A" change, and eventually I have the molien series representation of every
possible group for that root of unity. Does that make sense? This looks
pretty choppy to me, so if anyone has any tips on making this faster or
better, I would highly appreciate it. Thanks!
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.