I've been developing (see below) a script on how to calculate Galois groups using a statistical method. However, when I try to run the code for degree >_ 10 on cocalc (SageMathCloud), I end up with an error stating:
f = x^11 + 25*x^4 + 39 There are 348511 primes less than 5000000 which do not divide disc(f) cycle type (2, 3, 5) occurs 11601 times,ieError in lines 27-31 Traceback (most recent call last): File "/projects/sage/sage-7.6/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 995, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 5, in NameError: name 'numerical' is not defined
I was hoping if someone could potentially help me to ensure that the script is working properly - I just would like to play around with this and see what the weaknesses are with this script.
R.<x>=ZZ[x];
f=;
y =
print "f =", f;
if f.is_irreducible()==true:
L=[];
for i in range (y):
if is_prime(i)==true:
if disc(f)%i!=0:
k=f.change_ring(GF(i)).factor();
l=[];
for j in range(len(k)):
if k[j][1]*k[j][0].degree()>=2:
l.append(k[j][1]*k[j][0].degree());
L.append(tuple(l));
c=len(L);
print "There are",c, "primes less than",y, "which do not divide disc(f)";
S=Set(L)
v=0;
for r in range(len(S)):
if S[r]==():
v=1;
h=L.count(S[r]);
o=numerical_approx(c/h,digits=1);
print "The order of G is", o
print "Identity occurs", L.count(S[r]), "times, ie:" ,RealField(2) (L.count(S[r])*100/c), "%";
for r in range(len(S)):
if S[r]!=():
if v==1:
print "cycle type",S[r], "occurs", L.count(S[r]),"times,ie:",numerical_approx(L.count(S[r])*100/c,digits=2),"%","n",S[r],"=",numerical_approx(L.count(S[r])/h,digits=1);
else:print "cycle type", S[r], "occurs",L.count(S[r]), "times,ie",numerical_approx(L.count(S[r])*100/c,digits=2),"%";
Thank you and have a good day. :-)

This may still have some problems, but it now runs successfully for me. Changes are on lines 13 and 14 in the tuples replace the letter "l" with the digit "1" On line 24 replace digits=0 with digits = 1 Fix indentation on lines 30ff. Finally replace the "." with a "," in L.count(S[r])*100/c.digits=2 around line 30