Attachment 'stuff.sage'
Download 1 # Examine factorization of primes:
2 # Note that 'x' is not explicitly defined
3 # (it's a symbolic variable, set by default).
4 f = x^2-15
5 K.<a> = NumberField(f); K
6 OK = K.maximal_order(); OK
7 A = 5*OK; A
8 FF = A.prime_factors(); FF
9 P = FF[0]
10 P.is_prime()
11 P.ramification_index()
12 P.residue_class_degree()
13
14 # Define a function for your own use
15 def RamifiedPrimes(K):
16 import sage.rings.number_field.number_field as NF
17 if not isinstance(K,NF.NumberField_quadratic):
18 return -1
19 D = K.discriminant()
20 FL = D.factor()
21 PL = [FL[i][0] for i in xrange(len(FL))]
22 return PL
23
24 # and use it.
25 RamifiedPrimes(K)
26
27 #if this is in a file, you can load it:
28 load /tmp/ram.sage
29 attach /tmp/ram.sage
30
31 # Define a number field with generator alpha,
32 # a root of x^3-2 (shows symbolic usage)
33 K.<alpha> = NumberField(x^3 - 2); K
34 alpha^3
35
36 # You can deal with polynomials in a more "official" way (we've
37 # clobberred Zx by clobbering 'x', so we have to recreate it.
38
39 Zx.<x> = PolynomialRing(ZZ)
40 f = x^2+2
41 L.<beta> = NumberField(f); L
42 beta^2
43 K.complex_embeddings() # K is the cubic field above
44 L.complex_embeddings()
45
46 # Check what happened to 'x'
47 type(x)
48 reset('x')
49 type(x)
50
51 # Clobber 'x' and see what happens:
52 x = 1
53 E.<gamma> = NumberField(x^3-2); E
54 reset('x')
55
56 # Symbolic Use:
57 a = sqrt(2); a
58 K.<b> = QQ[a]; K
59 b
60 b^2
61 (b+1)^2
62 QQ[a/3 + 5]
63
64 # Be aware of notation:
65 QQ[b]
66 # vs.
67 QQ(b)
68 # What's the difference?
69
70 # Some Galois Group computations
71 K.<a>=NumberField(x^3-2)
72 G = K.galois_group(); G
73 G.order()
74
75 L.<b> = K.galois_closure(); L
76 G1 = L.galois_group()
77 G1.order()
78 G2 = Hom(L, L)
79 G2
80 G2.order()
81 G2.list()
82 phi = G2.list()[1]
83 phi
84 phi(b^2 + 2/3*b)
85
86 # Class Numbers
87 L.<a> = NumberField(x^2 + 23)
88 L.class_number()
89
90 # Orders
91 K.<I> = NumberField(x^2 + 1)
92 R = K.order(7*I); R
93 R.basis()
94 O=K.maximal_order(); O
95 R.index_in(O)
96
97 # Relative Extensions
98 K.<sqrt2> = QuadraticField(2)
99 R.<X> = K[]; R
100 L.<a> = K.extension(X^3 + sqrt2*X + 5); L
101 a^3
102 a^3 + sqrt2*a
103 L.galois_group()
104 L.absolute_degree()
105
106 ### Group Theory/Gap Wrapping
107 PSL1 = PSL(3,4)
108 PSL1.order()
109 PSL1.is_simple()
110 P2 = PSL1.sylow_subgroup(2)
111 P2.center().order()
112 P7 = PSL1.sylow_subgroup(7)
113 # Now, Suppose we want the cosets of P2 in PSL1.
114 # Check with the TAB trick...
115
116 # No such luck...
117 # But we can wrap this in Gap clothing and work with
118 # Gap directly
119 # We wrap up the pieces:
120 GPSL1 = gap(PSL1)
121 GP7 = gap(P7)
122 RC = GPSL1.RightCosets(P7)
123 len(RC)
124 C = RC[1]; C
125 # Note that this is *not* a python list:
126 C[1]
127 # It *is* a Gap list:
128 C.Elements()[2]
129 type(C)
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.