示例#1
0
import sys;

from jas import PolyRing, Ideal, QQ, ZZ, EF, Mat

# matrix and polynomial examples:
# conditions for (non) commuting matrices

r = EF(QQ()).polynomial("a,b,c,d,e,f,g,h").build();
print "r = " + str(r);

#one, a, b, c, d, e, f, g, h = r.gens();
print "h = " + str(h);
print

x = Mat(r,2,2,[[a,b],[c,d]])
y = Mat(r,2,2,[[e,f],[g,h]])
print "x = " + str(x) + ", y = " + str(y) #+ ", x y = " + str(x*y)
print

com = x*y - y*x
print "commutator = " + str(com)
print

ff = r.ideal("", [ com[0][0], com[0][1], com[1][0], com[1][1] ] )
print "ff = " + str(ff)
print

gg = ff.GB();
print "gg = " + str(gg)
print
示例#2
0
print "e3 = " + str(e3);
print "e4 = " + str(e4);
print "e5 = " + str(e5);
print "e6 = " + str(e6);
print "e7 = " + str(e7);
v1 = e1 + e3;
print "v1 = " + str(v1);
#v2 = v1 + 5 * e7;
#print "v2 = " + str(v2);
v3 = v1 - e1 - e3;
print "v3 = " + str(v3);
print;


print "------- Mat(QQ(),3,3) ---------";
r = Mat(QQ(),3,3);
print "r = " + str(r);
print "r.factory() = " + str(r.factory());
#print [ str(g) for g in r.gens() ];
[e11,e12,e13,e21,e22,e23,e31,e32,e33] = r.gens();
print "e11 = " + str(e11);
print "e12 = " + str(e12);
print "e13 = " + str(e13);
print "e21 = " + str(e21);
print "e22 = " + str(e22);
print "e23 = " + str(e23);
print "e31 = " + str(e31);
print "e32 = " + str(e32);
print "e33 = " + str(e33);
m1 = e11 + e31;
print "m1 = " + str(m1);
示例#3
0
#

import sys;

from jas import Ring, PolyRing, Mat, Vec, QQ, GF, DD, RingElem
from jas import terminate

#from edu.jas.arith import BigRational

# example for linear algebra
#
#

p = 11
N = 6;
r = Mat(QQ(),N,N);
#r = Mat(GF(p),N,N);
#print "r = " + str(r);
print "r.factory() = " + str(r.factory());
#print;
#print r.gens().map{ |g| str(g) + ", " };
#print;

v = Vec(QQ(),N);
#v = Vec(GF(p),N);
#print "v = " + str(v);
print "v.factory() = " + str(v.factory());
print;
#print v.gens().map{ |g| str(g) + ", " };
#print;