File: subring.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 (49 lines) | stat: -rw-r--r-- 917 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
#
# jython examples for jas.
# $Id$
#

from java.lang import System

from jas import Ring, PolyRing, QQ, ZZ, GF, CC, ZM
from jas import terminate, startLog

# polynomial examples: subring

#r = PolyRing( ZM(1152921504606846883), "(x,y,z)", PolyRing.lex );
#r = PolyRing( CC(), "(x,y,z)", PolyRing.lex );
#r = PolyRing( ZZ(), "(x,y,z)", PolyRing.lex );
r = PolyRing( QQ(), "x,y,z", PolyRing.lex );
print "Ring: " + str(r);
print;

#[one,x,y,z] = r.gens();

a = r.random(3,4);
b = r.random(2,3);
c = abs( r.random(3,3) );

print "a = ", a;
print "b = ", b;
print "c = ", c;
print;



t = System.currentTimeMillis();
dd = r.subring("", [a,b,c]);
t = System.currentTimeMillis() - t;

print "sub ring = " + str([ str(x) for x in dd]);
print;

print "subring time = " + str(t) + " milliseconds" ;
print;

cc = a + b * c;
tt = r.subringmember(dd, cc);
print "sub ring member = " + str(tt);
print;

#startLog();
terminate();