Пример #1
0
 def testRingZM(self):
     r = PolyRing( GF(17), "(t,x)", Order.INVLEX );
     self.assertEqual(str(r),'PolyRing(GFI(17),"t,x",Order.INVLEX)');
     [one,x,t] = r.gens();
     self.assertTrue(one.isONE());
     self.assertTrue(len(x)==1);
     self.assertTrue(len(t)==1);
     #
     f = 11 * x**4 - 13 * t * x**2 - 11 * x**2 + 2 * t**2 + 11 * t;
     f = f**2 + f + 3;
     #print "f = " + str(f);
     self.assertEqual(str(f),'( 4 * x**4 + 16 * t**2 * x**3 + 10 * x**3 + 9 * t**4 * x**2 + 10 * t**2 * x**2 + 4 * x**2 + 3 * t**6 * x + t**4 * x + 11 * x + 2 * t**8 + 13 * t**6 + 13 * t**4 + 6 * t**2 + 3 )');
Пример #2
0
 def testRingQQ(self):
     r = PolyRing( QQ(), "(t,x)", Order.INVLEX );
     self.assertEqual(str(r),'PolyRing(QQ(),"t,x",Order.INVLEX)');
     [one,x,t] = r.gens();
     self.assertTrue(one.isONE());
     self.assertTrue(len(x)==1);
     self.assertTrue(len(t)==1);
     #
     f = 11 * x**4 - 13 * t * x**2 - 11 * x**2 + 2 * t**2 + 11 * t;
     f = f**2 + f + 3;
     #print "f = " + str(f);
     self.assertEqual(str(f),'( 4 * x**4 - 52 * t**2 * x**3 + 44 * x**3 + 213 * t**4 * x**2 - 330 * t**2 * x**2 + 123 * x**2 - 286 * t**6 * x + 528 * t**4 * x - 255 * t**2 * x + 11 * x + 121 * t**8 - 242 * t**6 + 132 * t**4 - 11 * t**2 + 3 )');
Пример #3
0
    def __constructJasObject(self):
        #from types import StringType
        from jas import PolyRing, ZZ
        # set up the polynomial ring (Jas syntax)
        if 'hasParameters' in self.__dict__ and self.hasParameters != '':
            #K = 'K.<%s> = PolynomialRing(ZZ)' % self.hasParameters
            #R = K + '; R.<%s> = PolynomialRing(K)' % self.hasVariables
            K = PolyRing(ZZ(), str(self.hasParameters))
            R = PolyRing(K, str(self.hasVariables))
            gens = '%s,%s' % (self.hasParameters, self.hasVariables)
        else:
            #R = 'R.<%s> = PolynomialRing(ZZ)' % (self.hasVariables)
            R = PolyRing(ZZ(), str(self.hasVariables))
            gens = str(self.hasVariables)
        # translate Jas syntax to pure Python and execute
        #exec(preparse(R))
        Rg = "(one," + gens + ") = R.gens();"
        #print str(R)
        exec(str(Rg))  # safe here since R did evaluate
        #print "R = " + str(R)
        self.jasRing = R

        # avoid XSS: check if polynomials are clean
        from edu.jas.poly import GenPolynomialTokenizer
        vs = GenPolynomialTokenizer.expressionVariables(str(gens))
        vs = sorted(vs)
        #print "vs = " + str(vs)
        vsb = set()
        [
            vsb.update(GenPolynomialTokenizer.expressionVariables(str(s)))
            for s in self.basis
        ]
        vsb = sorted(list(vsb))
        #print "vsb = " + str(vsb)
        if vs != vsb:
            raise ValueError("invalid variables: expected " + str(vs) +
                             ", got " + str(vsb))
        # construct polynomials in the constructed ring from
        # the polynomial expressions
        self.jasBasis = []
        for ps in self.basis:
            #print "ps = " + str(ps)
            ps = str(ps)
            ps = ps.replace('^', '**')
            #exec(preparse("symbdata_ideal = %s" % ps))
            #exec("symbdata_poly = %s" % ps)
            pol = eval(ps)
            self.jasBasis.append(pol)
Пример #4
0
#
# jython examples for jas.
# $Id$
#

import sys

from jas import QQ, PolyRing
from jas import startLog
from jas import terminate

# ideal elimination example

#r = Ring( "Rat(x,y,z) G" );
r = PolyRing(QQ(), "(x,y,z)", PolyRing.grad)
print "Ring: " + str(r)
print

ps1 = """
(
 ( x^2 - 2 ),
 ( y^2 - 3 ),
 ( z^3 - x * y )
)
"""

ff = [x**2 - 2, y**2 - 3, z**3 - x * y]

#F1 = r.ideal( ps1 );
F1 = r.ideal("", ff)
print "Ideal: " + str(F1)
Пример #5
0
#
# jython examples for jas.
# $Id$
#

import sys;

from jas import QQ, PolyRing
from jas import startLog
from jas import terminate


# ideal elimination example

#r = Ring( "Rat(x,y,z) G" );
r = PolyRing( QQ(), "(x,y,z)", PolyRing.grad );
print "Ring: " + str(r);
print;

ps1 = """
(
 ( x^2 - 2 ),
 ( y^2 - 3 ),
 ( z^3 - x * y )
)
""";

ff = [ x**2 - 2,
       y**2 - 3,
       z**3 - x * y
     ]
Пример #6
0
#
# jython examples for jas.
# $Id$
#

import sys

from jas import Ring, PolyRing, Ideal, PSIdeal, QQ, ZM
from jas import startLog, terminate

# example from CLO(UAG), 4.4

#R = PolyRing( GF(32003), "x,y,z" );
R = PolyRing(QQ(), "x,y,z")
print "Ring: " + str(R)
print

#automatic: [one,x,y,z] = R.gens();

f1 = x**5 - x * y**6 - z**7
f2 = x * y + y**3 + z**3
f3 = x**2 + y**2 - z**2

L = [f1, f2, f3]
#print "L = ", str(L);

F = R.ideal(list=L)
print "Ideal: " + str(F)
print

PR = R.powerseriesRing()
Пример #7
0
#
# jython examples for jas.
# $Id$
#

from java.lang import System

from jas import PolyRing, ZM, GF
from jas import terminate, startLog

# system biology examples: GB in Z_2
# see: Informatik Spektrum, 2009, February,
# Laubenbacher, Sturmfels: Computer Algebra in der Systembiologie

r = PolyRing(GF(2),"M, B, A, L, P",PolyRing.lex);
print "PolyRing: " + str(r);
print;

#automatic: [one,M,B,A,L,P] = r.gens();

f1 = M - A;
f2 = B - M;
f3 = A - A - L * B - A * L * B;
f4 = P - M;
f5 = L - P - L - L * B - L * P - L * B * P;
## t1 = M - 1;
## t2 = B - 1;
## t3 = A - 1;
## t4 = L - 1;
## t5 = P - 1;
#
Пример #8
0

import sys;

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

from edu.jas.arith import ModIntegerRing

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

ps = """
(
 ( x + 2 y1 z1 + { 3 a } y1^2 + 5 y1^4 + { 2 c } y1 ),
 ( x + 2 y2 z2 + { 3 a } y2^2 + 5 y2^4 + { 2 c } y2 ), 
 ( 2 z2 + { 6 a } y2 + 20 y2^3 + { 2 c } ), 
 ( 3 z1^2 + y1^2 + { b } ), 
 ( 3 z2^2 + y2^2 + { b } ) 
) 
""";

f = r.paramideal( ps );
print "Ideal: " + str(f);
Пример #9
0
import sys

from java.lang import System
from java.lang import Integer

from jas import Ring
from jas import PolyRing
from jas import Ideal
from jas import ZM, QQ, AN, RF
from jas import terminate
from jas import startLog

# polynomial examples: factorization over Z_p(x)(sqrt3(x))[y]

Q = PolyRing(ZM(5),"x",PolyRing.lex);
print "Q     = " + str(Q);
[e,a] = Q.gens();
#print "e     = " + str(e);
print "a     = " + str(a);

Qr = RF(Q);
print "Qr    = " + str(Qr.factory());
[er,ar] = Qr.gens();
#print "er    = " + str(er);
#print "ar    = " + str(ar);
print;

Qwx = PolyRing(Qr,"wx",PolyRing.lex);
print "Qwx   = " + str(Qwx);
[ewx,ax,wx] = Qwx.gens();
Пример #10
0
#
# jython examples for jas.
# $Id$
#

import sys

from java.lang import System

from jas import Ring, PolyRing, QQ, DD
from jas import terminate, startLog

# polynomial examples: real roots over Q

r = PolyRing(QQ(), "I,x,y,z", PolyRing.lex)
print "Ring: " + str(r)
print

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

f1 = z - x - y * I
f2 = I**2 + 1

#f3 = z**3 - 2;
f3 = z**3 - 2 * I

print "f1 = ", f1
print "f2 = ", f2
print "f3 = ", f3
print
Пример #11
0
# $Id$
#

from java.lang import System
from java.lang import Integer

from jas import PolyRing, QQ
from jas import terminate
from jas import startLog

# polynomial examples: factorization

cr = PolyRing(QQ(),"x",PolyRing.lex );
print "Ring cr: " + str(cr);

r = PolyRing(cr,"y,z",PolyRing.lex );
print "Ring: " + str(r);
print;

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

#f = z * ( y + 1 )**2 * ( x**2 + x + 1 )**3;
#f = z * ( y + 1 ) * ( x**2 + x + 1 );
#f = ( y + 1 ) * ( x**2 + x + 1 );
#f = ( y + z**2 ) * ( x**2 + x + 1 );

#f = x**4 * y + x**3  + z + x   + z**2 + y * z**2;
## f = x**3 + ( ( y + 2 ) * z + 2 * y + 1 ) * x**2 \
##     + ( ( y + 2 ) * z**2 + ( y**2 + 2 * y + 1 ) * z + 2 * y**2 + y ) * x \
##     + ( y + 1 ) * z**3 + ( y + 1 ) * z**2 + ( y**3 + y**2 ) * z + y**3 + y**2;
Пример #12
0
F = r.ideal(list=[r1, r2, r3, r4, r5, r6, r7, r8, f1, f2, f3])
#F = r.ideal( list=[r1,r2,f1,f2,f3] );
print "F = " + str(F)
print

startLog()

G = F.GB()
print "G = " + str(G)
print "isGB(G) = " + str(G.isGB())
print

# now as solvable polynomials

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();
## 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 startLog, terminate

# 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, p5]
Пример #14
0
#
# jruby examples for jas.
# $Id$
#

from java.lang import System

from jas import SolvableRing, SolvPolyRing, PolyRing, RingElem
from jas import QQ, startLog, SRC, SRF

# Ore extension solvable polynomial example, Gomez-Torrecillas, 2003

pcz = PolyRing(QQ(),"x,y,z");
#is automatic: [one,x,y,z] = pcz.gens();

zrelations = [z, y,  y * z + x
             ];

print "zrelations: = " + str([ str(f) for f in zrelations ]);
print;

pz = SolvPolyRing(QQ(), "x,y,z", PolyRing.lex, zrelations);
print "SolvPolyRing: " + str(pz);
print;

#startLog();

fl = [ z**2 + y, y**2 + x];
ff = pz.ideal("",fl);
print "ideal ff: " + str(ff);
print;
Пример #15
0
#
# jython examples for jas.
# $Id$
#

from java.lang import System

from jas import Ring, PolyRing, QQ, DD
from jas import terminate, startLog

# polynomial examples: ideal prime decomposition

#r = Ring( "Rat(x) L" );
#r = Ring( "Q(x) L" );
r = PolyRing(QQ(), "x,y,z", PolyRing.lex)

print "Ring: " + str(r)
print

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

f1 = (x**2 - 5)**2
f2 = y**3 - x
f3 = z**2 - y * x

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

F = r.ideal(list=[f2, f3])
Пример #16
0
print "KOI   = " + str(KOI);
o1 = 2 * oneOR + 3 * IOR + 4 * JOR + 5 * KOR + 6 * oneOI + 7 * IOI + 8 * JOI + 9 * KOI;
print "o1 = " + str(o1);
o2 = (1/o1)**2;
print "o2 = " + str(o2);
o3 = o2 * o1 * o1;
print "o3 = " + str(o3);
o4 = (-69,20164)*oneOR + (-3,20164)*IOR + (-1,5041)*JOR + (-5,20164)*KOR  + (-3,10082)*oneOI + (-7,20164)*IOI + (-2,5041)*JOI + (-9,20164)*KOI;
print "o4 = " + str(o4);
o5 = o2 - o4;
print "o5  = " + str(o5);
print;


print "------- PolyRing(ZZ(),\"x,y,z\") ---------";
r = PolyRing(ZZ(),"x,y,z",PolyRing.grad);
print "r = " + str(r);
[one,x,y,z] = r.gens();
print "one = " + str(one);
print "x   = " + str(x);
print "y   = " + str(y);
print "z   = " + str(z);
p1 = 2 + 3 * x + 4 * y + 5 * z + ( x + y + z )**2;
print "p1  = " + str(p1);
p2  = z**2 + 2 * y * z + 2 * x * z + y**2 + 2 * x * y + x**2 + 5 * z + 4 * y + 3 * x + 2;
print "p2  = " + str(p2);
p3 = p1 - p2;
print "p3  = " + str(p3);
print "p3.factory() = " + str(p3.factory());
print;
Пример #17
0
# jython examples for jas.
# $Id$
#

import sys;

from jas import PolyRing, QQ, RF
from jas import Ideal
from jas import startLog
from jas import terminate


# Montes JSC 2002, 33, 183-208, example 11.1
# integral function coefficients

r = PolyRing( PolyRing(QQ(),"c, b, a",PolyRing.lex), "z,y,x", PolyRing.lex );
print "Ring: " + str(r);
print;

[one,c,b,a,z,y,x] = r.gens();
print "gens: ", [ str(f) for f in r.gens() ];
print;

f1 =     x + c * y + b * z + a;
f2 = c * x +     y + a * z + b;
f3 = b * x + a * y +     z + c;

F = [f1,f2,f3];

print "F: ", [ str(f) for f in F ];
print;
Пример #18
0
#
# jython examples for jas.
# $Id$
#

from java.lang import System

from jas import SolvableRing, SolvPolyRing, PolyRing
from jas import QQ, startLog, SRC, SRF

# Ore extension solvable polynomial example, Gomez-Torrecillas, 2003

pcz = PolyRing(QQ(), "x,y,z")
#is automatic: [one,x,y,z] = pcz.gens();

zrelations = [z, y, y * z + x]

print "zrelations: = " + str([str(f) for f in zrelations])
print

pz = SolvPolyRing(QQ(), "x,y,z", PolyRing.lex, zrelations)
print "SolvPolyRing: " + str(pz)
print

pzq = SRF(pz)
print "SolvableQuotientRing: " + str(pzq.ring.toScript())
# + ", assoz: " + str(pzq.ring.isAssociative());
#print "gens =" + str([ str(f) for f in pzq.ring.generators() ]);
print

pct = PolyRing(pzq, "t")
Пример #19
0
## 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 startLog, terminate

# Hawes & Gibson example 2
# rational function coefficients

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

ps = """
(
 ( x + 2 y1 z1 + { 3 a } y1^2 + 5 y1^4 + { 2 c } y1 ),
 ( x + 2 y2 z2 + { 3 a } y2^2 + 5 y2^4 + { 2 c } y2 ), 
 ( 2 z2 + { 6 a } y2 + 20 y2^3 + { 2 c } ), 
 ( 3 z1^2 + y1^2 + { b } ), 
 ( 3 z2^2 + y2^2 + { b } ) 
) 
"""

f = r.ideal(ps)
print "Ideal: " + str(f)
Пример #20
0
#
# jython examples for jas.
# $Id$
#

import sys

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

# Raksanyi & Walter example
# rational function coefficients

#r = Ring( "RatFunc(a1, a2, a3, a4) (x1, x2, x3, x4) G" );
r = PolyRing(RF(PolyRing(ZZ(), "a1, a2, a3, a4", PolyRing.lex)),
             "x1, x2, x3, x4", PolyRing.grad)
print "Ring: " + str(r)
print

ps = """
(
 ( x4 - { a4 - a2 } ),
 ( x1 + x2 + x3 + x4 - { a1 + a3 + a4 } ),
 ( x1 x3 + x1 x4 + x2 x3 + x3 x4 - { a1 a4 + a1 a3 + a3 a4 } ),
 ( x1 x3 x4 - { a1 a3 a4 } )
) 
"""

f = r.ideal(ps)
print "Ideal: " + str(f)
print
#
# jython examples for jas.
# $Id$
#

import sys

from java.lang import System

from jas import Ring, PolyRing
from jas import QQ, AN
from jas import terminate, startLog

# polynomial examples: absolute factorization over Q(i)

Qr = PolyRing(QQ(), "i", PolyRing.lex)
print "Qr    = " + str(Qr)
[e, a] = Qr.gens()
print "e     = " + str(e)
print "a     = " + str(a)
print

imag = a ** 2 + 1
print "imag  = " + str(imag)
Qi = AN(imag, field=True)
print "Qi    = " + str(Qi.factory())
[one, i] = Qi.gens()
print "one   = " + str(one)
print "i     = " + str(i)
print
Пример #22
0
# $Id$
#

import sys;

from jas import PolyRing, ZZ, QQ, RealN, CC, ZM, RF, terminate
from edu.jas.root import RealArithUtil
from edu.jas.arith import ArithUtil

# example for rational and real algebraic numbers
#
#

# continued fractions:

r = PolyRing(QQ(),"alpha",PolyRing.lex);
print "r = " + str(r);
e,a = r.gens();
print "e     = " + str(e);
print "a     = " + str(a);
sqrt2 = a**2 - 2;
print "sqrt2 = " + str(sqrt2);
Qs2r = RealN(sqrt2,[1,[3,2]],a-1);
#Qs2r = RealN(sqrt2,[-2,-1],a+1);
print "Qs2r  = " + str(Qs2r.factory()) + " :: " + str(Qs2r.elem);
one,alpha = Qs2r.gens();
print "one   = " + str(one);
print "alpha = " + str(alpha);


cf = Qs2r.contFrac(20);
Пример #23
0
#
# jython examples for jas.
# $Id$
#

import sys

from java.lang import System

from jas import PolyRing, Ideal
from jas import QQ, AN, RF
from jas import terminate, startLog

# polynomial examples: prime/primary decomposition in Q[w2,x,wx,y,z]

Q = PolyRing(QQ(), "w2,x,wx,y,z", PolyRing.lex)
print "Q     = " + str(Q)

[e, w2, x, wx, y, z] = Q.gens()
print "e     = " + str(e)
print "w2    = " + str(w2)
print "x     = " + str(x)
print "wx    = " + str(wx)
print "y     = " + str(y)
print "z     = " + str(z)
print

w1 = w2 ** 2 - 2
w2 = wx ** 2 - x
f1 = (y ** 2 - x) * (y ** 2 - 2)
# f1 = ( y**2 - x )**3 * ( y**2 - 2 )**2;
Пример #24
0
#
# jython examples for jas.
# $Id$
#

import sys

from jas import PolyRing, QQ, RF
from jas import startLog
from jas import terminate

# Montes JSC 2002, 33, 183-208, example 11.2
# integral function coefficients

r = PolyRing(PolyRing(QQ(), "f, e, d, c, b, a", PolyRing.lex), "y,x",
             PolyRing.lex)
#r = PolyRing( PolyRing(QQ(),"f, e, d, c, b, a",PolyRing.grad), "y,x", PolyRing.lex );
#r = PolyRing( PolyRing(QQ(),"f, e, d, c, b, a",PolyRing.lex), "y,x", PolyRing.grad );
#r = PolyRing( PolyRing(QQ(),"e, d, c, b, f, a",PolyRing.lex), "y,x", PolyRing.grad );
print "Ring: " + str(r)
print

#[one,e,d,c,b,f,a,y,x] = r.gens();
#automatic: [one,f,e,d,c,b,a,y,x] = r.gens();
print "gens: ", [str(f) for f in r.gens()]
print

f1 = x**2 + b * y**2 + 2 * c * x * y + 2 * d * x + 2 * e * y + f
f2 = x + c * y + d
f3 = b * y + c * x + e
# jython examples for jas.
# $Id$
#

import sys;
from java.lang import System
from java.lang import Integer

from jas import Ring, PolyRing
from jas import terminate
from jas import startLog
from jas import QQ, DD

# polynomial examples: complex roots over Q for zero dimensional ideal `cyclic5'

r = PolyRing(QQ(),"a,b,c,d,e",PolyRing.lex);
print "Ring: " + str(r);
print;

#is automatic: [one,a,b,c,d,e] = r.gens();

f1 = a + b + c + d + e;
f2 = a*b + b*c + c*d + d*e + e*a;
f3 = a*b*c + b*c*d + c*d*e + d*e*a + e*a*b;
f4 = a*b*c*d + b*c*d*e + c*d*e*a + d*e*a*b + e*a*b*c;
f5 = a*b*c*d*e - 1;

print "f1 = ", f1;
print "f2 = ", f2;
print "f3 = ", f3;
print "f4 = ", f4;
Пример #26
0
# jython examples for jas.
# $Id$
#

from java.lang import System
from java.lang import Integer

from jas import PolyRing, QQ, ZM, ZZ
from jas import terminate
from jas import startLog

# polynomial examples: squarefree: characteristic 0

#r = PolyRing(PolyRing(QQ(),"u,v",PolyRing.lex),"x, y",PolyRing.lex)
#r = PolyRing(PolyRing(ZZ(),"u,v",PolyRing.lex),"x, y",PolyRing.lex)
r = PolyRing(PolyRing(ZM(7),"u,v",PolyRing.lex),"x, y",PolyRing.lex)

print "Ring: " + str(r);
print;

[one,u,v,x,y] = r.gens();

a = r.random(k=1,l=3);
b = r.random(k=1,l=3);
c = r.random(k=1,l=3);

if a.isZERO():
    a = x;
if b.isZERO():
    b = y;
if c.isZERO():
Пример #27
0
# jython examples for jas.
# $Id$
#

import sys;

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


# example: Algebraic Statistics
# Drton, Sturmfels, Sullivant, example 2.1.3


r = PolyRing(RF(PolyRing(QQ(),"u0,u1,u2,u12",PolyRing.lex)),"l1,l2",PolyRing.grad);
print "Ring: " + str(r);
print;

print one,u0,u1,u2,u12,l1,l2;

f1 = (u1+u12)*(l1+l2+2)*(l1+1)*(l1+l2+1)\
     + (u12)*l1*(l1+1)*(l1+l2+1)\
     - (u2+u12)*l1*(l1+l2+2)*(l1+l2+1)\
     - (u0+u1+u2+u12)*l1*(l1+l2+2)*(l1+1)  ;

f2 = (u2+u12)*(l1+l2+2)*(l2+1)*(l1+l2+1)\
     + (u12)*l2*(l2+1)*(l1+l2+1)\
     - (u1+u12)*l2*(l1+l2+2)*(l1+l2+1)\
     - (u0+u1+u2+u12)*l2*(l1+l2+2)*(l2+1)  ;
Пример #28
0
#
# jython examples for jas.
# $Id$
#

from java.lang import System

from jas import Ring, PolyRing
from jas import ZZ, ZM, QQ, AN, RF, CR
from jas import terminate, startLog

# polynomial examples: factorization

#r = Ring( "Z(x) L" );
r = PolyRing( ZZ(), "(x)", PolyRing.lex );
print "Ring: " + str(r);
print;
[one,x] = r.gens();

#f = x**15 - 1;
#f = x * ( x + 1 )**2 * ( x**2 + x + 1 )**3;
#f = x**6 - 3 * x**5 + x**4 - 3 * x**3 - x**2 - 3 * x+ 1;
#f = x**(3*11*11) + 3 * x**(2*11*11) - x**(11*11);
#f = x**(3*11*11*11) + 3 * x**(2*11*11*11) - x**(11*11*11);
#f = (x**2+1)*(x-3)*(x-5)**3;
#f = x**4 + 1;
#f = x**12 + x**9 + x**6 + x**3 + 1;
#f = x**24 - 1;
#f = x**20 - 1;
#f = x**22 - 1;
#f = x**8 - 40 * x**6 + 352 * x**4 - 960 * x**2 + 576;
Пример #29
0
import sys;

from jas import QQ, Ring, PolyRing, Ideal
from jas import startLog, terminate


# trinks 6/7 example

#r = Ring( "Mod 19 (B,S,T,Z,P,W) L" );
#r = Ring( "Mod 1152921504606846883 (B,S,T,Z,P,W) L" ); # 2^60-93
#r = Ring( "Quat(B,S,T,Z,P,W) L" );
#r = Ring( "Z(B,S,T,Z,P,W) L" );
#r = Ring( "C(B,S,T,Z,P,W) L" );
#r = Ring( "Rat(B,S,T,Z,P,W) L" );
r = PolyRing( QQ(),"B,S,T,Z,P,W", PolyRing.lex);
print "Ring: " + str(r);
print;


ps = """
( 
 ( 45 P + 35 S - 165 B - 36 ), 
 ( 35 P + 40 Z + 25 T - 27 S ), 
 ( 15 W + 25 S P + 30 Z - 18 T - 165 B**2 ), 
 ( - 9 W + 15 T P + 20 S Z ), 
 ( P W + 2 T Z - 11 B**3 ), 
 ( 99 W - 11 B S + 3 B**2 ),
 ( 10000 B**2 + 6600 B + 2673 )
) 
""";
#
# jython examples for jas.
# $Id$
#

import sys

from java.lang import System

from jas import QQ, AN, RF, Ring, PolyRing
from jas import terminate, startLog

# polynomial examples: factorization over Q(sqrt(2))(x)(sqrt(x))[y]

Q = PolyRing(QQ(),"w2",PolyRing.lex);
print "Q     = " + str(Q);
[e,a] = Q.gens();
print "e     = " + str(e);
print "a     = " + str(a);

root = a**2 - 2;
print "root  = " + str(root);
Q2 = AN(root,field=True);
print "Q2    = " + str(Q2.factory());
[one,w2] = Q2.gens();
#print "one   = " + str(one);
#print "w2    = " + str(w2);
print;

Qp = PolyRing(Q2,"x",PolyRing.lex);
print "Qp    = " + str(Qp);
Пример #31
0
#
# jython examples for jas.
# $Id$
#

from java.lang import System

from jas import PolyRing, Ideal
from jas import terminate, startLog
from jas import ZM

# system biology examples: GB in Z_2
# see: Informatik Spektrum, 2009, February,
# Laubenbacher, Sturmfels: Computer Algebra in der Systembiologie

r = PolyRing(ZM(2),"M, B, A, L, P",PolyRing.lex);

print "PolyRing: " + str(r);
print;

[one,M,B,A,L,P] = r.gens();

f1 = M - A;
f2 = B - M;
f3 = A - A - L * B - A * L * B;
f4 = P - M;
f5 = L - P - L - L * B - L * P - L * B * P;
## t1 = M - 1;
## t2 = B - 1;
## t3 = A - 1;
## t4 = L - 1;
# jython examples for jas.
# $Id$
#

import sys

from java.lang import System

from jas import Ring, PolyRing, QQ, ZM, RF, GF
from jas import terminate, startLog, noThreads

# polynomial examples: ideal radical decomposition, inseparable cases, dim > 0

#noThreads(); # must be called very early

cr = PolyRing(GF(5), "c", PolyRing.lex)
print "coefficient Ring: " + str(cr)
rf = RF(cr)
print "coefficient quotient Ring: " + str(rf.ring)

r = PolyRing(rf, "x,y,z", PolyRing.lex)
print "Ring: " + str(r)
print

#automatic: [one,c,x,y,z] = r.gens();
print one, c, x, y, z

#sys.exit();

#f1 = (x**2 - 5)**2;
#f1 = (y**10 - x**5)**3;
Пример #33
0
import sys;

from java.lang import System

from jas import Ring, PolyRing, QQ, ZM, RF, GF
from jas import terminate, startLog

# polynomial examples: ideal prime decomposition in char p > 0, inseparable cases

cr = PolyRing(GF(5),"c",PolyRing.lex);
print "coefficient Ring: " + str(cr);
rf = RF(cr);
print "coefficient quotient Ring: " + str(rf.ring);

r = PolyRing(rf,"x,y,z",PolyRing.lex);

print "Ring: " + str(r);
print;

#automatic: [one,c,x,y,z] = r.gens();
print one,c,x,y,z;

#sys.exit();

f1 = (x**2 - 2); #**2;
f2 = (y**2 - c)**5;
f3 = (z**2 - 2 * c); #**5;

print "f1 = ", f1;
print "f2 = ", f2;
Пример #34
0
# $Id$
#

import sys;

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


# example: Algebraic Statistics
# Drton, Sturmfels, Sullivant, example 2.1.3


#r = PolyRing(QQ(),"l1,l2",PolyRing.grad);
r = PolyRing(QQ(),"l1,l2",PolyRing.lex);
print "Ring: " + str(r);
print;

print one,l1,l2;

u0 = 3; u1 = 5; u2 = 7; u12 = 11;

f1 = (u1+u12)*(l1+l2+2)*(l1+1)*(l1+l2+1)\
     + (u12)*l1*(l1+1)*(l1+l2+1)\
     - (u2+u12)*l1*(l1+l2+2)*(l1+l2+1)\
     - (u0+u1+u2+u12)*l1*(l1+l2+2)*(l1+1)  ;

f2 = (u2+u12)*(l1+l2+2)*(l2+1)*(l1+l2+1)\
     + (u12)*l2*(l2+1)*(l1+l2+1)\
     - (u1+u12)*l2*(l1+l2+2)*(l1+l2+1)\
Пример #35
0
print "c^5:", c**5 + c.one()
print

c = CC((2, ), rn)
print "c:   ", c
print "1/c: " + str(1 / c)
print

zm = ZM(19, 11)
print "zm:   " + str(zm)
print "zm^2: " + str(zm * zm)
print "1/zm: " + str(1 / zm)
#print "zm.ring: " + str(zm.ring.toScript());
print

r = PolyRing(QQ(), "x,y", PolyRing.lex)
print "Ring: " + str(r)
print

# sage like: with generators for the polynomial ring
#is automatic: [one,x,y] = r.gens();
zero = r.zero()

try:
    f = RF(r)
except:
    f = None
print "f: " + str(f)

d = x**2 + 5 * x - 6
f = RF(r, d)
Пример #36
0
#
# jython examples for jas.
# $Id$
#

import sys

from jas import Ring, PolyRing, QQ, ZZ, RingElem
from jas import startLog, terminate

# GB examples

#r = Ring( "Z(t,x,y,z) L" );
#r = Ring( "Mod 11(t,x,y,z) L" );
#r = Ring( "Rat(t,x,y) L" );
r = PolyRing(QQ(), "t,x,y", PolyRing.lex)
#r = PolyRing( ZZ(), "t,x,y", PolyRing.lex );
print "Ring: " + str(r)
print

ps = """
(
 ( t - x - 2 y ),
 ( x^4 + 4 ),
 ( y^4 + 4 )
) 
"""

# ( y^4 + 4 x y^3 - 2 y^3 - 6 x y^2 + 1 y^2 + 6 x y + 2 y - 2 x + 3 ),
# ( x^2 + 1 ),
# ( y^3 - 1 )
Пример #37
0
#
# jython examples for jas.
# $Id$
#

from java.lang import System

from jas import PolyRing, QQ, ZM
from jas import terminate, startLog

import operator

# polynomial examples: squarefree: characteristic 0

r = PolyRing(QQ(), "x, y, z", PolyRing.lex)
print "Ring: " + str(r)
print

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

a = r.random(k=2, l=3)
b = r.random(k=2, l=3)
c = r.random(k=1, l=3)

if a.isZERO():
    a = x
if b.isZERO():
    b = y
if c.isZERO():
    c = z
## 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, QQ
from jas import startLog, terminate

# Hawes & Gibson example 2
# rational function coefficients

#r = Ring( "IntFunc(a, c, b) (y2, y1, z1, z2, x) G" );
r = PolyRing( PolyRing(QQ(),"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; 

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

g = r.ideal( list=F );
print "Ideal: " + str(g);
Пример #39
0
#
# jython examples for jas.
# $Id$
#

from java.lang import System
from java.lang import Integer

from jas import PolyRing, ZM, QQ
from jas import terminate
from jas import startLog

# polynomial examples: factorization over Z_p

r = PolyRing(ZM(1152921504606846883,field=True),"(x)",PolyRing.lex);
#r = PolyRing(ZM(19),"x",PolyRing.lex );
#r = PolyRing(ZM(23),"x",PolyRing.lex );

print "Ring: " + str(r);
print;

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


#f = x**4 - 1;
#f = x**3 + 1;
f = x**3 - x - 1;


print "f = ", f;
print;
Пример #40
0
import sys

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

# trinks 6/7 example

# QQ = rational numbers, ZZ = integers, CC = complex rational numbers, GF = finite field
#QQ = QQ(); ZZ = ZZ(); CC = CC();
#r = PolyRing( GF(19),"B,S,T,Z,P,W", PolyRing.lex);
#r = PolyRing( GF(1152921504606846883),"B,S,T,Z,P,W", PolyRing.lex); # 2^60-93
#r = PolyRing( GF(2**60-93),"B,S,T,Z,P,W", PolyRing.lex);
#r = PolyRing( CC(),"B,S,T,Z,P,W", PolyRing.lex);
#r = PolyRing( ZZ(),"B,S,T,Z,P,W", PolyRing.lex); # not for parallel
r = PolyRing(QQ(), "B,S,T,Z,P,W", PolyRing.lex)
print "Ring: " + str(r)
print

# sage like: with generators for the polynomial ring
#[one,I,B,S,T,Z,P,W] = r.gens(); # is automaticaly included
#[one,B,S,T,Z,P,W] = r.gens(); # is automaticaly included

f1 = 45 * P + 35 * S - 165 * B - 36
f2 = 35 * P + 40 * Z + 25 * T - 27 * S
f3 = 15 * W + 25 * S * P + 30 * Z - 18 * T - 165 * B**2
f4 = -9 * W + 15 * T * P + 20 * S * Z
f5 = P * W + 2 * T * Z - 11 * B**3
f6 = 99 * W - 11 * B * S + 3 * B**2
f7 = 10000 * B**2 + 6600 * B + 2673
Пример #41
0
#
# jython examples for jas.
# $Id$
#

import sys;

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

# characteristic set example Circle of Apollonius, from CLO IVA

r = PolyRing( QQ(), "u1,u2,x1,x2,x3,x4,x5,x6,x7,x8", PolyRing.lex );
print "Ring: " + str(r);
print;

#[one,u1,u2,x1,x2,x3,x4,x5,x6,x7,x8] = r.gens();

h1 = 2 * x1 - u1;
h2 = 2 * x2 - u2;
h3 = 2 * x3 - u1;
h4 = 2 * x4 - u2;
h5 = u2 * x5 + u1 * x6 - u1 * u2;
h6 = u1 * x5 - u2 * x6;
h7 = x1**2 - x2**2 - 2 * x1 * x7 + 2 * x2 * x8;
h8 = x1**2 - 2 * x1 * x7 - x3**2 + 2 * x3 * x7 - x4**2 + 2 * x4 * x8;

g = ( ( x5 - x7 )**2 + ( x6 - x8 )**2 - ( x1 - x7 )**2 - x8**2 );

L = [h1,h2,h3,h4,h5,h6,h7,h8];
Пример #42
0
# jython examples for jas.
# $Id$
#

from java.lang import System

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

# polynomial examples: gcd

#r = Ring( "Mod 1152921504606846883 (x,y,z) L" );
#r = Ring( "Rat(x,y,z) L" );
#r = Ring( "C(x,y,z) L" );
#r = Ring( "Z(x,y,z) L" );
r = PolyRing( QQ(), "x,y,z", PolyRing.lex );
print "Ring: " + str(r);
print;

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

a = r.random();
b = r.random();
c = abs(r.random());
#c = 1; 
#a = 0;


print "a = ", a;
print "b = ", b;
print "c = ", c;
Пример #43
0
# $Id$
#

import sys;

from jas import Ring, PolyRing, ParamIdeal, QQ
from jas import startLog
from jas import terminate


# 2 univariate polynomials of degree 2 example for comprehensive GB
# integral/rational function coefficients

#rp = PolyRing(QQ(), "a,b" );
rp = PolyRing(QQ(), "a" );
r = PolyRing( rp, "x,y,z", PolyRing.lex );
print "Ring: " + str(r);
print;

#one,a,b,x,y = r.gens();
one,a,x,y,z = r.gens();

#f1 = x * ( x**2 + a * y + b );
#f2 = x * ( y**2 + b * x + a );

f1 = ( x**2 + a * y**2 - x );
f2 = ( a * x**2 + y**2 - y );
f3 = ( x - y ) * z - 1;

print "f1 = " + str(f1);
print "f2 = " + str(f2);
#
# 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: Chines remainder theorem for polynomials

#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(3, 3)
c = abs(r.random(3, 3))

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

ff = [[a, b, c], [a + 1, b, c], [a, b + 1, c], [a, b, c + 1]]
Пример #45
0
import sys;

from java.lang import System
from java.lang import Integer

from jas import Ring
from jas import PolyRing
from jas import Ideal
from jas import terminate
from jas import startLog

from jas import QQ, DD, CR

# polynomial examples: complex factorization via algebraic factorization

r = PolyRing( CR(QQ()), "x", PolyRing.lex );

print "Ring: " + str(r);
print;

[one,I,x] = r.gens();


f1 = x**3 - 2;

f2 = ( x - I ) * ( x + I );

f3 = ( x**3 - 2 * I );

#f = f1**2 * f2 * f3;
f = f1 * f2 * f3;
#
# jython examples for jas.
# $Id$
#

import sys

from java.lang import System

from jas import PolyRing, QQ, DD, AN, BigDecimal
from jas import terminate, startLog

# roots simplification

r = PolyRing(QQ(), "I", PolyRing.lex)
print "Ring: " + str(r)
#print;

#automatic: [one,I] = r.gens();
print "one   = ", one
print "I     = ", I

eps = QQ(1, 10)**(BigDecimal.DEFAULT_PRECISION)
#-3
#eps = QQ(1,10) ** 7;
#eps = nil;
print "eps   = " + str(eps)

ip = (I**2 + 1)
# I
iq = AN(ip, 0, True)
Пример #47
0
#
# jython examples for jas.
# $Id$
#

import sys;

from jas import PolyRing, QQ, RF
from jas import startLog
from jas import terminate


# Montes JSC 2002, 33, 183-208, example 11.1
# integral function coefficients

r = PolyRing( PolyRing(QQ(),"c, b, a",PolyRing.lex), "z,y,x", PolyRing.lex );
print "Ring: " + str(r);
print;

#automatic: [one,c,b,a,z,y,x] = r.gens();
print "gens: ", [ str(f) for f in r.gens() ];
print;

f1 =     x + c * y + b * z + a;
f2 = c * x +     y + a * z + b;
f3 = b * x + a * y +     z + c;

F = [f1,f2,f3];

print "F: ", [ str(f) for f in F ];
print;
Пример #48
0
#
# jython examples for jas.
# $Id$
#

from java.lang import System

from jas import GF, PolyRing
from jas import terminate, startLog

# polynomial examples: factorization over Z_p

#r = Ring( "Mod 1152921504606846883 (x) L" );
#r = Ring( "Mod 19 (x) L" );
r = PolyRing( GF(19), "x", PolyRing.lex );
print "Ring: " + str(r);
print;

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

#f = x**15 - 1;
#f = x * ( x + 1 )**2 * ( x**2 + x + 1 )**3;
#f = x**6 - 3 * x**5 + x**4 - 3 * x**3 - x**2 - 3 * x+ 1;
#f = x**(3*11*11) + 3 * x**(2*11*11) - x**(11*11);
#f = x**(3*11*11*11) + 3 * x**(2*11*11*11) - x**(11*11*11);
#f = (x**2+1)*(x-3)*(x-5)**3;
#f = x**4 + 1;
#f = x**12 + x**9 + x**6 + x**3 + 1;
#f = x**24 - 1;
#f = x**20 - 1;
#f = x**22 - 1;
Пример #49
0
#
# jython examples for jas.
# $Id$
#

from java.lang import System

from jas import Ring, PolyRing, QQ, DD
from jas import terminate, startLog


# polynomial examples: real roots over Q for zero dimensional ideals

r = PolyRing(QQ(),"q,w,s,x",PolyRing.lex);
print "Ring: " + str(r);
print;

#automatic: [one,q,w,s,x] = r.gens();

# EF(QQ()).realExtend("q","q^3 - 3", "[1,2]").realExtend("w", "w^2 - q", "[1,2]").realExtend("s", "s^5 - 2", "[1,2]").polynomial("x").build();

f1 = q**3 - 3;
f2 = w**2 - q;
#f3 = s**5 - 2;
f3 = s**3 - 2;
f4 = x**2 - w * s;

print "f1 = ", f1;
print "f2 = ", f2;
print "f3 = ", f3;
print "f4 = ", f4;
Пример #50
0
from jas import PolyRing, ZZ, QQ, ZM
from jas import terminate, startLog

from basic_sigbased_gb import sigbased_gb
from basic_sigbased_gb import ggv, ggv_first_implementation
from basic_sigbased_gb import coeff_free_sigbased_gb
from basic_sigbased_gb import arris_algorithm, min_size_mons
from basic_sigbased_gb import f5, f5z

from staggered_linear_basis import staglinbasis


#r = PolyRing( QQ(), "(B,S,T,Z,P,W)", PolyRing.lex );
#r = PolyRing( ZZ(), "(B,S,T,Z,P,W)", PolyRing.lex );
r = PolyRing( ZM(32003), "(B,S,T,Z,P,W)", PolyRing.lex );
#r = PolyRing( ZM(19), "(B,S,T,Z,P,W)", PolyRing.lex );
print "Ring: " + str(r);
print;

[one,B,S,T,Z,P,W] = r.gens();

p1 = 45 * P + 35 * S - 165 * B - 36; 
p2 = 35 * P + 40 * Z + 25 * T - 27 * S;
p3 = 15 * W + 25 * S * P + 30 * Z - 18 * T - 165 * B**2; 
p4 = -9 * W + 15 * T * P + 20 * S * Z; 
p5 = P * W + 2 * T * Z - 11 * B**3;
p6 = 99 * W - 11 * B * S + 3 * B**2;
p7 = 10000 * B**2 + 6600 * B + 2673;

F = [p1,p2,p3,p4,p5,p6,p7];
Пример #51
0
import sys;

from jas import Ring, PolyRing, ParamIdeal, QQ, ZM, RR
from jas import startLog, terminate


# Boolean coefficient boolean GB
# see S. Inoue and A. Nagai "On the Implementation of Boolean Groebner Bases" in ASCM 2009
# Z_2 regular ring coefficent example


r = PolyRing(RR(ZM(2),3),"a,x,y",PolyRing.lex);
print "r  = " + str(r);
#print len(r.gens())

[s1,s2,s3,a,x,y] = r.gens();
one = r.one();

print "one = " + str(one);
print "s1  = " + str(s1);
print "s2  = " + str(s2);
print "s3  = " + str(s3);
print "a   = " + str(a);
print "x   = " + str(x);
print "y   = " + str(y);

#brel = [ a**2 - a, x**2 - x, y**2 - y ]; 
brel = [ x**2 - x, y**2 - y ]; 

#print "brel = " + str(brel[0]) + ", " + str(brel[1]) + ", " + str(brel[2]);
print "brel = " + str(brel[0]) + ", " + str(brel[1]);
# jython examples for jas.
# $Id$
#

import sys;

from jas import PolyRing, QQ
from jas import startLog, terminate


# Raksanyi & Walter example
# integral/rational function coefficients

#r = Ring( "RatFunc(a1, a2, a3, a4) (x1, x2, x3, x4) L" );
#r = Ring( "IntFunc(a1, a2, a3, a4) (x1, x2, x3, x4) L" );
r = PolyRing( PolyRing(QQ(),"a1, a2, a3, a4",PolyRing.lex), 
              "x1, x2, x3, x4", PolyRing.lex);
print "Ring: " + str(r);
print;

ps = """
(
 ( x4 - { a4 - a2 } ),
 ( x1 + x2 + x3 + x4 - { a1 + a3 + a4 } ),
 ( x1 x3 + x1 x4 + x2 x3 + x3 x4 - { a1 a4 + a1 a3 + a3 a4 } ),
 ( x1 x3 x4 - { a1 a3 a4 } )
) 
""";

f = r.paramideal( ps );
print "ParamIdeal: " + str(f);
print;