1 /* Some cubic polynomials */
3 block([s,v],s:splitfield(x^3-x-1,x),v:listofvars(s)[1],subst(a,v,s));
4 [a^6-6*a^4+9*a^2+23,-((a^4-5*a^2+9*a+4)/18),(a^4-5*a^2+4)/9,
5 -((a^4-5*a^2-9*a+4)/18)]$
7 /* x^3-x-1 splits completely in Q[a] and one recognizes the roots */
9 algfac(x^3-x-1,a^6-6*a^4+9*a^2+23);
10 ((9*x-a^4+5*a^2-4)*(18*x+a^4-5*a^2-9*a+4)*(18*x+a^4-5*a^2+9*a+4))/2916$
12 /* Adding just one root it factors partially */
14 algfac(x^3-x-1,a^3-a-1);
15 (x-a)*(x^2+a*x+a^2-1)$
17 /* Adding a root of the second factor completes the factorization */
19 primelmt(x^2+a*x+a^2-1,a^3-a-1,b);
20 [b^6-6*b^4+9*b^2+23,x+2*a]$
22 /* One recovers the splitting polynomial obtained by splitfield. Moreover
23 this is an example where the prime element is of the form x+n*a with n > 1 */
25 bdiscr(1,x,x^2,x^3-x-1);
28 poly_discriminant(x^3-x-1,x);
31 /* If x is a root, it is an algebraic integer, because the equation is monic, and so is
32 x^2, then since 23 is prime, {1,x,x^2} is a basis of the algebraic integers in Q[x] */
34 /* Works for a factorized polynomial */
36 block([s,v],s:splitfield((x^2-3)*(x^2-2),x),v:listofvars(s)[1],subst(a,v,s));
37 [a^4-10*a^2+1,-((a^3-9*a)/2),(a^3-9*a)/2,(a^3-11*a)/2,-((a^3-11*a)/2)]$
39 /* One can see that as the successive adjunction of sqrt(2) and sqrt(3),
40 that is Q[sqrt(2),sqrt(3)] */
42 primelmt(a^2-2,b^2-3,c);
45 /* Irreducible quartic polynomials */
48 (x-a)*(x+a)*(x^2+a^2)$
50 /* This is an example from S. Lang, Algebra. If a=2^(1/4), it generates
51 a subfield (1,a,a^2,a^3) of dimension 4, which doesn't contain all roots.
52 One needs to add %i to get all of them. Thus the Galois group has 8 elements
53 and has subgroups of order 4 and 2 */
55 primelmt(a^4-2,b^2+1,c);
56 [c^8+4*c^6+2*c^4+28*c^2+1,b+a]$
58 algfac(x^4-2,c^8+4*c^6+2*c^4+28*c^2+1);
59 ((24*x-c^6-5*c^4-13*c^2-29)*(24*x+c^6+5*c^4+13*c^2+29)
60 *(24*x-5*c^7-19*c^5-5*c^3-151*c)
61 *(24*x+5*c^7+19*c^5+5*c^3+151*c))/331776$
63 /* Another example with Galois group of order 8 */
65 block([s,v],s:splitfield(x^4+10*x^2-96*x-71,x),v:listofvars(s)[1],subst(a,v,s[1]));
66 a^8+148*a^6-576*a^5+9814*a^4-42624*a^3+502260*a^2+1109952*a+18860337$
68 /* With a small change the Galois group is of order 24. The computation takes much
71 block([s,v],s:splitfield(x^4+10*x^2-96*x-72,x),v:listofvars(s)[1],subst(a,v,s[1]));
72 a^24+700*a^22-8640*a^21+202860*a^20-5040000*a^19+85120320*a^18
73 -1084446720*a^17+28192407600*a^16-307448294400*a^15
74 +3879455590080*a^14-79002155473920*a^13+862062450860352*a^12
75 -6341012384716800*a^11+173144130732249600*a^10
76 -861539021970186240*a^9+6648562403288386560*a^8
77 -183678612853284864000*a^7+785273136304331653120*a^6
78 +746838863325592289280*a^5+176781240435133218734080*a^4
79 +116524085058329916211200*a^3+6983186268545823770542080*a^2
80 -29426422063945596083896320*a+430620712916420842049765376$
82 /* For an algebraic curve, such as an hyperbola. Here x^3+2*x*y^2+y^3 is
83 some algebraic function on the curve. */
85 algtrace(x^3+2*x*y^2+y^3,y^2-x^2+1,y);
88 ratsimp(ratsubst(sqrt(-1+x^2),y,x^3+2*x*y^2+y^3)+ratsubst(-sqrt(-1+x^2),y,x^3+2*x*y^2+y^3));
91 /* Taking the trace with respect to y one projects the curve on the x axis and one gets
92 an algebraic function of x */
94 /* A complicated example with a solvable quintic from D.S.Dummit, Mathematics of computation
95 57,195(1991)387 . This is clearly at the limit of what maxima can do in reasonable time. Dummit
96 indeed shows the the Galois group is the Frobenius group of order 20. */
98 block([s,v],s:splitfield(x^5+15*x+12,x),v:listofvars(s)[1],subst(a,v,s));
99 [a^20+60*a^16-936*a^15+91350*a^12+605880*a^11+1417536*a^10+36463500*a^8
100 +122488200*a^7+84862080*a^6-91103616*a^5+1032800625*a^4
101 +1697841000*a^3+7485825600*a^2+4760933760*a+10933303536,
102 -((131880620547249*a^19+59683129753141*a^18-304524778993866*a^17
103 +793203234964096*a^16+4124149330829589*a^15
104 -117172981627806003*a^14-71306340933544902*a^13
105 +298650865231229952*a^12
106 +11251695090720035763*a^11
107 +88411847804251841367*a^10
108 +196440402174914992122*a^9
109 -38341429061015510352*a^8
110 +4577341927136007203127*a^7
111 +17087648569913092051863*a^6
112 +4481766149602673412342*a^5
113 -15341521613198393243376*a^4
114 +60345466908156421500816*a^3
115 +71102697168836172551184*a^2
116 +1112228012805629359857696*a
117 +1452913156334429802008064)
118 /948905619130801728000000),
119 (34941883569106*a^19-19586610011161*a^18-28628104018984*a^17
120 +62261757956409*a^16+2067346063311366*a^15
121 -33646881858167757*a^14+15872125201726692*a^13
122 +31165731682124373*a^12+3118730624434774902*a^11
123 +19424644835781405573*a^10
124 +34928604068980953168*a^9-38639423702912510133*a^8
125 +1269187385301553504698*a^7
126 +3667076703510023078577*a^6
127 -455062882588288189452*a^5
128 -6073679019448320564969*a^4
129 +39452666543681343198264*a^3
130 +47232807378617176983216*a^2
131 +172758700340547215707584*a
132 +55253832604158366243216)
133 /79875691357815936000000,
134 -((89591685911602852*a^19+2456426401544275*a^18-79829287283577388*a^17
135 -111266747126642685*a^16
136 +6693211742640744216*a^15
137 -85247275218262553049*a^14
138 -7299844963479831120*a^13
139 +74488279542565111191*a^12
140 +8274877365995836629420*a^11
141 +53413178567062212453753*a^10
142 +121592356188979166775396*a^9
143 -50703322221226476748215*a^8
144 +3190417858093889386657296*a^7
145 +11697039806926436578278045*a^6
146 +5565042124477506830126808*a^5
147 -21907925941416463634269203*a^4
148 +111830991479469725159092680*a^3
149 +226384145027764567538132592*a^2
150 +505623402016123027927501440*a
151 +199640907190542149950414896)
152 /278840229388945773235200000),
153 (87530181817718523*a^19+1215087725977030782*a^18
154 -953928919736667912*a^17
155 -1313560049466028133*a^16
156 +9462158957065791483*a^15
157 -30528725605743381606*a^14
158 -1150352116504017502104*a^13
159 +734949752502164464839*a^12
160 +9542188140971754165201*a^11
161 +159271468071468573427074*a^10
162 +789030615124104571528344*a^9
163 +1002612772932828989646321*a^8
164 +1441683814063122556892289*a^7
165 +53856342854315366109409926*a^6
166 +116471037468993801002554824*a^5
167 -71683288419330233672409027*a^4
168 -112235865378225651840900168*a^3
169 +1132885879666976209353768288*a^2
170 +1236791680392483380748206592*a
171 +5963360303581465557565858608)
172 /1917026577049002190992000000,
173 -((87530181817718523*a^19+1215087725977030782*a^18
174 -953928919736667912*a^17
175 -1313560049466028133*a^16
176 +9462158957065791483*a^15
177 -30528725605743381606*a^14
178 -1150352116504017502104*a^13
179 +734949752502164464839*a^12
180 +9542188140971754165201*a^11
181 +159271468071468573427074*a^10
182 +789030615124104571528344*a^9
183 +1002612772932828989646321*a^8
184 +1441683814063122556892289*a^7
185 +53856342854315366109409926*a^6
186 +116471037468993801002554824*a^5
187 -71683288419330233672409027*a^4
188 -112235865378225651840900168*a^3
189 +1132885879666976209353768288*a^2
190 -680234896656518810243793408*a
191 +5963360303581465557565858608)
192 /3834053154098004381984000000)]$
194 /* Strangely this slightly different example of Dummit has a Galois group of order 10
195 and is obtained much faster. */
197 block([s,v],s:splitfield(x^5-5*x+12,x),v:listofvars(s)[1],subst(a,v,s));
198 [a^10-20*a^8-60*a^7+230*a^6+612*a^5-400*a^4-4020*a^3+39865*a^2-167220*a
200 -((4402021*a^9+8967410*a^8-71413351*a^7-408236968*a^6+199818827*a^5
201 +3092804186*a^4+4100015915*a^3-6578347876*a^2
202 +173297643052*a-409949875488)
204 (129271*a^9-1030711*a^8-6736419*a^7+9580539*a^6+215434401*a^5
205 +342066891*a^4-1374973581*a^3-3638935299*a^2+647047544*a
208 (10382*a^9+27879*a^8-140650*a^7-1021019*a^6-626422*a^5+5112817*a^4
209 +14638214*a^3+12817495*a^2+373402956*a-783084692)
211 (1134512*a^9+2308737*a^8-18765741*a^7-110380420*a^6+52641936*a^5
212 +881981807*a^4+1324907097*a^3-2706594556*a^2+41658559300*a
215 -((1134512*a^9+2308737*a^8-18765741*a^7-110380420*a^6+52641936*a^5
216 +881981807*a^4+1324907097*a^3-2706594556*a^2
217 +33025206100*a-104470966864)
220 /* And this one is even more degenerate */
222 block([s,v],s:splitfield(x^5-110*x^3-55*x^2+2310*x+979,x),v:listofvars(s)[1],subst(a,v,s));
224 [a^5-110*a^3-55*a^2+2310*a+979,(a^3-3*a^2-72*a+99)/25,
225 (a^4-4*a^3-94*a^2+196*a+1276)/125,-((a^4+a^3-84*a^2-89*a+671)/125),
228 /* Since splitfield extensively uses algnorm and factorization in extensions, one can
229 assume that they work correctly */