File: hawes2_gens_quot.py

package info (click to toggle)
jas 2.5.4408-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 10,976 kB
  • ctags: 15,216
  • sloc: java: 111,905; python: 11,461; ruby: 9,204; makefile: 401; xml: 240; sh: 194
file content (74 lines) | stat: -rw-r--r-- 1,403 bytes parent folder | download | duplicates (3)
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
#
# jython examples for jas.
# $Id: hawes2_gens_quot.py 3438 2010-12-24 19:06:24Z kredel $
#
## \begin{PossoExample}
## \Name{Hawes2}
## \Parameters{a;b;c}
## \Variables{x;y[2];z[2]}
## \begin{Equations}
## x+2y_1z_1+3ay_1^2+5y_1^4+2cy_1 \&
## x+2y_2z_2+3ay_2^2+5y_2^4+2cy_2 \&
## 2 z_2+6ay_2+20 y_2^3+2c \&
## 3 z_1^2+y_1^2+b \&
## 3z_2^2+y_2^2+b \&
## \end{Equations}
## \end{PossoExample}


import sys;

from jas import Ring, PolyRing, RF, ZZ
from jas import Ideal
from jas import startLog
from jas import terminate

#startLog();

# Hawes & Gibson example 2
# rational function coefficients

#r = Ring( "RatFunc(a, c, b) (y2, y1, z1, z2, x) G" );
r = PolyRing( RF(PolyRing(ZZ(),"a, c, b",PolyRing.lex)), "y2, y1, z1, z2, x", PolyRing.grad );
print "Ring: " + str(r);
print;

[one,a,c,b,y2,y1,z1,z2,x] = r.gens();

p1 = x + 2 * y1 * z1 + 3 * a * y1**2 + 5 * y1**4 + 2 * c * y1;
p2 = x + 2 * y2 * z2 + 3 * a * y2**2 + 5 * y2**4 + 2 * c * y2;
p3 = 2 * z2 + 6 * a * y2 + 20 * y2**3 + 2 * c; 
p4 = 3 * z1**2 + y1**2 + b;
p5 = 3 * z2**2 + y2**2 + b; 

p6 = ( ( p5 / a ) / b ) / c;
print "p6 = ", p6;

F = [p1,p2,p3,p4,p6];

g = r.ideal( list=F );
print "Ideal: " + str(g);
print;

rg = g.GB();
rg = g.GB();
rg = g.GB();
rg = g.GB();
print "GB:", rg;
print;

bg = rg.isGB();
print "isGB:", bg;
print;

p7 = 1 / b;
print "p7 = ", p7;

p8 = p7 * b;
print "p8 = ", p8;


startLog();
terminate();
#sys.exit();