Changeset 1a3911 in git
- Timestamp:
- Apr 6, 2009, 2:39:02 PM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 08e081516771eec845058a046616a8c0d7e8325b
- Parents:
- 7de8e4cf4e88e60e523f5ebb65a61c114ff3674a
- Location:
- Singular/LIB
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/aksaka.lib
r7de8e4 r1a3911 1 1 //CM, last modified 10.12.06 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: aksaka.lib,v 1. 3 2009-02-21 10:02:00 SingularExp $";3 version="$Id: aksaka.lib,v 1.4 2009-04-06 12:39:02 seelisch Exp $"; 4 4 category="Teaching"; 5 5 info=" 6 LIBRARY: aksaka.lib 7 Procedures for primality testing after Agrawal, Saxena, Kayal 6 LIBRARY: aksaka.lib Procedures for primality testing after Agrawal, Saxena, Kayal 8 7 AUTHORS: Christoph Mang 9 8 10 OVERVIE V:9 OVERVIEW: 11 10 Algorithms for primality testing in polynomial time 12 11 based on the ideas of Agrawal, Saxena and Kayal. … … 14 13 PROCEDURES: 15 14 16 schnellexpt(a,m,n) a^m for numbers a,m; if a^k>n n+1 is returned15 fastExpt(a,m,n) a^m for numbers a,m; if a^k>n n+1 is returned 17 16 log2(n) logarithm to basis 2 of n 18 17 PerfectPowerTest(n) checks if there are a,b>1, so that a^b=n … … 32 31 // // 33 32 /////////////////////////////////////////////////////////////// 34 proc schnellexpt(number a,number m,number n)35 "USAGE: schnellexpt(a,m,n);33 proc fastExpt(number a,number m,number n) 34 "USAGE: fastExpt(a,m,n); a, m, n = number; 36 35 RETURN: the m-th power of a; if a^m>n the procedure returns n+1 37 36 NOTE: uses fast exponentiation 38 EXAMPLE:example schnellexpt; shows an example37 EXAMPLE:example fastExpt; shows an example 39 38 " 40 39 { … … 65 64 { "EXAMPLE:"; echo = 2; 66 65 ring R = 0,x,dp; 67 schnellexpt(2,10,1022);66 fastExpt(2,10,1022); 68 67 } 69 68 //////////////////////////////////////////////////////////////////////////// … … 264 263 { 265 264 m=intPart((a+c)/2); 266 p= schnellexpt(m,b,n);265 p=fastExpt(m,b,n); 267 266 268 267 if(p==n) -
Singular/LIB/atkins.lib
r7de8e4 r1a3911 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: atkins.lib,v 1. 5 2008-10-09 09:31:57 SingularExp $";2 version="$Id: atkins.lib,v 1.6 2009-04-06 12:39:02 seelisch Exp $"; 3 3 category="Teaching"; 4 4 info=" 5 5 LIBRARY: atkins.lib Procedures for teaching cryptography 6 AUTHOR: Stefan Steidel, Stefan.Steidel@gmx.de6 AUTHOR: Stefan Steidel, steidel@mathematik.uni-kl.de 7 7 8 8 NOTE: The library contains auxiliary procedures to compute the elliptic 9 9 curve primality test of Atkin and the Atkin's Test itself. 10 10 The library is intended to be used for teaching purposes but not 11 for serious computations. Sufficiently high print Level allows to11 for serious computations. Sufficiently high printlevel allows to 12 12 control each step, thus illustrating the algorithms at work. 13 13 … … 20 20 CornacchiaModified(D,p) computes solution (x,y) for x^2+|D|*y^2=4p 21 21 maximum(L) computes the maximal number contained in L 22 sqr(w,k) computes the square root of w w.r.t. accuracy k 22 23 expo(z,k) computes exp(z) 23 24 jOft(t,k) computes the j-invariant of t … … 98 99 proc disc(number N, int k) 99 100 "USAGE: disc(N,k); 100 RETURN: list L of negative discriminants D, sort in decreasing order101 RETURN: list L of negative discriminants D, sorted in decreasing order 101 102 ASSUME: D<0, D kongruent 0 or 1 modulo 4 and |D|<4N 102 103 NOTE: D=b^2-4*a, where 0<=b<=k and intPart((b^2)/4)+1<=a<=k for each b … … 384 385 RETURN: e^z to the order k 385 386 NOTE: k describes the number of summands being calculated in the exponential power series 386 EXAMPLE:example e ; shows an example387 EXAMPLE:example expo; shows an example 387 388 " 388 389 { … … 412 413 ASSUME: t is a complex number with positive imaginary part 413 414 NOTE: k describes the number of summands being calculated in the power series, 414 10*k is input for the procedure "e"415 EXAMPLE:example j ot; shows an example415 10*k is input for the procedure @code{expo} 416 EXAMPLE:example jOft; shows an example 416 417 " 417 418 { … … 513 514 RETURN: the monic polynomial of degree h(D) in Z[X] of which jOft((D+sqr(D))/2) is a root 514 515 ASSUME: D is a negative discriminant 515 NOTE: k is input for the procedure "j ot",516 NOTE: k is input for the procedure "jOft", 516 517 5*k is input for the procedure "sqr", 517 518 10*k describes the number of decimals being calculated in the complex numbers 518 EXAMPLE:example HilbertClassPoly nomial; shows an example519 EXAMPLE:example HilbertClassPoly; shows an example 519 520 " 520 521 { … … 773 774 0, if the algorithm is not applicable, since there are too little discriminants 774 775 ASSUME: N is coprime to 6 and different from 1 775 NOTE: - K/2 is input for the procedure "disc",776 K is input for the procedure "HilbertClassPolynomial",777 B describes the number of recursions being calculated778 -The basis of the algorithm is the following theorem:776 NOTE: K/2 is input for the procedure "disc",@* 777 K is input for the procedure "HilbertClassPolynomial",@* 778 B describes the number of recursions being calculated.@* 779 The basis of the algorithm is the following theorem: 779 780 Let N be an integer coprime to 6 and different from 1 and E be an 780 781 ellipic curve modulo N. Assume that we know an integer m and a 781 point P of E(Z/NZ) satisfying the following conditions. 782 (1) There exists a prime divisor q of m such that q>(4-th root(N)+1)^2. 783 (2) m*P=O(E)=(0:1:0). 784 (3) (m/q)*P=(x:y:t) with t element of (Z/NZ)*. 782 point P of E(Z/NZ) satisfying the following conditions.@* 783 (1) There exists a prime divisor q of m such that q>(4-th root(N)+1)^2.@* 784 (2) m*P=O(E)=(0:1:0).@* 785 (3) (m/q)*P=(x:y:t) with t element of (Z/NZ)*.@* 785 786 Then N is prime. 786 787 EXAMPLE:example Atkin; shows an example … … 1200 1201 printlevel=1; 1201 1202 Atkin(7691,100,5); 1202 Atkin(8543,100,4);1203 Atkin(100019,100,5);1204 1203 Atkin(10000079,100,2); 1205 1204 } -
Singular/LIB/crypto.lib
r7de8e4 r1a3911 1 1 //GP, last modified 28.6.06 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: crypto.lib,v 1. 6 2008-10-09 09:31:57 SingularExp $";3 version="$Id: crypto.lib,v 1.7 2009-04-06 12:39:02 seelisch Exp $"; 4 4 category="Teaching"; 5 5 info=" … … 8 8 9 9 NOTE: The library contains procedures to compute the discrete logarithm, 10 primal y-tests, factorization included elliptic curve methodes.10 primality-tests, factorization included elliptic curves. 11 11 The library is intended to be used for teaching purposes but not 12 12 for serious computations. Sufficiently high printlevel allows to … … 65 65 proc decimal(string s) 66 66 "USAGE: decimal(s); s = string 67 RETURN: the (decimal) number corresponding to the hexadecimal number s67 RETURN: the (decimal) number corresponding to the hexadecimal number s 68 68 EXAMPLE:example decimal; shows an example 69 69 " … … 103 103 proc exgcdN(number a, number n) 104 104 "USAGE: exgcdN(a,n); 105 RETURN: a list s,t,d of numbers ,d=gcd(a,n)=s*a+t*n105 RETURN: a list s,t,d of numbers satisfying d=gcd(a,n)=s*a+t*n 106 106 EXAMPLE:example exgcdN; shows an example 107 107 " … … 510 510 "USAGE: babyGiant(b,y,p); 511 511 RETURN: the discrete logarithm x: b^x=y mod p 512 NOTE: giant-step-baby-step512 NOTE: This procedure works based on Shank's baby step - giant step method. 513 513 EXAMPLE:example babyGiant; shows an example 514 514 " … … 561 561 NOTE: Pollard's rho: 562 562 choose random f_0 in 0,...,p-2 ,e_0=0, define x_0=b^f_0, define 563 x_i=y^e_i b^f_i as below. For i large enough there is i with563 x_i=y^e_i*b^f_i as below. For i large enough there is i with 564 564 x_(i/2)=x_i. Let s:=e_(i/2)-e_i mod p-1 and t:=f_i-f_(i/2) mod p-1, 565 565 d=gcd(s,p-1)=u*s+v*(p-1) then x=tu/d +j*(p-1)/d for some j (to be … … 649 649 RETURN: 1 if n is prime, 0 else 650 650 NOTE: probabilistic test of Miller-Rabin with k loops to test if n is prime. 651 Using the theorem: If n is prime, n-1=2^s*r, r odd, then651 Using the theorem: If n is prime, n-1=2^s*r, r odd, then 652 652 powerN(a,r,n)=1 or powerN(a,r*2^i,n)=-1 for some i 653 653 EXAMPLE:example MillerRabin; shows an example … … 701 701 RETURN: 1 if n is prime, 0 else 702 702 NOTE: probabilistic test of Soloway-Strassen with k loops to test if n is 703 prime using the theorem: 704 If n is prime thenpowerN(a,(n-1)/2,n)=Jacobi(a,n) mod n703 prime using the theorem: If n is prime then 704 powerN(a,(n-1)/2,n)=Jacobi(a,n) mod n 705 705 EXAMPLE:example SolowayStrassen; shows an example 706 706 " … … 746 746 L a list of the first k primes 747 747 RETURN:message N is not prime or {A,{p},{a_p}} as certificate for N being prime 748 NOTE:assumes that it is possible to factorize N-1=A*B such that gcd(A,B)=1 748 NOTE:assumes that it is possible to factorize N-1=A*B such that gcd(A,B)=1, 749 749 the factorization of A is completely known and A^2>N . 750 750 N is prime if and only if for each prime factor p of A we can find … … 830 830 "USAGE: PollardRho(n,k,allFactors); optional: PollardRho(n,k,allFactors,L); 831 831 L a list of the first k primes 832 RETURN: a list of factors of n (which could be just n),if allFactors=0 832 RETURN: a list of factors of n (which could be just n),if allFactors=0@* 833 833 a list of all factors of n ,if allFactors=1 834 834 NOTE: probabilistic rho-algorithm of Pollard to find a factor of n in k loops. … … 933 933 NOTE: Pollard's p-factorization 934 934 creates the product k of powers of primes (bounded by B) from 935 the list P with the idea that for a prime divisor p of n p-1|k936 then p devides gcd(a^k-1,n) for some random a935 the list P with the idea that for a prime divisor p of n we have 936 p-1|k, and then p devides gcd(a^k-1,n) for some random a 937 937 EXAMPLE:example pFactor; shows an example 938 938 " … … 974 974 k for using the first k elements in B 975 975 RETURN: a list of factors of n or the message: no divisor found 976 NOTE: quadraticSieve: Ideais to find x,y such that x^2=y^2 mod n then976 NOTE: The idea being used is to find x,y such that x^2=y^2 mod n then 977 977 gcd(x-y,n) can be a proper divisor of n 978 978 EXAMPLE:example quadraticSieve; shows an example … … 1128 1128 "USAGE: ellipticAdd(N,a,b,P,Q); 1129 1129 RETURN: list L, representing the point P+Q 1130 NOTE: P=(P[1]:P[2]:P[3]), Q =(Q[1]:Q[2]:Q[3])points on the elliptic curve1130 NOTE: P=(P[1]:P[2]:P[3]), Q=(Q[1]:Q[2]:Q[3]) points on the elliptic curve 1131 1131 defined by y^2z=x^3+a*xz^2+b*z^3 over Z/N 1132 1132 EXAMPLE:example ellipticAdd; shows an example … … 1350 1350 RETURN: the number of points of the elliptic curve defined by 1351 1351 y^2=x^3+a*x+b over Z/N 1352 NOTE: trivial ap roach1352 NOTE: trivial approach 1353 1353 EXAMPLE:example countPoints; shows an example 1354 1354 " … … 1420 1420 1421 1421 proc ShanksMestre(number q, number a, number b, list #) 1422 "USAGE: ShanksMestre(q,a,b); optional: ShanksMestre(q,a,b,s); s the number1422 "USAGE: ShanksMestre(q,a,b); optional: ShanksMestre(q,a,b,s); s the number 1423 1423 of loops in the algorithm (default s=1) 1424 1424 RETURN: the number of points of the elliptic curve defined by 1425 1425 y^2=x^3+a*x+b over Z/N 1426 NOTE: algorithm of Shanks and Mestre ( giant-step-baby-step)1426 NOTE: algorithm of Shanks and Mestre (baby-step-giant-step) 1427 1427 EXAMPLE:example ShanksMestre; shows an example 1428 1428 " … … 1575 1575 "USAGE: generateG(a,b,m); 1576 1576 RETURN: m-th division polynomial 1577 NOTE: generate the recursively defined polynomials in Z[x,y],so called1578 division polynomials, p_m=generateG(a,b,m) such that on the elliptic curve1579 defined by y^2=x^3+a*x+b over Z/N and a point P=(x:y:1) the point m*P is 1580 1581 m*P=0 iff p_m(P)=01577 NOTE: generate the so-called division polynomials, i.e., the recursively defined 1578 polynomials p_m=generateG(a,b,m) in Z[x, y] such that, for a point (x:y:1) on the 1579 elliptic curve defined by y^2=x^3+a*x+b over Z/N the point@* 1580 m*P=(x-(p_(m-1)*p_(m+1))/p_m^2 :(p_(m+2)*p_(m-1)^2-p_(m-2)*p_(m+1)^2)/4y*p_m^3 :1) 1581 and m*P=0 iff p_m(P)=0 1582 1582 EXAMPLE:example generateG; shows an example 1583 1583 " … … 1846 1846 d+1 the number of loops in the algorithm (default d=0) 1847 1847 RETURN: a factor of N or the message no factor found 1848 NOTE: - computes a factor of N using Lenstra's ECM factorization 1848 NOTE: - computes a factor of N using Lenstra's ECM factorization@* 1849 1849 - the idea is that the fact that N is not prime is dedected using 1850 1850 the operations on the elliptic curve … … 1901 1901 proc ECPP(number N) 1902 1902 "USAGE: ECPP(N); 1903 RETURN: message:N is not prime or {L,P,m,q} as certificate for N being prime 1904 L a list (y^2=x^3+L[1]*x+L[2] defines an elliptic curve C) 1905 P a list ((P[1]:P[2]:P[3]) is a point of C) 1903 RETURN: message:N is not prime or {L,P,m,q} as certificate for N being prime@* 1904 L a list (y^2=x^3+L[1]*x+L[2] defines an elliptic curve C)@* 1905 P a list ((P[1]:P[2]:P[3]) is a point of C)@* 1906 1906 m,q integers 1907 1907 ASSUME: gcd(N,6)=1 -
Singular/LIB/graphics.lib
r7de8e4 r1a3911 1 1 //last change: 13.02.2001 (Eric Westenberger) 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: graphics.lib,v 1.1 3 2009-04-06 09:17:01seelisch Exp $";3 version="$Id: graphics.lib,v 1.14 2009-04-06 12:39:02 seelisch Exp $"; 4 4 category="Visualization"; 5 5 info=" … … 8 8 9 9 PROCEDURES: 10 staircase( fname,I);Mathematica text for displaying staircase of I10 staircase(I); Mathematica text for displaying staircase of I 11 11 mathinit(); string for loading Mathematica's ImplicitPlot 12 12 mplot(fname,I[# s]); Mathematica text for various plots -
Singular/LIB/hyperel.lib
r7de8e4 r1a3911 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: hyperel.lib,v 1. 1 2007-05-24 11:57:58 SingularExp $";2 version="$Id: hyperel.lib,v 1.2 2009-04-06 12:39:02 seelisch Exp $"; 3 3 category="Teaching"; 4 4 info=" 5 LIBRARY: hyperel liptic.lib5 LIBRARY: hyperel.lib 6 6 AUTHOR: Markus Hochstetter, markushochstetter@gmx.de 7 7 8 NOTE: Thislibrary provides procedures for computing with divisors in the9 10 11 12 8 NOTE: The library provides procedures for computing with divisors in the 9 jacobian of hyperelliptic curves. In addition procedures are available 10 for computing the rational representation of divisors and vice versa. 11 The library is intended to be used for teaching and demonstrating 12 purposes but not for efficient computations. 13 13 14 14 … … 38 38 39 39 proc ishyper(poly h, poly f) 40 "USAGE: ishyper(h,f); h,f 41 RETURN: 1 if y^2+h(x)y=f(x) is hyperelliptic, else 040 "USAGE: ishyper(h,f); h,f=poly 41 RETURN: 1 if y^2+h(x)y=f(x) is hyperelliptic, 0 otherwise 42 42 NOTE: Tests, if y^2+h(x)y=f(x) is a hyperelliptic curve. 43 43 Curve is defined over basering. Additionally shows error-messages. … … 101 101 102 102 proc isoncurve(list P, poly h, poly f) 103 "USAGE: isoncurve(P,h,f); h,f poly103 "USAGE: isoncurve(P,h,f); h,f=poly; P=list 104 104 RETURN: 1 or 0 (if P is on curve or not) 105 NOTE: Tests, if P=(P[1],P[2]) is on the hyperelliptic curve 106 y^2+h(x)y=f(x) . 105 NOTE: Tests, if P=(P[1],P[2]) is on the hyperelliptic curve y^2+h(x)y=f(x). 107 106 Curve is defined over basering. 108 107 EXAMPLE: example isoncurve; shows an example … … 147 146 148 147 proc chinrestp(list b,list moduli) 149 "USAGE: chinrestp(b,moduli); b, modulilist of polynomials150 RETURN: poly nomialx, s.t. x= b[i] mod moduli[i]148 "USAGE: chinrestp(b,moduli); moduli, b, moduli=list of polynomials 149 RETURN: poly x, s.t. x= b[i] mod moduli[i] 151 150 NOTE: chinese remainder theorem for polynomials 152 151 EXAMPLE: example chinrestp; shows an example … … 193 192 RETURN: norm of a(x)-b(x)y in IF[C] 194 193 NOTE: The norm is a polynomial in just one variable. 195 Curve C: y^2+h(x)y=f(x) is defined over basering.194 Curve C: y^2+h(x)y=f(x) is defined over basering. 196 195 EXAMPLE: example norm; shows an example 197 196 " … … 217 216 "USAGE: multi(a,b,c,d,h,f); 218 217 RETURN: list L with L[1]-L[2]y=(a(x)-b(x)y)*(c(x)-d(x)y) in IF[C] 219 NOTE: Curve C: y^2+h(x)y=f(x) is defined over basering.218 NOTE: Curve C: y^2+h(x)y=f(x) is defined over basering. 220 219 EXAMPLE: example multi; shows an example 221 220 " … … 465 464 "USAGE: divisor(a,b,h,f); optional: divisor(a,b,h,f,s); s=0,1 466 465 RETURN: list P 467 NOTE: P[1][3]*(P[1][1], P[1][2]) +...+ P[size of(P)][3]*468 *(P[size of(P)][1], P[sizeof(P)][2]) - (*)infty=div(a(x)-b(x)y)466 NOTE: P[1][3]*(P[1][1], P[1][2]) +...+ P[size(P)][3]* 467 *(P[size(P)][1], P[size(P)][2]) - (*)infty=div(a(x)-b(x)y) 469 468 if there is an optional parameter s!=0, then divisor additonally 470 469 returns a parameter, which says, whether irreducible polynomials 471 470 occured during computations or not. Otherwise only warnings are 472 471 displayed on the monitor. For s=0 nothing happens. 473 Curve C: y^2+h(x)y=f(x) is defined over basering.472 Curve C: y^2+h(x)y=f(x) is defined over basering. 474 473 EXAMPLE: example divisor; shows an example 475 474 " … … 651 650 RETURN: list P 652 651 NOTE: important: Divisor D has to be semireduced! 653 Computes semireduced divisor 654 P[1][3]*(P[1][1], P[1][2]) +...+ P[sizeof(P)][3]* 655 *(P[sizeof(P)][1], P[sizeof(P)][2]) - (*)infty=div(D[1],D[2]) 652 Computes semireduced divisor P[1][3]*(P[1][1], P[1][2]) +...+ P[size(P)][3]* 653 *(P[size(P)][1], P[size(P)][2]) - (*)infty=div(D[1],D[2])@* 656 654 Curve C:y^2+h(x)y=f(x) is defined over basering. 657 655 EXAMPLE: example semidiv; shows an example … … 695 693 NOTE: Cantor's Algorithm - composition 696 694 important: D and Q have to be semireduced! 697 Computes semireduced divisor 698 div(P[1],P[2])= div(D[1],D[2]) + div(Q[1],Q[2]) 695 Computes semireduced divisor div(P[1],P[2])= div(D[1],D[2]) + div(Q[1],Q[2]) 699 696 The divisors are defined over the basering. 700 Curve C: y^2+h(x)y=f(x) is defined over the basering.697 Curve C: y^2+h(x)y=f(x) is defined over the basering. 701 698 EXAMPLE: example cantoradd; shows an example 702 699 " … … 739 736 NOTE: Cantor's algorithm - reduction. 740 737 important: Divisor D has to be semireduced! 741 Computes reduced divisor div(N[1],N[2])= div(D[1],D[2]). 738 Computes reduced divisor div(N[1],N[2])= div(D[1],D[2]).@* 742 739 The divisors are defined over the basering. 743 Curve C: y^2+h(x)y=f(x) is defined over the basering.740 Curve C: y^2+h(x)y=f(x) is defined over the basering. 744 741 EXAMPLE: example cantorred; shows an example 745 742 " … … 773 770 NOTE: important: Divisor D has to be semireduced! 774 771 Special case of Cantor's algorithm. 775 Computes reduced divisor div(Q[1],Q[2])= 2*div(D[1],D[2]) 772 Computes reduced divisor div(Q[1],Q[2])= 2*div(D[1],D[2]).@* 776 773 The divisors are defined over the basering. 777 774 Curve C:y^2+h(x)y=f(x) is defined over the basering. … … 804 801 Uses repeated doublings for a faster computation 805 802 of the reduced divisor m*D. 806 Attention: Factor m isint, this means bounded.803 Attention: Factor m=int, this means bounded. 807 804 For m<0 the inverse of m*D is returned. 808 805 The divisors are defined over the basering. 809 Curve C: y^2+h(x)y=f(x) is defined over the basering.806 Curve C: y^2+h(x)y=f(x) is defined over the basering. 810 807 EXAMPLE: example cantormult; shows an example 811 808 " -
Singular/LIB/latex.lib
r7de8e4 r1a3911 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: latex.lib,v 1.3 0 2009-01-14 16:07:05 SingularExp $";2 version="$Id: latex.lib,v 1.31 2009-04-06 12:39:02 seelisch Exp $"; 3 3 category="Visualization"; 4 4 info=" … … 7 7 8 8 PROCEDURES: 9 closetex(fnm); writes closing line for LaTeX-document 10 opentex(fnm); writes header for LaTeX-file fnm 11 tex(fnm); calls LaTeX2e for LaTeX-file fnm 12 texdemo([n]); produces a file explaining the features of this lib 13 texfactorize(fnm,f); creates string in LaTeX-format for factors of poly f 14 texmap(fnm,m,r1,r2); creates string in LaTeX-format for map m:r1->r2 15 texname(fnm,s); creates string in LaTeX-format for identifier 16 texobj(l); creates string in LaTeX-format for any (basic) type 17 texpoly(f,n[,l]); creates string in LaTeX-format for poly 18 texproc(fnm,p); creates string in LaTeX-format of text from proc p 19 texring(fnm,r[,l]); creates string in LaTeX-format for ring/qring 20 rmx(s); removes .aux and .log files of LaTeX-files 21 xdvi(s); calls xdvi for dvi-files 22 (parameters in square brackets [] are optional) 9 closetex(fnm) writes closing line for LaTeX-document 10 opentex(fnm) writes header for LaTeX-file fnm 11 tex(fnm) calls LaTeX2e for LaTeX-file fnm 12 texdemo([n]) produces a file explaining the features of this lib 13 texfactorize(fnm,f) creates string in LaTeX-format for factors of poly f 14 texmap(fnm,m,r1,r2) creates string in LaTeX-format for map m:r1->r2 15 texname(fnm,s) creates string in LaTeX-format for identifier 16 texobj(l) creates string in LaTeX-format for any (basic) type 17 texpoly(f,n[,l]) creates string in LaTeX-format for poly 18 texproc(fnm,p) creates string in LaTeX-format of text from proc p 19 texring(fnm,r[,l]) creates string in LaTeX-format for ring/qring 20 rmx(s) removes .aux and .log files of LaTeX-files 21 xdvi(s) calls xdvi for dvi-files 22 (parameters in square brackets [] are optional) 23 (Procedures with file output assume sufficient write permissions 24 when trying to append existing or create new files.) 23 25 24 26 GLOBAL VARIABLES: … … 578 580 proc texname(string fname, string s) 579 581 "USAGE: texname(fname,s); fname,s strings 580 RETURN: if @code{fname=\"\"}: string, the transformed string s, wherethe582 RETURN: if @code{fname=\"\"}: the transformed string s, for which the 581 583 following rules apply: 582 584 @example … … 588 590 \"(\" + int + \",\" + s' + \")\" --> \"_@{\"+ int +\"@}\" + \"^@{\" + s'+\"@}\" 589 591 @end example 590 Anyhow, strings which begin with a @code{\"@{\"} are only changed591 by deleting the first and last character (intended to remove the592 surrounding curly brackets).592 Furthermore, strings which begin with a @code{\"@{\"} are modified 593 by deleting the first and the last character (which is then assumed to 594 be a @code{\"@}\"}). 593 595 594 596 if @code{fname!=\"\"}: append the transformed string s to the file … … 1051 1053 is added to @code{fname}.@* 1052 1054 The optional list L is assumed to be a list of strings which control, 1053 for insta mce the symbol for the field of coefficients.@*1055 for instance the symbol for the field of coefficients.@* 1054 1056 For more details call @code{texdemo();} (generates a LaTeX2e 1055 1057 file called @code{texlibdemo.tex} which explains all features of … … 1251 1253 RETURN: nothing; displays dvi-file fname.dvi with previewer xdvi 1252 1254 NOTE: suffix .dvi may be omitted in fname 1253 style overwrites the default setting xdvi1255 style captures the program that will be called instead of the default (xdvi) 1254 1256 EXAMPLE: example xdvi; shows an example 1255 1257 " -
Singular/LIB/polymake.lib
r7de8e4 r1a3911 1 version="$Id: polymake.lib,v 1.1 2 2009-03-25 11:31:32 keilenExp $";1 version="$Id: polymake.lib,v 1.13 2009-04-06 12:39:02 seelisch Exp $"; 2 2 category="Tropical Geometry"; 3 3 info=" … … 100 100 PURPOSE: the procedure calls polymake to compute the vertices of the polytope 101 101 as well as its dimension and information on its facets 102 RETURN: list ,L with four entries102 RETURN: list L with four entries 103 103 @* L[1] : an integer matrix whose rows are the coordinates of vertices 104 104 of the polytope 105 105 @* L[2] : the dimension of the polytope 106 @* L[3] : a list whose i th entry explains to which vertices the106 @* L[3] : a list whose i-th entry explains to which vertices the 107 107 ith vertex of the Newton polytope is connected 108 108 -- i.e. L[3][i] is an integer vector and an entry k in … … 127 127 @* - moreover, the procedure creates the file /tmp/polytope.output which 128 128 it deletes again before ending 129 @* - it is possible to give as an optional second argument as string129 @* - it is possible to provide an optional second argument as string 130 130 which then will be used instead of 'polytope' in the name of the 131 131 polymake output file -
Singular/LIB/rootsmr.lib
r7de8e4 r1a3911 1 // $Id: rootsmr.lib,v 1. 4 2008-03-18 15:51:41 SingularExp $1 // $Id: rootsmr.lib,v 1.5 2009-04-06 12:39:02 seelisch Exp $ 2 2 // E. Tobis 12.Nov.2004, April 2004 3 3 // last change 7. May 2005 (G.-M. Greuel) … … 303 303 304 304 proc tracemult(poly f,ideal B,ideal I) 305 "USAGE: tracemult(f,b,i);f poly, b,i ideal 306 RETURN: number: the trace of the multiplication by f (m_f) on r/i, 307 written in the monomial basis b of r/i, r = basering 308 (faster than matmult + trace) 309 ASSUME: i is a Groebner basis and b is an ordered monomial basis of r/i 305 "USAGE: tracemult(f,B,I);f poly, B,I ideal 306 RETURN: number: the trace of the multiplication by f (m_f) on r/I, written in 307 the monomial basis B of r/I, r = basering (faster than matmult + trace) 308 ASSUME: I is given by a Groebner basis and B is an ordered monomial basis of r/I 310 309 SEE ALSO: matmult,trace 311 310 EXAMPLE: example tracemult; shows an example" … … 496 495 /////////////////////////////////////////////////////////////////////////////// 497 496 498 proc verify(poly p,ideal b,ideal i)499 "USAGE: verify(p, b,i);p poly, b,i,ideal500 RETURN: integer: 1 iff the polynomial p splits the points of V( i).497 proc verify(poly p,ideal B,ideal I) 498 "USAGE: verify(p,B,I); p poly, B,I,ideal 499 RETURN: integer: 1 iff the polynomial p splits the points of V(I). 501 500 It's used to check the result of randcharpoly 502 ASSUME: i is a Groebner basis and b is an ordered monomial basis of r/i,501 ASSUME: I is given by a Groebner basis and B is an ordered monomial basis of r/I, 503 502 r = basering 504 503 NOTE: comments the result if printlevel>0 (default: printlevel=0) … … 511 510 poly variable; 512 511 513 if (isparam(p) || isparam( b) || isparam(i)) {512 if (isparam(p) || isparam(B) || isparam(I)) { 514 513 ERROR("This procedure cannot operate with parametric arguments"); 515 514 } … … 517 516 variable = isuni(p); 518 517 sqr_free = p/gcd(p,diff(p,variable)); 519 correct = (mat_rk(matbil(1, b,i)) == deg(sqr_free));518 correct = (mat_rk(matbil(1,B,I)) == deg(sqr_free)); 520 519 521 520 if (correct) { … … 594 593 ring r = 0,(x,y,z),dp; 595 594 596 ideal i = (x-1)*(x-2),(y-1),(z+5); // V(I) = {(1,1,-5),(2,1,-5) 595 ideal i = (x-1)*(x-2),(y-1),(z+5); // V(I) = {(1,1,-5),(2,1,-5)} 597 596 i = std(i); 598 597 -
Singular/LIB/rootsur.lib
r7de8e4 r1a3911 1 // $Id: rootsur.lib,v 1. 6 2007-11-16 18:38:24 SingularExp $1 // $Id: rootsur.lib,v 1.7 2009-04-06 12:39:02 seelisch Exp $ 2 2 // E. Tobis 12.Nov.2004, April 2004 3 3 // last change 5. May 2005 (G.-M. Greuel) … … 63 63 proc isparam(list #) 64 64 "USAGE: isparam(ideal/module/poly/list); 65 RETURN: int: 0 if the argument has non-parametric coefficients 66 and 1 if it has65 RETURN: int: 0 if the argument has non-parametric coefficients and 1 if it 66 has parametric coefficients 67 67 EXAMPLE: example isparam; shows an example" 68 68 { … … 204 204 with the same parity as the actual number of roots (using the 205 205 Budan-Fourier Theorem) 206 ASSUME: p is a univariate polynomial with rational coefficients207 a, b are rational numbers with a < b206 ASSUME: - p is a univariate polynomial with rational coefficients@* 207 - a, b are rational numbers with a < b 208 208 SEE ALSO: boundposDes,varsigns 209 209 EXAMPLE: example boundBuFou; shows an example" … … 457 457 "USAGE: sturm(p,a,b); poly p, number a,b 458 458 RETURN: int: the number of real roots of p in (a,b] 459 ASSUME: p is a univariate polynomial with rational coefficients, 459 ASSUME: p is a univariate polynomial with rational coefficients,@* 460 460 a, b are rational numbers with a < b 461 461 SEE ALSO: sturmha,allrealst,allreal … … 522 522 ASSUME: p is a univariate polynomial with rational coefficients 523 523 THEORY: The Sturm sequence of p (also called remainder sequence) is the 524 sequence begin inng with p, p' and goes on with the negative of the525 remainder of the two previous polynomials, until the remainder is526 zero.524 sequence beginning with p, p' and goes on with the negative part of 525 the remainder of the two previous polynomials, until the remainder 526 is zero. 527 527 See: Basu, Pollack, Roy, Algorithms in Real Algebraic Geometry, 528 528 Springer, 2003. … … 614 614 proc sturmha(poly P,number a,number b) 615 615 "USAGE: sturmha(p,a,b); poly p, number a,b 616 RETURN: int: the number of real roots of p in (a,b) (using a 617 Sturm-Habicht sequence) 616 RETURN: int: the number of real roots of p in (a,b) (using a Sturm-Habicht sequence) 618 617 SEE ALSO: sturm,allreal 619 618 EXAMPLE: example sturmha; shows an example" … … 683 682 proc sturmhaseq(poly P) 684 683 "USAGE: sturmhaseq(P); P poly. 685 RETURN: list: the non zero polynomials of the Sturm-Habicht sequence of P684 RETURN: list: the non-zero polynomials of the Sturm-Habicht sequence of P 686 685 ASSUME: P is a univariate polynomial. 687 686 THEORY: The Sturm-Habicht sequence (also subresultant sequence) is closely … … 805 804 nrroots(p); 806 805 p = p*(x2+1); 807 nrroots(p) 806 nrroots(p); 808 807 } 809 808 /////////////////////////////////////////////////////////////////////////////// -
Singular/LIB/surf.lib
r7de8e4 r1a3911 1 1 // last modified 21.07.2005, Oliver Wienand 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: surf.lib,v 1.3 2 2009-02-17 11:47:48 SingularExp $";3 version="$Id: surf.lib,v 1.33 2009-04-06 12:39:02 seelisch Exp $"; 4 4 category="Visualization"; 5 5 info=" 6 6 LIBRARY: surf.lib Procedures for Graphics with Surf 7 AUTHOR: Hans Schoenemann, 8 the program surf is written by Stefan Endrass 7 AUTHOR: Hans Schoenemann 9 8 10 9 NOTE: 11 10 @texinfo 12 To usethis library requires the program @code{surf} to be installed.11 Using this library requires the program @code{surf} to be installed. 13 12 You can download @code{surf} either from 14 13 @uref{http://sourceforge.net/projects/surf} … … 16 15 The procedure surfer requires the program @code{surfer} to be installed. 17 16 You can download @code{surfer} from 18 @uref{http://www.imaginary2008.de/surfer. php}17 @uref{http://www.imaginary2008.de/surfer.imaginary2008.de} 19 18 @*Under Windows, version 159 or newer of @code{surfer} is required. 20 19 @end texinfo -
Singular/LIB/surfex.lib
r7de8e4 r1a3911 1 1 //last change: 2007/07/06 (Oliver Labs) 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: surfex.lib,v 1. 9 2009-01-14 16:07:05 SingularExp $";3 version="$Id: surfex.lib,v 1.10 2009-04-06 12:39:02 seelisch Exp $"; 4 4 category="Visualization"; 5 5 info=" … … 46 46 " 47 47 USAGE: plotRot(poly p, list #) 48 Similar to plotRotated, but guesses automatically 49 which coordinates should be used.48 Similar to plotRotated, but guesses automatically which coordinates should be used. 49 The optional int parameter can be used to set plotting quality. 50 50 51 51 It opens the external program surfex for drawing the surface given by p, … … 121 121 This opens the external program surfex for drawing the surface given by p, 122 122 seen as a surface in the real affine space with coordinates coords. 123 The optional int parameter can be used to set plotting quality. 123 124 124 125 ASSUME: coords is a list of three variables. … … 152 153 This opens the external program surfex for drawing the surfaces given by varieties, 153 154 seen as a surface in the real affine space with coordinates coords. 155 The optional int parameter can be used to set plotting quality. 154 156 155 157 ASSUME: coords is a list of three variables, varieties is a list of ideals … … 397 399 USAGE: plotRotatedListFromSpecifyList(list varietiesList, list #); 398 400 varietiesList has a complicated format (not documented yet); 399 see the example. 401 see the example.@* 402 The optional int parameter can be used to set plotting quality. 400 403 401 404 ASSUME: The basering is of characteristic zero. … … 450 453 seen as a surface in the real affine space with coordinates x,y,z. 451 454 The format for the list varieties is not fully documented yet; 452 please, see the examples below and try to adapt the examples to your needs. 455 please, see the examples below and try to adjust the examples to suit your needs.@* 456 The optional int parameter can be used to set plotting quality. 453 457 454 458 ASSUME: -
Singular/LIB/teachstd.lib
r7de8e4 r1a3911 2 2 //GMG, last modified 28.9.01 3 3 /////////////////////////////////////////////////////////////////////////////// 4 version="$Id: teachstd.lib,v 1.1 0 2009-02-12 13:57:00 motsakExp $";4 version="$Id: teachstd.lib,v 1.11 2009-04-06 12:39:02 seelisch Exp $"; 5 5 category="Teaching"; 6 6 info=" … … 78 78 { "EXAMPLE:"; echo = 2; 79 79 ring s=0,(x,y,z),(c,dp); 80 leadmonomial((y+z+x+xyz) **2);81 leadmonomial([(y+z+x+xyz) **2,xyz5]);80 leadmonomial((y+z+x+xyz)^2); 81 leadmonomial([(y+z+x+xyz)^2,xyz5]); 82 82 } 83 83 /////////////////////////////////////////////////////////////////////////////// … … 226 226 proc minEcart(T,h) 227 227 "USAGE: minEcart(T,h); T ideal or module, h poly or vector 228 RETURN: element g from T such that leadmonom(g) divides leadmonom(h) 228 RETURN: element g from T such that leadmonom(g) divides leadmonom(h)@* 229 229 ecart(g) is minimal with this property (if T != 0); 230 230 return 0 if T is 0 or h = 0 … … 413 413 RETURN: 1 if product criterion applies in the same module component, 414 414 2 if lead(f) and lead(g) involve different components, 0 else 415 NOTE: if product criterion applies we can delete (f,g) from pairset 415 NOTE: if product criterion applies we can delete (f,g) from pairset. 416 416 This procedure returns 0 if o is given and is a positive integer, or 417 417 you may set the attribute \"default_arg\" for prodcrit to 1. … … 500 500 RETURN: list L, 501 501 L[1] = the pairset of G as list (not containing pairs for 502 which the product or the chain criterion applies) 502 which the product or the chain criterion applies), 503 503 L[2] = intvec v, v[1]= # product criterion, v[2]= # chain criterion 504 504 EXAMPLE: example pairset; shows an example … … 572 572 /////////////////////////////////////////////////////////////////////////////// 573 573 proc updatePairs(P,S,h) 574 "USAGE: updatePairs(P,S,h); P list, S ideal or module, h poly or vector 574 "USAGE: updatePairs(P,S,h); P list, S ideal or module, h poly or vector@* 575 575 P a list of pairs of polys or vectors (obtained from pairset) 576 576 RETURN: list Q, 577 577 Q[1] = the pairset P enlarged by all pairs (f,h), f from S, 578 without pairs for which the product or the chain criterion applies 578 without pairs for which the product or the chain criterion applies@* 579 579 Q[2] = intvec v, v[1]= # product criterion, v[2]= # chain criterion 580 580 EXAMPLE: example updatePairs; shows an example … … 745 745 /////////////////////////////////////////////////////////////////////////////// 746 746 proc localstd (id) 747 "USAGE: localstd 747 "USAGE: localstd(id); id = ideal 748 748 RETURN: A standard basis for a local degree ordering, using Lazard's method. 749 749 NOTE: The procedure homogenizes id w.r.t. a new 1st variable local@t, -
Singular/LIB/weierstr.lib
r7de8e4 r1a3911 1 1 //GMG, last modified 28.10.2001 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: weierstr.lib,v 1. 5 2006-11-22 21:42:42 levandovExp $";3 version="$Id: weierstr.lib,v 1.6 2009-04-06 12:39:02 seelisch Exp $"; 4 4 category="Teaching"; 5 5 info=" … … 49 49 say T; if not use the procedure lastvarGeneral first 50 50 PURPOSE: perform the Weierstrass division of g by f up to order d 51 RETURN: a list, say l, of two polynomials and an interer, such that 52 g = l[1]*f + l[2], deg_T(l[2]) < b 53 up to (including) total degree d 54 l[3] is the number of iterations used 55 if f is not T-general, return (0,g) 51 RETURN: - a list, say l, of two polynomials and an integer, such that@* 52 g = l[1]*f + l[2], deg_T(l[2]) < b, up to (including) total degree d@* 53 - l[3] is the number of iterations used 54 - if f is not T-general, return (0,g) 56 55 NOTE: the procedure works for any monomial ordering 57 56 THEORY: the proof of Grauert-Remmert (Analytische Stellenalgebren) is used … … 143 142 say T; if not apply the procedure lastvarGeneral first 144 143 PURPOSE: perform the Weierstrass preparation of f up to order d 145 RETURN: a list, say l, of two polynomials and one integer,144 RETURN: - a list, say l, of two polynomials and one integer, 146 145 l[1] a unit, l[2] a Weierstrass polynomial, l[3] an integer 147 146 such that l[1]*f = l[2], where l[2] is a Weierstrass polynomial, 148 147 (i.e. l[2] = T^b + lower terms in T) up to (including) total degree d 149 l[3] is the number of iterations used 150 if f is not T-general, return (0,0)148 l[3] is the number of iterations used@* 149 - if f is not T-general, return (0,0) 151 150 NOTE: the procedure works for any monomial ordering 152 151 THEORY: the proof of Grauert-Remmert (Analytische Stellenalgebren) is used
Note: See TracChangeset
for help on using the changeset viewer.