"Fossies" - the Fresh Open Source Software Archive

Member "pari-2.13.1/src/test/in/ideal" (1 Nov 2020, 7354 Bytes) of package /linux/misc/pari-2.13.1.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "ideal": 2.13.0_vs_2.13.1.

    1 Qi = nfinit(x^2+1);
    2 idealintersect(Qi,0,1)
    3 Q = nfinit(y);
    4 idealaddtoone(Q,1,[;])
    5 idealaddtoone(Q,[;],1)
    6 idealaddtoone(Q,[1,[;]])
    7 zQ = idealstar(,4);
    8 zerror=z=znstar(6,1);
    9 z.clgp
   10 p=19;N=19^4;z=znstar(N,1);g=Mod(z.gen[1],N);
   11 for(i=1,1000,if (i%p && g^ideallog(,i,z)[1] != i, error(i)))
   12 z=znstar(3120,1);
   13 Mat(vector(#z,i,znlog(z.gen[i],z)))
   14 
   15 nfisideal(Qi,matdiagonal([6,12]))
   16 P = idealprimedec(Qi,2)[1];
   17 idealprincipalunits(Qi,P,10)
   18 idealprincipalunits(Qi,P,1)
   19 idealintersect(Qi, 1/2,1/2)
   20 ideallog(Q,1/2,idealstar(Q,3,1))
   21 idealdiv(Qi,7*x-1,3*x+1,1)
   22 
   23 K=nfinit(x^2-236*x+13384);\\ Q(sqrt(60)), in disguise
   24 idealhnf(K, qfbprimeform(60,2))
   25 
   26 Kerror=K=nfinit(x^3-2);
   27 u=nfalgtobasis(K,x);v=nfalgtobasis(K,x^2);
   28 idealhnf(K,Mat([u,v]))
   29 idealhnf(K,1/4,1/6)
   30 idealhnf(K,4,[6,0,0]~)
   31 idealhnf(K,2,1/6)
   32 idealhnf(K,1/3,u/2)
   33 idealhnf(K,u,v/2)
   34 P = idealprimedec(K,5);
   35 idealval(K,P[1],P[2])
   36 idealval(K,P[2],P[1])
   37 idealval(K,P[2],P[2])
   38 P[1][2] += 5;
   39 idealval(K,P[1],P[1])
   40 idealmul(K,P[1],P[1].gen[2])
   41 idealnorm(K,P[1])
   42 idealinv(K,Mod(x,K.pol))
   43 idealinv(K,Mod(x-1,K.pol))
   44 idealinv(K,2)
   45 idealinv(K,1)
   46 idealpow(K,idealhnf(K,x),-2)
   47 v=[1,1/2,x,Mod(x,K.pol),P[1],[;],Mat(1),vector(5),[1,2,3;4,5,6;7,8,9],[1,2,3;0,4,5;0,0,6],I];
   48 for(i=1,#v, if(!nfisideal(K,v[i]),print(i)))
   49 idealred(K,2)
   50 idealred(K,[2,[;]])
   51 idealred(K,[2,factor(1)])
   52 idealdown(K, -1/2)
   53 idealdown(K, -2/3*(11*x+7))
   54 idealdown(K, [2, 11, 5]~)
   55 idealdown(K, idealprimedec(K, 2)[1])
   56 idealdown(nf, idealhnf(K, -2/3*(11*x+7)))
   57 idealismaximal(K,2)
   58 idealismaximal(K,5)
   59 idealismaximal(K,7).p
   60 idealismaximal(K,-7).p
   61 pr=idealprimedec(K,5)[1];
   62 idealismaximal(K,pr) == pr
   63 pr = idealprimedec(K,31)[2];
   64 idealismaximal(K,idealhnf(K,pr)) == pr
   65 
   66 k=nfinit(polcyclo(5));
   67 idealfactor(k,101,100)
   68 idealfactor(k,2*101,100)
   69 idealfactor(k,101/103,100)
   70 idealfactor(k,101/(2*103),100)
   71 idealfactor(k,2^4*[0,1,0,0]~,100)
   72 nf=nfinit(x^2+x+1);
   73 p = 67452192952521724999; pi = idealprimedec(nf,p)[1];
   74 q = 762234946175168528650011228121; qi = idealprimedec(nf,q)[1];
   75 f=idealfactor(nf, idealdiv(nf,pi,qi))
   76 idealfactor(nf, 787033*(x+1), 100)
   77 fa = idealfactor(nf, 471440*x + 612823, 100)
   78 idealfactor(nf,fa[2,1],10)
   79 idealfactor(nf,fa[2,1],40)
   80 idealfactor(nf, 471440*x + 612823, 2000)
   81 id=idealfactorback(nf,f)
   82 idealnumden(nf,id)
   83 idealnumden(nf,pi)
   84 idealnumden(nf,1)
   85 idealnumden(nf,1/2)
   86 idealnumden(nf,x/2)
   87 nffactorback(nf, [3, x+1, [1,2]~], [1, 2, 3])
   88 
   89 test(nf,F,v)=
   90 {
   91   my(Y = idealchinese(nf,F,v), P = F[,1], E = F[,2]);
   92   for (i=1,#P, if( nfeltval(nf, nfeltadd(nf,v[i],-Y),P[i]) < E[i], error(i)));
   93   Y;
   94 }
   95 v = [x,0,[0,1/7^4]~,Mod(x,nf.pol)];
   96 F = idealfactor(nf, 2*3*7);
   97 F[,2] *= 3;
   98 test(nf,F,v)
   99 F[,2] = [0,1,-2,3]~;
  100 test(nf,F,v)
  101 F[,2] = [1,1,1,1]~;
  102 test(nf,F,[1,0,0,0])
  103 test(nf,F,[0,1/11,0,0])
  104 P = F[2,1];
  105 v = nfeltval(nf, 0, P, &y); [v == valuation(0,2),y]
  106 v = nfeltval(nf, 12, P, &y); [v,y]
  107 v = nfeltval(nf, (2/5*(1-x))^3, P, &y); [v,y]
  108 v = nfeltval(nf, [2/5,3; 1-x,3], P, &y); [v,y]
  109 v = nfeltval(nf, nfeltpow(nf,P.gen[2],4), P, &y); [v,y]
  110 
  111 K = nfinit(t^2-2);
  112 fa = idealfactor(K, 2^2*3);
  113 C = idealchinese(K, [fa, [1,1]]);
  114 idealchinese(K, C, [1,t])
  115 idealchinese(K, C, [-1,t])
  116 C = idealchinese(K, fa);
  117 idealchinese(K, C, [1,t])
  118 C = idealchinese(K, [C,[-1,-1]]);
  119 idealchinese(K, C, [1,t])
  120 
  121 F = idealfactor(Q,2);
  122 idealchinese(Q, [F,[-1]], [0])
  123 idealchinese(Q, [F,[1]], [0])
  124 idealchinese(Q, [F,[0]], [0])
  125 
  126 K = nfinit(x^3 - 2);
  127 A = [46875, 30966, 9573; 0, 3, 0; 0, 0, 3];
  128 idealispower(K, A, 3, &B)
  129 B
  130 A = [9375, 2841, 198; 0, 3, 0; 0, 0, 3];
  131 idealispower(K, A, 3)
  132 idealispower(K, A, 1)
  133 idealispower(K, x, 2)
  134 
  135 \\ #2019
  136 idealispower(nfinit('y), 4, 2, &A)
  137 A
  138 
  139 K = nfinit(x^3 - 2);
  140 idealispower(K,2*5^3,3, &A)
  141 A
  142 
  143 \\ #1643
  144 K=nfinit(x^8-1310*x^6+575380*x^4-93689568*x^2+3644295424);
  145 idealprimedec(K,17,1)
  146 
  147 K=nfinit(2*x^2+1);
  148 idealprimedec(K,2)
  149 
  150 nf=nfinit(x^6+108); a=Mod(x,x^6+108);
  151 { for(k=2,5,
  152     u=nfalgtobasis(nf,(2*a^2+a+3)*random(2^100*x^6)^k);
  153     b=idealredmodpower(nf,u,k);
  154     v=nfeltmul(nf,u,nfeltpow(nf,b,k)); print(v)); }
  155 idealredmodpower(nf,0,2)
  156 idealredmodpower(nf,1,2)
  157 idealredmodpower(nf,x^5-3*x^4-3*x^3+18*x^2-18*x-54,2)
  158 idealredmodpower(nf,x/2,2)
  159 idealredmodpower(nf,x/12,2)
  160 
  161 \\ #2181
  162 K=nfinit(x^8-x^7+853*x^6-1705*x^5+728461*x^4+1452660*x^3+619196112*x^2+618470208*x+526936617216);
  163 u=-3295726369461731289346462354027551095147507850796810976485053015787461298353108007583029758931909391395188837628668142381696585601437206958160059088656895054166218670573364811083286147878242585838527045253797229311486033571024871881929287881077914632802195379103689126727632008134046230078244187204095701757094128/260724204971*x^7+152863926358270815544472123370490820166780242836471008050258163804853439449801824873411217655847998109907297746769178336511497087330162778040820494775879882958573450265443161858185457172379185261151238335647103015398581733887282351101399242916823136952231183683199101605679082163422859803969844993303192375158488395/260724204971*x^6+2406969062350137466974129399472410998165327268340813973208132297136368946979717955888179787396728806465215113589203085301099423514588331588410673016489928975328731366941577055358386555440702685134595491735392116911370554413115054763882219750201465929629596212857087211828803278102003368100380518925867680945671392758/260724204971*x^5+137081377031906128392870125864427558076072913056967813032379896192971269428599909167009269953614565674098274721075933937534960141450285421213854815419440875039596388799075475996861092731865801389720913656617782135991020999908157644078900708443933197909880176896579654094373664440105249916909867638439259664338357/357911*x^4-4070384803042875340985803129476097507909253548244290568349511184577280798573048974379898801802416130979368946784139048555791283831757663295406137658907489681591104458511952667444030644669716367155349587332608227047763781013968599806140375397111055668273281172821830908149779634693364726621708244806767055285739243/357911*x^3+168568151397754802332659319517140588351513494220656094382082344667989521434320523470084625110632495651098654578074052487914578127730269525935219602706975998497315707490354656426031415845673577166983029177291634864418998327847405449225543246927771172876308151314755102488557891516111932299073018228704234809975838558280/3672171901*x^2+181362559355967687441569495330120111725438491767051963183672797774029950131820046784857408792196513411721255514863234109334262708584276295532717046352106452388095588290213473060646544156544816015150427479886047726758182800473609208937424330313768632341406130437806943904609093544637112676778467331699309127867113568552/51720731*x+372127521854786946433207593778098718752150069645620903197210809657741784407186452886727962060707364324199752951617693996241954393320511097561377550117731467675995153475373681027825265683582338981915799545023659321144005643029640559571880834933169400027679490835114916769308702041993834252518389568506982417895596595904/728461;
  164 if (!idealispower(K,u,5,&v) || idealpow(K,v,5) != idealhnf(K,u), error("#2181"))
  165 
  166 \\ #2258
  167 K = nfinit(x^4 + 1393*x^2 + 484416);
  168 J = idealpow(K,idealprimedec(K,3)[1],-2) / 5;
  169 idealdiv(K,J,[0,1/5,0,0]~)
  170 
  171 \\ Errors, keep at end of file
  172 idealaddtoone(Q,2,[;])
  173 idealaddtoone(Q,[;],[;])
  174 idealaddtoone(Q,[1,[;],Mat(1/2)])
  175 ideallog(Q,2,zQ)
  176 ideallog(,0,zerror)
  177 ideallog(,2,zerror)
  178 ideallog(,3,zerror)
  179 ideallog(Q,3,zerror)
  180 ideallog(,3,zQ)
  181 idealmul(Kerror,[2,1;0,1],[2,1;0,1])
  182 idealmul(Kerror,matid(4),matid(4))
  183 idealred(nf,[2,Mat(1)])