Changeset abb4919 in git
- Timestamp:
- Jan 9, 2007, 11:35:28 AM (17 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- 18739516b73f47dc5e237129de66197ffbdf47ec
- Parents:
- 699ece64eb7bed7070edb4e5608ea2526b119f8f
- Location:
- Singular/LIB
- Files:
-
- 1 added
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/aksaka.lib
r699ece rabb4919 1 1 //CM, last modified 10.12.06 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: ASK.lib,v 1.3 2006-12-15 14:15:51Singular Exp $";3 version="$Id: aksaka.lib,v 1.1 2007-01-09 10:31:48 Singular Exp $"; 4 4 category="Teaching"; 5 5 info=" 6 LIBRARY: ASK.lib6 LIBRARY: aksaka.lib 7 7 Procedures for primality testing after Agrawal, Saxena, Kayal 8 8 AUTHORS: Christoph Mang … … 24 24 "; 25 25 26 LIB " krypto.lib";26 LIB "crypto.lib"; 27 27 LIB "ntsolve.lib"; 28 28 … … 31 31 // FAST (MODULAR) EXPONENTIATION // 32 32 // // 33 /////////////////////////////////////////////////////////////// 33 /////////////////////////////////////////////////////////////// 34 34 proc schnellexpt(number a,number m,number n) 35 35 "USAGE: schnellexpt(a,m,n); … … 73 73 //////////////////////////////////////////////////////////////////////////// 74 74 proc coeffmod(poly f,number n) 75 "USAGE: coeffmod(f,n); 75 "USAGE: coeffmod(f,n); 76 76 ASSUME: poly f depends on at most var(1) of the basering 77 RETURN: poly f modulo number n 78 NOTE: at first the coefficients of the monomials of the poly f are 79 determined, then their remainder modulo n is calculated, 80 after that the poly 'is put together' again 77 RETURN: poly f modulo number n 78 NOTE: at first the coefficients of the monomials of the poly f are 79 determined, then their remainder modulo n is calculated, 80 after that the poly 'is put together' again 81 81 EXAMPLE:example coeffmod; shows an example 82 82 " 83 { 83 { 84 84 matrix M=coeffs(f,var(1)); //Bestimmung der Polynomkoeffizienten 85 85 int i=1; … … 88 88 89 89 while(i<=o) 90 { 90 { 91 91 g=g+(leadcoef(M[i,1]) mod n)*var(1)^(i-1) ; 92 // umwandeln der Koeffizienten in numbers, 93 // Berechnung der Reste dieser numbers modulo n, 94 // poly mit neuen Koeffizienten wieder zusammensetzen 92 // umwandeln der Koeffizienten in numbers, 93 // Berechnung der Reste dieser numbers modulo n, 94 // poly mit neuen Koeffizienten wieder zusammensetzen 95 95 i=i+1; 96 96 } … … 98 98 } 99 99 example 100 { "EXAMPLE:"; echo = 2; 100 { "EXAMPLE:"; echo = 2; 101 101 ring R = 0,x,dp; 102 102 poly f=2457*x4+52345*x3-98*x2+5; 103 103 number n=3; 104 104 coeffmod(f,n); 105 } 105 } 106 106 ////////////////////////////////////////////////////////////////////////// 107 107 proc powerpolyX(number q,number n,poly a,poly r) 108 "USAGE: powerpolyX(q,n,a,r); 109 RETURN: the q-th power of poly a modulo poly r and number n 108 "USAGE: powerpolyX(q,n,a,r); 109 RETURN: the q-th power of poly a modulo poly r and number n 110 110 EXAMPLE:example powerpolyX; shows an example 111 111 " 112 112 { 113 113 ideal I=std(r); 114 114 115 115 if(q==1){return(coeffmod(reduce(a,I),n));} 116 116 if((q mod 5)==0){return(coeffmod(reduce(powerpolyX(q/5,n,a,r)^5,I),n));} … … 120 120 121 121 return(coeffmod(reduce(a*powerpolyX(q-1,n,a,r),I),n)); 122 } 123 example 124 { "EXAMPLE:"; echo = 2; 122 } 123 example 124 { "EXAMPLE:"; echo = 2; 125 125 ring R=0,x,dp; 126 126 poly a=3*x3-x2+5; … … 470 470 } 471 471 472 -
Singular/LIB/arcpoint.lib
r699ece rabb4919 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: arc AtPoint.lib,v 1.3 2006-07-31 12:15:57Singular Exp $";2 version="$Id: arcpoint.lib,v 1.1 2007-01-09 10:31:48 Singular Exp $"; 3 3 //-*- mode:C++;-*- 4 4 5 5 category="Singularities"; 6 6 info=" 7 LIBRARY: arc AtPoint.libTruncations of arcs at a singular point7 LIBRARY: arcpoint.lib Truncations of arcs at a singular point 8 8 AUTHOR: Nadine Cremer cremer@mathematik.uni-kl.de 9 9 -
Singular/LIB/atkins.lib
r699ece rabb4919 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: AtkinsTest.lib,v 1.8 2007-01-08 14:08:49Singular Exp $";2 version="$Id: atkins.lib,v 1.1 2007-01-09 10:31:48 Singular Exp $"; 3 3 category="Teaching"; 4 4 info=" 5 LIBRARY: AtkinsTest.lib Procedures for teaching cryptography6 AUTHOR: 5 LIBRARY: atkins.lib Procedures for teaching cryptography 6 AUTHOR: Stefan Steidel, Stefan.Steidel@gmx.de 7 7 8 8 NOTE: The library contains auxiliary procedures to compute the elliptic … … 32 32 "; 33 33 34 LIB " krypto.lib";34 LIB "crypto.lib"; 35 35 LIB "general.lib"; 36 36 LIB "ntsolve.lib"; -
Singular/LIB/crypto.lib
r699ece rabb4919 1 1 //GP, last modified 28.6.06 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: krypto.lib,v 1.5 2006-12-22 12:06:28 pfister Exp $";3 version="$Id: crypto.lib,v 1.1 2007-01-09 10:31:49 Singular Exp $"; 4 4 category="Teaching"; 5 5 info=" 6 LIBRARY: krypto.lib Procedures for teaching cryptography6 LIBRARY: crypto.lib Procedures for teaching cryptography 7 7 AUTHOR: Gerhard Pfister, pfister@mathematik.uni-kl.de 8 8 -
Singular/LIB/modstd.lib
r699ece rabb4919 1 2 1 //GP, last modified 23.10.06 3 2 /////////////////////////////////////////////////////////////////////////////// 4 version="$Id: mod Std.lib,v 1.2 2006-12-22 14:03:17 pfister Exp $";3 version="$Id: modstd.lib,v 1.1 2007-01-09 10:31:49 Singular Exp $"; 5 4 category="Commutative Algebra"; 6 5 info=" 7 LIBRARY: mod Std.lib Grobner basis of ideals6 LIBRARY: modstd.lib Grobner basis of ideals 8 7 AUTHORS: A. Hashemi, Amir.Hashemi@lip6.fr 9 8 @* G. Pfister pfister@mathematik.uni-kl.de … … 12 11 NOTE: 13 12 A library for computing the Grobner basis of an ideal in the polynomial 14 ring over the rational numbers using modular methods.The procedures are 13 ring over the rational numbers using modular methods.The procedures are 15 14 inspired by the following paper: 16 15 Elizabeth A. Arnold: 17 Modular Algorithms for Computing Groebner Bases , Journal of Symbolic 16 Modular Algorithms for Computing Groebner Bases , Journal of Symbolic 18 17 Computation , April 2003, Volume 35, (4), p. 403-419. 19 18 … … 21 20 PROCEDURES: 22 21 modStd(I,1); compute the reduced Groebner basis of I using modular methods 23 modS(I,L); liftings to Q of Groebner bases of I mod p for p in L 22 modS(I,L); liftings to Q of Groebner bases of I mod p for p in L 24 23 primeList(n); list of n primes <= 2134567879 in decreasing order 25 24 "; 26 25 27 LIB " krypto.lib";26 LIB "crypto.lib"; 28 27 /////////////////////////////////////////////////////////////////////////////// 29 28 proc modStd(ideal I,list #) … … 34 33 it is not tested whether the result contains I. 35 34 if #[1]=1: 36 a Groebner basis which contains I if no warning appears; 37 if I is homogeneous it is a Groebner basis of I 38 NOTE: the procedure computes the reduced Groebner basis of I (over the 39 rational numbers) by using modular methods. If #[1]=1 and a 35 a Groebner basis which contains I if no warning appears; 36 if I is homogeneous it is a Groebner basis of I 37 NOTE: the procedure computes the reduced Groebner basis of I (over the 38 rational numbers) by using modular methods. If #[1]=1 and a 40 39 warning appears then the result is a Groebner basis with no defined 41 relation to I; this is a sign that not enough prime numbers have 40 relation to I; this is a sign that not enough prime numbers have 42 41 been used. For further experiments see procedure modS. 43 42 EXAMPLE: example modStd; shows an example … … 56 55 ideal J,cT,lT,K; 57 56 ideal I0=I; 58 57 59 58 for (j=1;j<=size(L);j++) 60 59 { … … 102 101 TT[k]=T[k][j]; 103 102 } 104 J[j]=liftPoly(TT,L); 103 J[j]=liftPoly(TT,L); 105 104 } 106 105 //=========== chooses more primes up to the moment the result becomes stable … … 156 155 J=std(J); 157 156 I0=reduce(I0,J); 158 if(size(I0)>0){"WARNING: The input ideal is not contained 157 if(size(I0)>0){"WARNING: The input ideal is not contained 159 158 in the ideal generated by the standardbasis";} 160 159 } … … 168 167 ideal J=modStd(I); 169 168 J; 170 } 169 } 171 170 /////////////////////////////////////////////////////////////////////////////// 172 171 proc modS(ideal I, list L) … … 235 234 } 236 235 J[j]=liftPoly(TT,L); 237 236 238 237 } 239 238 attrib(J,"isSB",1); … … 247 246 ideal J=modS(I,L); 248 247 J; 249 } 250 /////////////////////////////////////////////////////////////////////////////// 248 } 249 /////////////////////////////////////////////////////////////////////////////// 251 250 proc liftPoly(list T, list L) 252 251 "USAGE: liftPoly(T,L); T list of polys, L list of primes … … 260 259 list TT; 261 260 number n; 262 261 263 262 number N=L[1]; 264 263 for(i=2;i<=size(L);i++) … … 290 289 } 291 290 n=chineseR(TT,L); 292 n=Farey(N,n); 291 n=Farey(N,n); 293 292 result=result+n*p; 294 293 } … … 300 299 list T=x2+7000x+13000,x2+100x+147y+40,x2+120x+191y+10,x2+x+67y+100; 301 300 liftPoly(T,L); 302 } 301 } 303 302 /////////////////////////////////////////////////////////////////////////////// 304 303 proc Farey (number P, number N) 305 304 "USAGE: Farey (P,N); P, N number; 306 RETURN: a rational number a/b such that a/b=N mod P 305 RETURN: a rational number a/b such that a/b=N mod P 307 306 and |a|,|b|<(P/2)^{1/2} 308 307 " … … 316 315 { 317 316 if (2*N^2<P){return(N/B);} 318 319 320 321 322 323 317 D=E mod N; 318 C=A-(E-E mod N)/N*B; 319 E=N; 320 N=D; 321 A=B; 322 B=C; 324 323 } 325 324 return(0); … … 329 328 ring R = 0,x,dp; 330 329 Farey(32003,12345); 331 } 330 } 332 331 /////////////////////////////////////////////////////////////////////////////// 333 332 proc chineseR(list T,list L) 334 333 "USAGE: chineseRem(T,L); 335 334 RETURN: x such that x = T[i] mod L[i] 336 NOTE: chinese remainder theorem 335 NOTE: chinese remainder theorem 337 336 EXAMPLE:example chineseRem; shows an example 338 337 " … … 370 369 ring R = 0,x,dp; 371 370 chineseRem(list(24,15,7),list(2,3,5)); 372 } 371 } 373 372 /////////////////////////////////////////////////////////////////////////////// 374 373 proc primeList(int n) 375 374 "USAGE: primeList(n); 376 RETURN: the list of n greatest primes <= 2134567879 375 RETURN: the list of n greatest primes <= 2134567879 377 376 EXAMPLE:example primList; shows an example 378 377 " … … 393 392 size(L); 394 393 L[size(L)]; 395 } 394 } 396 395 /////////////////////////////////////////////////////////////////////////////// 397 396 /*
Note: See TracChangeset
for help on using the changeset viewer.