File: solvablepolynomial.py

package info (click to toggle)
jas 2.7.200-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,732 kB
  • sloc: java: 164,370; python: 14,882; ruby: 14,509; xml: 583; makefile: 545; sh: 349
file content (125 lines) | stat: -rw-r--r-- 2,525 bytes parent folder | download
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
#
# jython examples for jas.
# $Id$
#

from java.lang import System

from jas import SolvableRing, SolvPolyRing, PolyRing, SolvableIdeal
from jas import QQ, Quat

# WA_32 solvable polynomial example

p = PolyRing(QQ(),"a,b,e1,e2,e3");
#is automatic: [one,a,b,e1,e2,e3] = p.gens();

relations = [e3, e1, e1*e3 - e1,
             e3, e2, e2*e3 - e2];

print "relations: =", [ str(f) for f in relations ];
print;

#rp = SolvPolyRing(QQ(), "a,b,e1,e2,e3", rel=relations);
rp = SolvPolyRing(QQ(), "a,b,e1,e2,e3", PolyRing.lex, relations);
print "SolvPolyRing: " + str(rp);
print;

print "gens =", [ str(f) for f in rp.gens() ];
#[one,a,b,e1,e2,e3] = rp.gens();
#[one,I,J,K,a,b,e1,e2,e3] = rp.gens();

f1 = e1 * e3**3 + e2**10 - a;
f2 = e1**3 * e2**2 + e3;
f3 = e3**3 + e3**2 - b;

f4 = ( e3**2 * e2**3 + e1 )**3;

#print "f1 = ", f1;
#print "f2 = ", f2;
#print "f3 = ", f3;
#print "f4 = ", f4;

F = [ f1, f2, f3 ];
print "F =", [ str(f) for f in F ];
print

I = rp.ideal( list=F );
print "SolvableIdeal: " + str(I);
print;

rgl = I.leftGB();
print "seq left GB:" + str(rgl);
print "isLeftGB: " + str(rgl.isLeftGB());
print;

rgt = I.twosidedGB();
print "seq twosided GB:" + str(rgt);
print "isTwosidedGB: " + str(rgt.isTwosidedGB());
print;

rgr = I.rightGB();
print "seq right GB:" + str(rgr);
print "isRightGB: " + str(rgr.isRightGB());
print;


#exit(0);


rs = """
# solvable polynomials, Weyl algebra A_3,2:
Rat(a,b,e1,e2,e3) L
#Quat(a,b,e1,e2,e3) G|3|
RelationTable
(
 ( e3 ), ( e1 ), ( e1 e3 - e1 ),
 ( e3 ), ( e2 ), ( e2 e3 - e2 )
)
""";

r = SolvableRing( rs );
print "SolvableRing: " + str(r);
print;

print "gens =", [ str(f) for f in r.gens() ];
#[one,a,b,e1,e2,e3] = r.gens();
#[one,I,J,K,a,b,e1,e2,e3] = r.gens();

fs1 = e1 * e3**3 + e2**10 - a;
fs2 = e1**3 * e2**2 + e3;
fs3 = e3**3 + e3**2 - b;

fs4 = ( e3**2 * e2**3 + e1 )**3;

#print "fs1 = ", fs1;
#print "fs2 = ", fs2;
#print "fs3 = ", fs3;
print "fs4 = ", fs4;

Fs = [ fs1, fs2, fs3 ];
print "Fs =", [ str(f) for f in Fs ];
print

Is = r.ideal( list=Fs );
print "SolvableIdeal: " + str(Is);
print;

rgsl = I.leftGB();
print "seq left GB:" + str(rgsl);
print "isLeftGB: " + str(rgsl.isLeftGB());
print;

rgst = I.twosidedGB();
print "seq twosided GB:" + str(rgst);
print "isTwosidedGB: " + str(rgst.isTwosidedGB());
print;

rgsr = I.rightGB();
print "seq right GB:" + str(rgsr);
print "isRightGB: " + str(rgsr.isRightGB());
print;


print "rgl == rgsl: " + str(rgl == rgsl);
print "rgr == rgsr: " + str(rgr == rgsr);
print "rgt == rgst: " + str(rgt == rgst);