"Fossies" - the Fresh Open Source Software Archive

Member "jas-2.6/examples/radical-decomp_charp_ex816_algeb.rb" (7 Sep 2014, 1956 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) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #
    2 # jruby examples for jas.
    3 # $Id: radical-decomp_charp_ex816_algeb.rb 4901 2014-09-07 21:19:35Z kredel $
    4 #
    5 
    6 require "examples/jas"
    7 
    8 # polynomial examples: ideal radical decomposition, example 8.16 in GB book, base field with p-th root
    9 
   10 # noThreads(); # must be called very early
   11 
   12 prime = 5;
   13 cf = GF(prime);
   14 #cf = QQ();
   15 
   16 ca = PolyRing.new(cf,"t",PolyRing.lex);
   17 puts "ca = " + str(ca);
   18 ea,ta = ca.gens();
   19 puts "ea   = " + str(ea);
   20 puts "ta   = " + str(ta);
   21 puts;
   22 
   23 Qpt = RF(ca);
   24 #puts Qpt.gens();
   25 
   26 ea2,ta2 = Qpt.gens();
   27 puts "ea2  = " + str(ea2);
   28 puts "ta2  = " + str(ta2);
   29 puts;
   30 
   31 cr = PolyRing.new(Qpt,"wpt",PolyRing.lex);
   32 puts "polynomial quotient ring: " + str(cr);
   33 
   34 et2,t,wpt = cr.gens();
   35 puts "et2  = " + str(et2);
   36 puts "t    = " + str(t);
   37 puts "wpt  = " + str(wpt);
   38 puts;
   39 
   40 root = wpt**prime - ta2;
   41 af = AN(root,field=true);
   42 puts "coefficient algebraic quotient ring: " + str(af.ring.toScript());
   43 #puts af.gens();
   44 ##xx = AN(( wpt**5 + 4 * t ),True,PolyRing(RF(PolyRing(ZM(5),"t",PolyRing.lex)),"wpt",PolyRing.lex))
   45 ##puts "xx: " + str(xx.ring.toScript());
   46 
   47 one,t,wpt = af.gens();
   48 puts "one  = " + str(one);
   49 puts "t    = " + str(t);
   50 puts "wpt  = " + str(wpt);
   51 #puts one,t,wpt;
   52 puts;
   53 
   54 
   55 r = PolyRing.new(af,"x,y",PolyRing.lex);
   56 puts "polynomial ring: " + str(r);
   57 puts;
   58 
   59 #automatic: one,t,wpt,x,y = r.gens();
   60 #puts one,t,wpt,x,y;
   61 puts "one  = " + str(one);
   62 puts "t    = " + str(t);
   63 puts "wpt  = " + str(wpt);
   64 puts "x    = " + str(x);
   65 puts "y    = " + str(y);
   66 puts;
   67 
   68 
   69 f1 = x**prime - t;
   70 f2 = y**prime - t;
   71 
   72 f2 = f2**3;
   73 
   74 f3 = (y-x);
   75 f3 = f3**prime;
   76 
   77 puts "f1 = " + str(f1);
   78 puts "f2 = " + str(f2);
   79 #puts "f3 = " + str(f3);
   80 puts;
   81 
   82 F = r.ideal( "", list=[f1,f2] );
   83 
   84 puts "F = " + str(F);
   85 puts;
   86 
   87 startLog();
   88 
   89 t = System.currentTimeMillis();
   90 R = F.radicalDecomp();
   91 #R = F.primeDecomp();
   92 t = System.currentTimeMillis() - t;
   93 puts "R = " + str(R);
   94 puts;
   95 puts "decomp time = " + str(t) + " milliseconds";
   96 puts;
   97 
   98 puts "F = " + str(F);
   99 puts;
  100 
  101 #startLog();
  102 terminate();