"Fossies" - the Fresh Open Source Software Archive

Member "jas-2.6/examples/hawes2_int.py" (31 Aug 2014, 1527 Bytes) of package /linux/privat/jas-2.6.5988-src.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #
    2 # jython examples for jas.
    3 # $Id: hawes2_int.py 4891 2014-08-31 15:02:32Z kredel $
    4 #
    5 ## \begin{PossoExample}
    6 ## \Name{Hawes2}
    7 ## \Parameters{a;b;c}
    8 ## \Variables{x;y[2];z[2]}
    9 ## \begin{Equations}
   10 ## x+2y_1z_1+3ay_1^2+5y_1^4+2cy_1 \&
   11 ## x+2y_2z_2+3ay_2^2+5y_2^4+2cy_2 \&
   12 ## 2 z_2+6ay_2+20 y_2^3+2c \&
   13 ## 3 z_1^2+y_1^2+b \&
   14 ## 3z_2^2+y_2^2+b \&
   15 ## \end{Equations}
   16 ## \end{PossoExample}
   17 
   18 
   19 import sys;
   20 
   21 from jas import Ring, PolyRing, QQ, ZZ, RF
   22 from jas import startLog, terminate
   23 
   24 # Hawes & Gibson example 2
   25 # integral function coefficients, lexi
   26 
   27 #r = Ring( "IntFunc(a, c, b) (y2, y1, z1, z2, x) L" );
   28 #r = PolyRing( RF(PolyRing(QQ(),"a, c, b",PolyRing.lex)), "y2, y1, z1, z2, x", PolyRing.lex );
   29 r = PolyRing( RF(PolyRing(ZZ(),"a, c, b",PolyRing.lex)), "y2, y1, z1, z2, x", PolyRing.lex );
   30 print "Ring: " + str(r);
   31 print;
   32 
   33 ps = """
   34 (
   35  ( x + 2 y1 z1 + { 3 a } y1^2 + 5 y1^4 + { 2 c } y1 ),
   36  ( x + 2 y2 z2 + { 3 a } y2^2 + 5 y2^4 + { 2 c } y2 ), 
   37  ( 2 z2 + { 6 a } y2 + 20 y2^3 + { 2 c } ), 
   38  ( 3 z1^2 + y1^2 + { b } ), 
   39  ( 3 z2^2 + y2^2 + { b } ) 
   40 ) 
   41 """;
   42 
   43 p1 = x + 2 * y1 * z1 + 3 * a * y1**2 + 5 * y1**4 + 2 * c * y1;
   44 p2 = x + 2 * y2 * z2 + 3 * a * y2**2 + 5 * y2**4 + 2 * c * y2;
   45 p3 = 2 * z2 + 6 * a * y2 + 20 * y2**3 + 2 * c; 
   46 p4 = 3 * z1**2 + y1**2 + b;
   47 p5 = 3 * z2**2 + y2**2 + b; 
   48 
   49 F = [p1,p2,p3,p4,p5];
   50 
   51 f = r.ideal( list=F );
   52 #f = r.ideal( ps );
   53 print "Ideal: " + str(f);
   54 print;
   55 
   56 #startLog();
   57 
   58 rgl = f.GB();
   59 print "GB:", rgl;
   60 print;
   61 
   62 bg = rgl.isGB();
   63 print "isGB:", bg;
   64 print;
   65 
   66 startLog();
   67 terminate();
   68 #sys.exit();
   69