code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#
# jython examples for jas.
# $Id$
#
from java.lang import System, Integer
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_si... | Python |
#
# 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 5.1
# integral function coefficients
r = PolyRing( PolyRing(QQ(),"a, b",PolyRing.lex), "u,z,y,x", PolyRing.lex );
print... | Python |
#
# 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.3
# integral function coefficients
R = PolyRing( PolyRing(QQ(),"r, l, z",PolyRing.lex), "c1, c2, s1, s2", PolyRing.l... | Python |
#
# jython examples for jas.
# $Id$
#
from jas import SolvableModule
from jas import SolvableSubModule
# Quantum plane example
rsan = """
# not with twosidedGB, because of field
AN[ (i) (i^2 + 1) ] (Y,X,x,y) G
RelationTable
(
( y ), ( x ), ( {i} x y )
( X ), ( Y ), ( {i} Y X )
)
""";
rsc = """
# not supported for... | Python |
#
# jython for jas example 2 integer programming.
# $Id$
#
# CLO2, p372
# 3 A - 2 B + C = -1
# 4 A + B - C - D = 5
#
# max: A + 1000 B + C + 100 D
#
import sys;
from jas import Ring
from jas import Ideal
r = Ring( "Rat(w1,w2,w3,w4,t,z1,z2) W( (0,0,0,0,1,1,1),(1,1,2,2,0,0,0) )" );
print "Ring: " + str(r);
print... | Python |
#
# jython examples for jas.
# $Id$
#
from java.lang import System
from java.lang import Integer
from jas import Ring
from jas import Ideal
from jas import terminate
from jas import startLog
# polynomial examples: absolute factorization over Q
#r = Ring( "Rat(x) L" );
r = Ring( "Q(x,y) L" );
print "Ring: " + str(r... | Python |
#
# test functionality of the jython interface to jas.
# $Id$
#
# test ideal Groebner bases
execfile("examples/trinksTest.py")
# test module Groebner bases
execfile("examples/armbruster.py")
# test solvable Groebner bases
execfile("examples/wa_32.py")
# test solvable module Groebner bases
execfile("examples/sol... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate
# ideal elimination example
r = Ring( "Rat(x,y,z) G" );
print "Ring: " + str(r);
print;
ps1 = """
(
( x^2 - 2 ),
( y^2 - 3 ),
( z^3 - x * y )
)
""";
F1 = r.ideal( ps1... | Python |
#
# jruby examples for jas.
# $Id$
#
from java.lang import System
from java.lang import Integer
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... | Python |
#
# jython examples for jas.
# $Id$
#
from java.lang import System
from java.lang import Integer
from jas import Ring
from jas import Ideal
from jas import terminate
from jas import 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)... | Python |
#
# jython examples for jas.
# $Id$
#
from jas import SolvableRing
# U(so_3) example
rs = """
# solvable polynomials, U(so_3):
Rat(x,y,z) G
RelationTable
(
( y ), ( x ), ( x y - z ),
( z ), ( x ), ( x z + y ),
( z ), ( y ), ( y z - x )
)
""";
r = SolvableRing( rs );
print "SolvableRing: " + str(r);
print;
ps... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring, PolyRing, Ideal
from jas import QQ, ZZ
from jas import startLog
# 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... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate
# Nabashima, ISSAC 2007, example F1
# integral function coefficients
r = Ring( "IntFunc(a, b) (y,x) G" );
print "Ring: " + str(r);
print;
ps = """
(
( { a } x^4 y + x y^... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate
# output gb of rose
#r = Ring( "Mod 19 (U3,U4,A46) L" );
#r = Ring( "Mod 1152921504606846883 (U3,U4,A46) L" ); # 2^60-93
#r = Ring( "Quat(U3,U4,A46) L" );
#r = Ring( "Z(... | Python |
#
# jython examples for jas.
# $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" );
... | Python |
# Implementations of algorithms found in joint paper by Eder and Perry
# Copyright (C) 2010-2011, the University of Southern Mississippi
# released into the public domain
#
# Originally from http://www.math.usm.edu/perry/Research/basic_sigbased_gb.py
# slightly changed for JAS compatibility, changes are labled with JAS... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate
# Nabashima, ISSAC 2007, example Ex-4.8
# integral function coefficients
r = Ring( "IntFunc(a, b, c) (y,x) L" );
print "Ring: " + str(r);
print;
ps = """
(
( { a } x^2 +... | Python |
#
# jython examples for jas.
# $Id$
#
from java.lang import System
from java.lang import Integer
from jas import Ring
from jas import Ideal
from jas import terminate
from jas import startLog
# polynomial examples: factorization over Q
#r = Ring( "Rat(x) L" );
r = Ring( "Q(x) L" );
print "Ring: " + str(r);
print;
... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import ZZ
from jas import QQ
from jas import CC
from jas import RF
from jas import startLog
from jas import terminate
# example for rational and complex numbers
#
#
zn = ZZ(7);
print "zn:", zn;
print "zn^2:", zn*zn;
print;
x = 10000000... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate
# rational function coefficients
# IP (alpha,beta,gamma,epsilon,theta,eta)
# (c3,c2,c1) /G/
#r = Ring( "IntFunc(alpha,beta,gamma,epsilon,theta,eta)(c3,c2,c1) G" );
# ( { alp... | Python |
#
# jython examples for jas.
# $Id$
#
from jas import SolvableRing
# U(sl_2) example
rs = """
# solvable polynomials, U(sl_2):
Rat(e,f,h) G
RelationTable
(
( f ), ( e ), ( e f - h ),
( h ), ( e ), ( e h + 2 e ),
( h ), ( f ), ( f h - 2 f )
)
""";
r = SolvableRing( rs );
print "SolvableRing: " + str(r);
print;
... | Python |
#
# jython examples for jas.
# $Id$
#
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 roots over Q
#r = Ring( "Rat... | Python |
#
# jython examples for jas.
# $Id$
#
from java.lang import System
from java.lang import Integer
from jas import WordRing, WordPolyRing, WordIdeal
from jas import terminate, startLog
from jas import QQ, ZZ, GF, ZM
# non-commutative polynomial examples: simple test
r = WordPolyRing(QQ(),"x,y");
print "WordPolyRing: ... | Python |
#
# jython examples for jas.
# $Id$
#
from java.lang import System
from java.lang import Integer
from jas import SolvableRing, SolvPolyRing, PolyRing
from jas import QQ, startLog, SRC, SRF
# Ore extension solvable polynomial example, Gomez-Torrecillas, 2003
p = PolyRing(QQ(),"x,y,z,t");
#is automatic: [one,x,y,z,t]... | Python |
#
# jython examples for jas.
# $Id$
#
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 QQ, AN
from jas import terminate
from jas import startLog
# polynomial examples: factorization over Q(i)(sqrt2)
Q = PolyRin... | Python |
#
# 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 = PolyR... | Python |
#
# jython for jas example integer programming.
# $Id$
#
# CLO2, p370
# 4 A + 5 B + C = 37
# 2 A + 3 B + D = 20
#
# max: 11 A + 15 B
#
import sys;
from jas import Ring
from jas import Ideal
r = Ring( "Rat(w1,w2,w3,w4,z1,z2) W( (0,0,0,0,1,1),(1,1,2,2,0,0) )" );
print "Ring: " + str(r);
print;
ps = """
(
( z1^4 z2... | Python |
#
# jython examples for jas.
# $Id$
#
from jas import SolvableModule
from jas import SolvableSubModule
# Quantum plane example
rsan = """
AN[ (i) (i^2 + 1) ] (Y,X,x,y) G
RelationTable
(
( y ), ( x ), ( {i} x y )
( X ), ( Y ), ( {i} Y X )
)
""";
rsc = """
C(Y,X,x,y) G
RelationTable
(
( y ), ( x ), ( 0i1 x y )
( ... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
# example from rose (modified)
# optimal is
# Rat(A46, U3, U4)
#
r = Ring( "Rat(U3,U4,A46) G" );
print "Ring: " + str(r);
print;
ps = """
(
( U4^4 - 20/7 A46^2 ),
( A46^2 U3^4 + 7/10 A46 U3^... | Python |
#
# jython examples for jas.
# $Id$
#
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: ideal prime decomposition
#r = Ring( "Rat(x) L" );
#r = Ring( "Q(x) L" );
r = PolyRing(QQ(... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring, PolyRing, RF, ZZ
from jas import Ideal
# 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", Pol... | Python |
#
# jython examples for jas.
# $Id$
#
from jas import SolvableRing
# ? example
rs = """
Rat(a,b,e1,e2,e3) L
RelationTable
(
( e3 ), ( e1 ), ( e1 e3 - e1 ),
( e3 ), ( e2 ), ( e2 e3 - e2 )
)
""";
r = SolvableRing( rs );
print "SolvableRing: " + str(r);
print;
ps = """
(
( e1 e3^3 +... | Python |
#
# jython examples for jas.
# $Id$
#
from jas import Ring
from jas import Ideal
from edu.jas import application
rs = """
# polynomial ring:
Rat(x1,x2,x3,y1,y2) G|3|
""";
ps = """
(
( y1 + y2 - 1 ),
( x1 - y1^2 - y1 - y2 ),
( x2 - y1 - y2^2 ),
( x3 - y1 y2 )
)
""";
r = Ring( rs );
print "Ring: " + str(r);
i =... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import ParamIdeal
from jas import startLog
from jas import terminate
# 2 univariate polynomials of degree 2 example for comprehensive GB
# integral/rational function coefficients
#r = Ring( "RatFunc(u,v) (x,y) L" );
r = Ring( "IntFunc(... | Python |
#
# 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(sqrt(2))(x)(sqrt(x))[y,z]
Q = PolyRing(QQ(),"w2",PolyRing.lex);
print "Q = " + str... | Python |
#
# jython examples for jas.
# $Id$
#
## \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}
## \e... | Python |
#
# jython examples for jas.
# $Id$
#
#import sys;
#from jas import startLog, terminate
from edu.jas.arith import PrimeList
# example for prime numbers
#
pl = PrimeList(PrimeList.Range.small);
print "pl: " + str(pl);
print;
pp = "";
for i in range(0,pl.size()+10):
pp = pp + " " + str(pl.get(i))
print "pp: "... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate
# example from rose (modified)
#r = Ring( "Mod 19 (U3,U4,A46) L" );
#r = Ring( "Mod 1152921504606846883 (U3,U4,A46) L" ); # 2^60-93
#r = Ring( "Quat(U3,U4,A46) L" );
#r = R... | Python |
#
# jython examples for jas.
# $Id$
#
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))... | Python |
#
# jython examples for jas.
# $Id$
#
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 QQ, AN, RF, EF
from jas import terminate
from jas import startLog
# polynomial examples: factorization over Q(sqrt(2))(x)(sq... | Python |
#
# 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
r = PolyRing(QQ(),"I,x,y,z",PolyRing.lex);
print "Ring: ... | Python |
#
# jython examples for jas.
# $Id$
#
#import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
# mark, d-gb diplom example
r = Ring( "Z(x,y,z) L" );
print "Ring: " + str(r);
print;
ps = """
(
( z + x y**2 + 4 x**2 + 1 ),
( y**2 z + 2 x + 1 ),
( x**2 z + y**2 + x )
)
""";
f = r.ideal( ... | Python |
#
# jython examples for jas.
# $Id$
#
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 QQ, AN
from jas import terminate
from jas import startLog
# polynomial examples: factorization over Q(i)
Qr = PolyRing(QQ(... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate
# Nabashima, ISSAC 2007, example F6
# integral function coefficients
r = Ring( "IntFunc(a, b,c, d) (x) G" );
print "Ring: " + str(r);
print;
ps = """
(
( x^4 + { a } x^3... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate
#import rational;
# 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,... | Python |
#
# jython examples for jas.
# $Id$
#
from jas import Ring
from jas import Ideal
# trinks 7 example
r = Ring( "Rat(B,S,T,Z,P,W) L" );
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 ... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import ParamIdeal
from jas import startLog
from jas import 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) (x... | Python |
#
# jython examples for jas.
from jas import Module
from jas import SubModule
# Armbruster module example
r = Module( "Rat(u,v,l) L" );
print "Module: " + str(r);
print;
ps = """
(
( ( 1 ), ( 2 ), ( 0 ), ( l^2 ) ),
( ( 0 ), ( l + 3 v ), ( 0 ), ( u ) ),
( ( 1 ), ... | Python |
#
# jython examples for jas.
# $Id$
#
#import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
# mark, d-gb diplom example, due to kandri-rody 1984
#
# The MAS DIIPEGB implementation contains an error because the output e-GB
# is not correct. Also the cited result from k-r contains this error... | Python |
#
# jython examples for jas.
# $Id$
#
## \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}
## \e... | Python |
# implementation of the Staggered Linear Basis Algorithm of Gebauer and M\"oller
# "Buchberger's algorithm and Staggered Linear Bases"
# in Proceedings of SYMSAC 1986 (Waterloo/Ontario), pages 218--221
# ACM Press, 1986
# Originally from http://www.math.usm.edu/perry/Research/staggered_linear_basis.py
# small changes ... | Python |
#
# read output of jas runnings and prepare input for gnuplot
#
import re;
import os;
exam = "kat_6";
runs = "t16";
#bname = exam + "_" + runs;
bname = "k6seqpair-2"
fname = bname + ".out";
oname = bname + ".po";
f=open(fname,"r");
print f;
o=open(oname,"w");
print o;
res = {};
resold = {};
for line in f:
if ... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring, Ideal
from jas import startLog
# example from rose (modified)
#r = Ring( "Mod 19 (U3,U4,A46) L" );
#r = Ring( "Mod 1152921504606846883 (U3,U4,A46) L" ); # 2^60-93
#r = Ring( "Quat(U3,U4,A46) L" );
#r = Ring( "Z(U3,U4,A46) L" );
#r = Ring( "C(U3... | Python |
#
# jython examples for jas.
# $Id$
#
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(sqrt(2))(x)(... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate
# Nabashima, ISSAC 2007, example F4
# integral function coefficients
r = Ring( "IntFunc(a, b, c, d) (y, x) L" );
print "Ring: " + str(r);
print;
ps = """
(
( { a } x^3 y... | Python |
#
# 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, ZM, RF
# polynomial examples: ideal prime decomposition in char p > 0, inseparable cases
cr = PolyRing(... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import ParamIdeal
from jas import startLog
from jas import terminate
# Raksanyi & Walter example
# integral/rational function coefficients
#nono: r = Ring( "RatFunc(a1, a2, a3, a4) (x1, x2, x3, x4) L" );
r = Ring( "IntFunc(a1, a2, a3, ... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate
# hermite polynomial example
# H(0) = 1
# H(1) = 2 * x
# H(n) = 2 * x * H(n-1) - 2 * (n-1) * H(n-2)
r = Ring( "Z(x) L" );
print "Ring: " + str(r);
print;
# sage like: with... | Python |
#
# jython examples for jas.
# $Id$
#
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))... | Python |
#
# jython unit tests for jas.
# $Id$
#
from java.lang import System
from java.lang import Integer
from jas import PolyRing, ZZ, QQ, ZM, GF
from jas import terminate
from jas import startLog
import unittest
# some unit tests:
class RingElemTest (unittest.TestCase):
def testRingZZ(self):
r = PolyRing(... | Python |
#
# jython examples for jas.
# $Id$
#
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, ZM
# polynomial examples: ideal radical decomposition, dim > 0, char p separable
#r = Ring( "Rat(x) L" );
#r = Ring(... | Python |
'''jython interface to JAS.
'''
# $Id$
from java.lang import System
from java.io import StringReader
from java.util import ArrayList, List, Collections
from org.apache.log4j import BasicConfigurator;
from edu.jas.structure import RingElem, RingFactory, Power
from edu.jas.arith ... | Python |
#
# jython examples for jas.
# $Id$
#
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 QQ, AN, RF, EF
from jas import terminate
from jas import startLog
# polynomial examples:
Yr = EF(QQ()).extend("x,y").exten... | Python |
#
# jython examples for jas.
# $Id$
#
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 QQ, AN, RF
from jas import terminate
from jas import startLog
# polynomial examples: factorization over Q(sqrt(2))(x)(sqrt(x... | Python |
#
# read output of jas GB runs and prepare input for gnuplot
# $Id$
#
from sys import argv
from sys import exit
from time import strftime
import re;
import os
from os import system
hpat = re.compile(r'(m|d) = (\d+), ppn = (\d+), time = (\d+) milliseconds, (\d+) start-up');
dpat = re.compile(r'(m|d) = (\d+), time = (\... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import Ideal
from edu.jas.arith import ModIntegerRing
# example from rose (modified) modular computation
#r = Ring( "Mod 19 (U3,U4,A46) L" );
#r = Ring( "Mod 1152921504606846883 (U3,U4,A46) L" ); # 2^60-93
#r = Ring( "Quat(U3,U4,A46) L... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate
# chebyshev polynomial example
# T(0) = 1
# T(1) = x
# T(n) = 2 * x * T(n-1) - T(n-2)
r = Ring( "Z(x) L" );
print "Ring: " + str(r);
print;
# sage like: with generators fo... | Python |
#
# jython examples for jas.
# $Id$
#
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: zero dimensional ideals prime and primary decomposition
#r = Ring( "Rat(x) L" );
#r = Ring... | Python |
#
# jruby examples for jas.
# $Id$
#
#from java.lang import System
#from java.lang import Integer
from jas import SolvableRing, SolvPolyRing, PolyRing
from jas import QQ, startLog, SRC, SRF
# Weyl coefficient field example
r = PolyRing(QQ(),"p1,q1");
#is automatic: [one,p1,q1] = p.gens();
relations = [q1, p1, p1 ... | Python |
#
# 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: real roots over Q for zero dimensional ideal `cyclic5'
#r = Ring( "Q(x) L" );
... | Python |
#
# jython examples for jas.
# $Id$
#
import sys;
from jas import Ring
from jas import Ideal
from jas import startLog
from jas import terminate
# Nabashima, ISSAC 2007, example F8
# modified, take care
# integral function coefficients
#r = Ring( "IntFunc(d, b, a, c) (y,x,w,z) L" );
r = Ring( "IntFunc(d, b, a, c) ... | Python |
#<A name="xxx"></A>
import os.path
z=z1=z2=''
tree=[]
row=[]
tab=[]
tabs=[]
stabs=[]
f = open('bookmarks.html', 'r')
tSpace = 0
oldtSpace = 0
"""
class MyTab:
maxCol = 0
oldmaxCol = 0
tabName = ''
tab = []
def reset(self):
maxCol = 0
oldmaxCol = 0
tabName = ''
tab = []
x = MyTab()
... | Python |
##############################################################################
##
## minjson.py implements JSON reading and writing in python.
## Copyright (c) 2005 Jim Washington and Contributors.
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Le... | Python |
import unittest
## Run the tests on minjson by changing the import...
import json
#import minjson as json
## jsontest.py implements tests for the json.py JSON
## (http://json.org) reader and writer.
## Copyright (C) 2005 Patrick D. Logan
## Contact mailto:patrickdlogan@stardecisions.com
##
## This lib... | Python |
import string
import types
## json.py implements a JSON (http://json.org) reader and writer.
## Copyright (C) 2005 Patrick D. Logan
## Contact mailto:patrickdlogan@stardecisions.com
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser Genera... | Python |
from BitTorrent.bencode import bencode,bdecode
from BitTorrent.download import download,defaults
from BitTorrent.fmt import fmttime, fmtsize
from threading import Thread, Event, Lock
from sys import stdout
from os.path import abspath, join, exists, getsize
from time import sleep
filecheck=Lock()
class StatusUpdater... | Python |
#!/usr/bin/python
#torrent stuff
from BitTorrent.download import download,defaults
from BitTorrent.fmt import fmttime, fmtsize
from BitTorrent.bencode import bdecode,bencode
from threading import Thread, Event, Lock
from status import *
#utils
from os import listdir
from os.path import abspath, join, exists, getsize
fr... | Python |
#!/usr/bin/python
#torrent stuff
from BitTorrent.download import download,defaults
from BitTorrent.fmt import fmttime, fmtsize
from BitTorrent.bencode import bdecode,bencode
from threading import Thread, Event, Lock
from status import *
#utils
from os import listdir
from os.path import abspath, join, exists, getsize
fr... | Python |
#! /usr/bin/python
# Written by Bram Cohen
# see LICENSE.txt for license information
from sys import argv
from os.path import getsize, split, join, abspath, isdir
from os import listdir
from sha import sha
from copy import copy
from string import strip
from BitTorrent.bencode import bencode
from BitTorrent.btformats ... | Python |
# Written by Bram Cohen, Uoti Urpala, and John Hoffman
# see LICENSE.txt for license information
try:
True
except:
True = 1
False = 0
bool = lambda x: not not x
try:
sum([1])
negsum = lambda a: len(a)-sum(a)
except:
negsum = lambda a: reduce(lambda x,y: x+(not y), a, 0)
def _int_to_bo... | Python |
# Written by Bram Cohen
# see LICENSE.txt for license information
from string import join
class FakeHandle:
def __init__(self, name, fakeopen):
self.name = name
self.fakeopen = fakeopen
self.pos = 0
def flush(self):
pass
def close(self):
pass
def ... | Python |
# Written by Bram Cohen
# see LICENSE.txt for license information
from CurrentRateMeasure import Measure
from random import shuffle
from time import time
from bitfield import Bitfield
class SingleDownload:
def __init__(self, downloader, connection):
self.downloader = downloader
self.connection = c... | Python |
# Written by Bram Cohen
# see LICENSE.txt for license information
from random import randrange
class Choker:
def __init__(self, max_uploads, schedule, done = lambda: False, min_uploads = None):
self.max_uploads = max_uploads
if min_uploads is None:
min_uploads = max_uploads
sel... | Python |
# Written by Bram Cohen
# see LICENSE.txt for license information
from bisect import insort
import socket
from cStringIO import StringIO
from traceback import print_exc
from errno import EWOULDBLOCK, ENOBUFS
try:
from select import poll, error, POLLIN, POLLOUT, POLLERR, POLLHUP
timemult = 1000
except ImportErr... | Python |
# Written by Bram Cohen
# see LICENSE.txt for license information
from select import select, error
from time import sleep
from types import IntType
from bisect import bisect
POLLIN = 1
POLLOUT = 2
POLLERR = 8
POLLHUP = 16
class poll:
def __init__(self):
self.rlist = []
self.wlist = []
... | Python |
# Written by Bram Cohen
# see LICENSE.txt for license information
from cStringIO import StringIO
from binascii import b2a_hex
from socket import error as socketerror
protocol_name = 'BitTorrent protocol'
def toint(s):
return long(b2a_hex(s), 16)
def tobinary(i):
return (chr(i >> 24) + chr((i >> 16) & 0xFF) ... | Python |
# Written by Bram Cohen
# see LICENSE.txt for license information
from time import time
class DownloaderFeedback:
def __init__(self, choker, add_task, statusfunc, upfunc, downfunc, uptotal, downtotal,
remainingfunc, leftfunc, file_length, finflag, interval, spewflag):
self.choker = choker
... | Python |
# Written by Bram Cohen
# see LICENSE.txt for license information
from sha import sha
from bisect import bisect_right
class Storage:
def __init__(self, files, open, exists, getsize):
# can raise IOError and ValueError
self.ranges = []
total = 0l
so_far = 0l
for file, length... | Python |
"""
A much simpler testing framework than PyUnit
tests a module by running all functions in it whose name starts with 'test'
a test fails if it raises an exception, otherwise it passes
functions are try_all and try_single
"""
# Written by Bram Cohen
# see LICENSE.txt for license information
from traceback import p... | Python |
# Written by Bram Cohen
# see LICENSE.txt for license information
from time import time
class Measure:
def __init__(self, max_rate_period, fudge = 1):
self.max_rate_period = max_rate_period
self.ratesince = time() - fudge
self.last = self.ratesince
self.rate = 0.0
self.tota... | Python |
# Written by Petru Paler
# see LICENSE.txt for license information
def decode_int(x, f):
f += 1
newf = x.index('e', f)
try:
n = int(x[f:newf])
except (OverflowError, ValueError):
n = long(x[f:newf])
if x[f] == '-':
if x[f + 1] == '0':
raise ValueError
elif x[... | Python |
# Written by Bram Cohen
# see LICENSE.txt for license information
from bitfield import Bitfield
from binascii import b2a_hex
from CurrentRateMeasure import Measure
def toint(s):
return long(b2a_hex(s), 16)
def tobinary(i):
return (chr(i >> 24) + chr((i >> 16) & 0xFF) +
chr((i >> 8) & 0xFF) + chr(i &... | Python |
# Written by Bill Bumgarner and Bram Cohen
# see LICENSE.txt for license information
from types import *
from cStringIO import StringIO
def formatDefinitions(options, COLS):
s = StringIO()
indent = " " * 10
width = COLS - 11
if width < 15:
width = COLS - 2
indent = " "
for (longn... | Python |
#! /usr/bin/python
# Written by Bram Cohen
# see LICENSE.txt for license information
from os.path import join, split
from threading import Event
from traceback import print_exc
from sys import argv
from BitTorrent.btmakemetafile import calcsize, make_meta_file, ignore
def dummy(x):
pass
def completedir(files, u... | Python |
#! /usr/bin/python
# Written by Bram Cohen
# see LICENSE.txt for license information
from sys import argv
from os.path import getsize, split, join, abspath, isdir
from os import listdir
from sha import sha
from copy import copy
from string import strip
from BitTorrent.bencode import bencode
from BitTorrent.btformats ... | Python |
# Written by Bram Cohen
# see LICENSE.txt for license information
from cStringIO import StringIO
from sys import stdout
import time
from gzip import GzipFile
DEBUG = False
weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
months = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', ... | Python |
# Written by Bram Cohen
# see LICENSE.txt for license information
from random import randrange, shuffle, choice
class PiecePicker:
def __init__(self, numpieces, rarest_first_cutoff = 1):
self.rarest_first_cutoff = rarest_first_cutoff
self.numpieces = numpieces
self.interests = [range(numpi... | Python |
# This file created for Debian because btdownloadcurses can't
# find btdownloadheadless because we rename it.
def print_spew(spew):
s = StringIO()
s.write('\n\n\n')
for c in spew:
s.write('%20s ' % c['ip'])
if c['initiation'] == 'local':
s.write('l')
else:
... | Python |
#
# zurllib.py
#
# This is (hopefully) a drop-in for urllib which will request gzip/deflate
# compression and then decompress the output if a compressed response is
# received while maintaining the API.
#
# by Robert Stone 2/22/2003
#
from urllib import *
from urllib2 import *
from gzip import GzipFile
from StringIO ... | Python |
#! /usr/bin/python
# Written by Bram Cohen
# see LICENSE.txt for license information
from os.path import join, split
from threading import Event
from traceback import print_exc
from sys import argv
from BitTorrent.btmakemetafile import calcsize, make_meta_file, ignore
def dummy(x):
pass
def completedir(files, u... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.