File: rtest_extensions.mac

package info (click to toggle)
maxima 5.49.0-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 128,980 kB
  • sloc: lisp: 437,854; fortran: 14,665; tcl: 10,143; sh: 4,598; makefile: 2,204; ansic: 447; java: 374; python: 262; perl: 201; xml: 60; awk: 28; sed: 15; javascript: 2
file content (229 lines) | stat: -rw-r--r-- 11,118 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
/* Some cubic polynomials */

block([s,v],s:splitfield(x^3-x-1,x),v:listofvars(s)[1],subst(a,v,s));
[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,
-((a^4-5*a^2-9*a+4)/18)]$

/* x^3-x-1  splits completely in Q[a] and one recognizes the roots */

algfac(x^3-x-1,a^6-6*a^4+9*a^2+23);
((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$

/* Adding just one root it factors partially */

algfac(x^3-x-1,a^3-a-1);
(x-a)*(x^2+a*x+a^2-1)$

/* Adding a root of the second factor completes the factorization */

primelmt(x^2+a*x+a^2-1,a^3-a-1,b);
[b^6-6*b^4+9*b^2+23,x+2*a]$

/* One recovers the splitting polynomial obtained by splitfield. Moreover
this is an example where the prime element is of the form x+n*a with n > 1 */

bdiscr(1,x,x^2,x^3-x-1);
''(rat(-23))$

poly_discriminant(x^3-x-1,x);
-23;

/* If x is a root, it is an algebraic integer, because the equation is monic, and so is
x^2, then since 23 is prime, {1,x,x^2} is a basis of the algebraic integers in Q[x] */

/* Works for a factorized polynomial */

block([s,v],s:splitfield((x^2-3)*(x^2-2),x),v:listofvars(s)[1],subst(a,v,s));
[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)]$

/* One can see that as the successive adjunction of sqrt(2) and sqrt(3),
that is  Q[sqrt(2),sqrt(3)]   */

primelmt(a^2-2,b^2-3,c);
[c^4-10*c^2+1,b+a]$

/* Irreducible quartic polynomials */

algfac(x^4-2,a^4-2);
(x-a)*(x+a)*(x^2+a^2)$

/* This is an example from S. Lang, Algebra. If a=2^(1/4), it generates
a subfield (1,a,a^2,a^3) of dimension 4, which doesn't contain all roots.
One needs to add %i to get all of them. Thus the Galois group has 8 elements
and has subgroups of order 4 and 2 */

primelmt(a^4-2,b^2+1,c);
[c^8+4*c^6+2*c^4+28*c^2+1,b+a]$

algfac(x^4-2,c^8+4*c^6+2*c^4+28*c^2+1);
((24*x-c^6-5*c^4-13*c^2-29)*(24*x+c^6+5*c^4+13*c^2+29)
                                  *(24*x-5*c^7-19*c^5-5*c^3-151*c)
                                  *(24*x+5*c^7+19*c^5+5*c^3+151*c))/331776$

/* Another example with Galois group of order 8 */

block([s,v],s:splitfield(x^4+10*x^2-96*x-71,x),v:listofvars(s)[1],subst(a,v,s[1]));
a^8+148*a^6-576*a^5+9814*a^4-42624*a^3+502260*a^2+1109952*a+18860337$

/* With a small change the Galois group is of order 24. The computation takes much
longer */

block([s,v],s:splitfield(x^4+10*x^2-96*x-72,x),v:listofvars(s)[1],subst(a,v,s[1]));
a^24+700*a^22-8640*a^21+202860*a^20-5040000*a^19+85120320*a^18
           -1084446720*a^17+28192407600*a^16-307448294400*a^15
           +3879455590080*a^14-79002155473920*a^13+862062450860352*a^12
           -6341012384716800*a^11+173144130732249600*a^10
           -861539021970186240*a^9+6648562403288386560*a^8
           -183678612853284864000*a^7+785273136304331653120*a^6
           +746838863325592289280*a^5+176781240435133218734080*a^4
           +116524085058329916211200*a^3+6983186268545823770542080*a^2
           -29426422063945596083896320*a+430620712916420842049765376$

/* For an algebraic curve, such as an hyperbola. Here x^3+2*x*y^2+y^3 is
some algebraic function on the curve. */

algtrace(x^3+2*x*y^2+y^3,y^2-x^2+1,y);
''(rat(6*x^3-4*x))$

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));
6*x^3-4*x$

/* Taking the trace  with respect to y one projects the curve on the x axis and one gets
an algebraic function of x */

/* A complicated example with a solvable quintic from D.S.Dummit, Mathematics of computation
57,195(1991)387 . This is clearly at the limit of what maxima can do in reasonable time. Dummit
indeed shows the the Galois group is the Frobenius group of order 20. */

block([s,v],s:splitfield(x^5+15*x+12,x),v:listofvars(s)[1],subst(a,v,s));
[a^20+60*a^16-936*a^15+91350*a^12+605880*a^11+1417536*a^10+36463500*a^8
            +122488200*a^7+84862080*a^6-91103616*a^5+1032800625*a^4
            +1697841000*a^3+7485825600*a^2+4760933760*a+10933303536,
        -((131880620547249*a^19+59683129753141*a^18-304524778993866*a^17
                              +793203234964096*a^16+4124149330829589*a^15
                              -117172981627806003*a^14-71306340933544902*a^13
                              +298650865231229952*a^12
                              +11251695090720035763*a^11
                              +88411847804251841367*a^10
                              +196440402174914992122*a^9
                              -38341429061015510352*a^8
                              +4577341927136007203127*a^7
                              +17087648569913092051863*a^6
                              +4481766149602673412342*a^5
                              -15341521613198393243376*a^4
                              +60345466908156421500816*a^3
                              +71102697168836172551184*a^2
                              +1112228012805629359857696*a
                              +1452913156334429802008064)
         /948905619130801728000000),
        (34941883569106*a^19-19586610011161*a^18-28628104018984*a^17
                            +62261757956409*a^16+2067346063311366*a^15
                            -33646881858167757*a^14+15872125201726692*a^13
                            +31165731682124373*a^12+3118730624434774902*a^11
                            +19424644835781405573*a^10
                            +34928604068980953168*a^9-38639423702912510133*a^8
                            +1269187385301553504698*a^7
                            +3667076703510023078577*a^6
                            -455062882588288189452*a^5
                            -6073679019448320564969*a^4
                            +39452666543681343198264*a^3
                            +47232807378617176983216*a^2
                            +172758700340547215707584*a
                            +55253832604158366243216)
         /79875691357815936000000,
        -((89591685911602852*a^19+2456426401544275*a^18-79829287283577388*a^17
                                -111266747126642685*a^16
                                +6693211742640744216*a^15
                                -85247275218262553049*a^14
                                -7299844963479831120*a^13
                                +74488279542565111191*a^12
                                +8274877365995836629420*a^11
                                +53413178567062212453753*a^10
                                +121592356188979166775396*a^9
                                -50703322221226476748215*a^8
                                +3190417858093889386657296*a^7
                                +11697039806926436578278045*a^6
                                +5565042124477506830126808*a^5
                                -21907925941416463634269203*a^4
                                +111830991479469725159092680*a^3
                                +226384145027764567538132592*a^2
                                +505623402016123027927501440*a
                                +199640907190542149950414896)
         /278840229388945773235200000),
        (87530181817718523*a^19+1215087725977030782*a^18
                               -953928919736667912*a^17
                               -1313560049466028133*a^16
                               +9462158957065791483*a^15
                               -30528725605743381606*a^14
                               -1150352116504017502104*a^13
                               +734949752502164464839*a^12
                               +9542188140971754165201*a^11
                               +159271468071468573427074*a^10
                               +789030615124104571528344*a^9
                               +1002612772932828989646321*a^8
                               +1441683814063122556892289*a^7
                               +53856342854315366109409926*a^6
                               +116471037468993801002554824*a^5
                               -71683288419330233672409027*a^4
                               -112235865378225651840900168*a^3
                               +1132885879666976209353768288*a^2
                               +1236791680392483380748206592*a
                               +5963360303581465557565858608)
         /1917026577049002190992000000,
        -((87530181817718523*a^19+1215087725977030782*a^18
                                -953928919736667912*a^17
                                -1313560049466028133*a^16
                                +9462158957065791483*a^15
                                -30528725605743381606*a^14
                                -1150352116504017502104*a^13
                                +734949752502164464839*a^12
                                +9542188140971754165201*a^11
                                +159271468071468573427074*a^10
                                +789030615124104571528344*a^9
                                +1002612772932828989646321*a^8
                                +1441683814063122556892289*a^7
                                +53856342854315366109409926*a^6
                                +116471037468993801002554824*a^5
                                -71683288419330233672409027*a^4
                                -112235865378225651840900168*a^3
                                +1132885879666976209353768288*a^2
                                -680234896656518810243793408*a
                                +5963360303581465557565858608)
         /3834053154098004381984000000)]$

/* Strangely this slightly different example of Dummit has a Galois group of order 10
and is obtained much faster. */

block([s,v],s:splitfield(x^5-5*x+12,x),v:listofvars(s)[1],subst(a,v,s));
[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
            +196036,
        -((4402021*a^9+8967410*a^8-71413351*a^7-408236968*a^6+199818827*a^5
                     +3092804186*a^4+4100015915*a^3-6578347876*a^2
                     +173297643052*a-409949875488)
         /34533412800),
        (129271*a^9-1030711*a^8-6736419*a^7+9580539*a^6+215434401*a^5
                   +342066891*a^4-1374973581*a^3-3638935299*a^2+647047544*a
                   -49872596204)
         /34533412800,
        (10382*a^9+27879*a^8-140650*a^7-1021019*a^6-626422*a^5+5112817*a^4
                  +14638214*a^3+12817495*a^2+373402956*a-783084692)
         /178929600,
        (1134512*a^9+2308737*a^8-18765741*a^7-110380420*a^6+52641936*a^5
                    +881981807*a^4+1324907097*a^3-2706594556*a^2+41658559300*a
                    -104470966864)
         /8633353200,
        -((1134512*a^9+2308737*a^8-18765741*a^7-110380420*a^6+52641936*a^5
                     +881981807*a^4+1324907097*a^3-2706594556*a^2
                     +33025206100*a-104470966864)
                   /17266706400)]$

/* And this one is even more degenerate */

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));

[a^5-110*a^3-55*a^2+2310*a+979,(a^3-3*a^2-72*a+99)/25,
 (a^4-4*a^3-94*a^2+196*a+1276)/125,-((a^4+a^3-84*a^2-89*a+671)/125),
 (a^2-2*a-44)/5,a];

/* Since splitfield extensively uses algnorm and factorization in extensions, one can
assume that they work correctly */