Changeset 0bc582c in git
- Timestamp:
- Apr 6, 2009, 11:17:01 AM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 7de8e4cf4e88e60e523f5ebb65a61c114ff3674a
- Parents:
- bb9471e2e1af065ffce285ee2e4d142ab2d974b0
- Location:
- Singular/LIB
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/graphics.lib
rbb9471 r0bc582c 1 1 //last change: 13.02.2001 (Eric Westenberger) 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: graphics.lib,v 1.1 2 2008-12-12 17:22:35 SingularExp $";3 version="$Id: graphics.lib,v 1.13 2009-04-06 09:17:01 seelisch Exp $"; 4 4 category="Visualization"; 5 5 info=" 6 LIBRARY: graphics.lib Procedures to use Graphics withMathematica6 LIBRARY: graphics.lib Procedures for graphical output using Mathematica 7 7 AUTHOR: Christian Gorzel, gorzelc@math.uni-muenster.de 8 8 … … 15 15 /////////////////////////////////////////////////////////////////////////////// 16 16 17 proc staircase( string fname,ideal I)18 "USAGE: staircase( s,I); s a string, Iideal in two variables17 proc staircase(ideal I) 18 "USAGE: staircase(I); I an ideal in two variables 19 19 RETURN: string with Mathematica input for displaying staircase diagrams of an 20 20 ideal I, i.e. exponent vectors of the initial ideal of I 21 NOTE: ideal I should be given by a standard basis. Let s=\"\" and copy and21 NOTE: ideal I should be given by a standard basis. Copy and 22 22 paste the result into a Mathematica notebook. 23 23 EXAMPLE: example staircase; shows an example … … 64 64 ring r0 = 0,(x,y),ls; 65 65 ideal I = -1x2y6-1x4y2, 7x6y5+1/2x7y4+6x4y6; 66 staircase( "",std(I));66 staircase(std(I)); 67 67 68 68 ring r1 = 0,(x,y),dp; 69 69 ideal I = fetch(r0,I); 70 staircase( "",std(I));70 staircase(std(I)); 71 71 72 72 ring r2 = 0,(x,y),wp(2,3); 73 73 ideal I = fetch(r0,I); 74 staircase( "",std(I));74 staircase(std(I)); 75 75 76 76 // Paste the output into a Mathematica notebook -
Singular/LIB/ntsolve.lib
rbb9471 r0bc582c 1 1 //(GMG, last modified 16.12.00) 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: ntsolve.lib,v 1.1 5 2006-07-18 15:48:29 SingularExp $";3 version="$Id: ntsolve.lib,v 1.16 2009-04-06 09:17:01 seelisch Exp $"; 4 4 category="Symbolic-numerical solving"; 5 5 info=" … … 20 20 gls: contains the equations, for which a solution will be computed@* 21 21 ini: ideal of initial values (approximate solutions to start with),@* 22 ipar: control integers (default: ipar = 100,10)22 ipar: control integers (default: ipar = [100, 10]) 23 23 @format 24 24 ipar[1]: max. number of iterations 25 ipar[2]: accuracy (we have the l_2-norm ||.||): accept solution @code{sol}25 ipar[2]: accuracy (we have the l_2-norm ||.||): accepts solution @code{sol} 26 26 if ||gls(sol)|| < eps0*(0.1^ipar[2]) 27 27 where eps0 = ||gls(ini)|| is the initial error … … 262 262 a: ideal of numbers, coordinates of an approximation of a common 263 263 zero of G to start with (with a[i] to be substituted in var(i)),@* 264 ipar: control integer vector (default: ipar = 100,10)264 ipar: control integer vector (default: ipar = [100, 10]) 265 265 @format 266 266 ipar[1]: max. number of iterations 267 267 ipar[2]: accuracy (we have as norm |.| absolute value ): 268 accept solution @code{sol} if |G(sol)| < |G(a)|*(0.1^ipar[2]).268 accepts solution @code{sol} if |G(sol)| < |G(a)|*(0.1^ipar[2]). 269 269 @end format 270 270 RETURN: an ideal, coordinates of a better approximation of a zero of G -
Singular/LIB/presolve.lib
rbb9471 r0bc582c 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: presolve.lib,v 1.2 8 2009-02-20 09:26:50 SingularExp $";2 version="$Id: presolve.lib,v 1.29 2009-04-06 09:17:01 seelisch Exp $"; 3 3 category="Symbolic-numerical solving"; 4 4 info=" … … 164 164 @format 165 165 L[1]: ideal obtained from i by substituting from the first n variables those 166 which appear in a linear part of i, by putting this part into triangular 166 which appear in a linear part of i, by putting this part into triangular 167 167 form 168 168 L[2]: ideal of variables which have been substituted … … 326 326 k[x(1..m)]/i -> k[..variables from [4]..]/[1] 327 327 @end format 328 NOTE: Applying elimpart to interred(i) may result in more s bstitutions.328 NOTE: Applying elimpart to interred(i) may result in more substitutions. 329 329 However, interred may be more expansive than elimpart for big ideals 330 330 EXAMPLE: example elimpart; shows an example … … 561 561 562 562 proc fastelim (ideal i, poly p, list #) 563 "USAGE: fastelim(i,p[h,o,a,b,e,m]); i=ideal, p=polynomial; h,o,a,b,e=integers 563 "USAGE: fastelim(i,p[h,o,a,b,e,m]); i=ideal, p=polynomial; h,o,a,b,e=integers@* 564 564 p: product of variables to be eliminated;@* 565 565 Optional parameters: … … 871 871 proc hilbvec (@id, list #) 872 872 "USAGE: hilbvec(id[,c,o]); id=poly/ideal/vector/module/matrix, c,o=strings,@* 873 c=char, o=ordering used by @code{hilb}@* 874 (default: c=\"32003\", o=\"dp\") 875 RETURN: intvec of 1-st Hilbert-series of id, computed in char c and ordering o 873 c=char, o=ordering used by @code{hilb} (default: c=\"32003\", o=\"dp\") 874 RETURN: intvec of 1st Hilbert-series of id, computed in char c and ordering o 876 875 NOTE: id must be homogeneous (i.e. all vars have weight 1) 877 876 EXAMPLE: example hilbvec; shows an example … … 969 968 970 969 proc solvelinearpart (id,list #) 971 "USAGE: solvelinearpart(id [,n] ); id=ideal/module, n=integer,@* 972 (default: n=0) 970 "USAGE: solvelinearpart(id [,n] ); id=ideal/module, n=integer (default: n=0) 973 971 RETURN: (interreduced) generators of id of degree <=1 in reduced triangular 974 972 form if n=0 [non-reduced triangular form if n!=0] 975 973 ASSUME: monomial ordering is a global ordering (p-ordering) 976 NOTE: may be used to solve a system of linear equations 974 NOTE: may be used to solve a system of linear equations, 977 975 see @code{gauss_row} from 'matrix.lib' for a different method 978 976 WARNING: the result is very likely to be false for 'real' coefficients, use … … 1036 1034 - ni controls the sorting in i-th block (= vars occuring in pi): 1037 1035 ni=0 (resp. ni!=0) means that least complex (resp. most complex) vars come 1038 first @*1036 first 1039 1037 - oi and mi define the monomial ordering of the i-th block: 1040 1038 if mi =0, oi=ordstr(i-th block) … … 1118 1116 id=poly/ideal/vector/module,@* 1119 1117 p1,p2,...= polynomials (product of vars),@* 1120 n1,n2,...= integers@*1118 n1,n2,...= integers@* 1121 1119 (default: p1=product of all vars, n1=0) 1122 1120 the last pi (containing the remaining vars) may be omitted … … 1128 1126 ni=0 (resp. ni!=0) means that less (resp. more) complex vars come first 1129 1127 [2]: a list with 4 entries for each pi: 1130 ideal ai : vars of pi in correct order,1131 intvec vi: permutation vector describing the ordering in ai,1132 intmat Mi: valuation matrix of ai, the columns of Mi being the1128 _[1]: ideal ai : vars of pi in correct order, 1129 _[2]: intvec vi: permutation vector describing the ordering in ai, 1130 _[3]: intmat Mi: valuation matrix of ai, the columns of Mi being the 1133 1131 valuation vectors of the vars in ai 1134 intvec wi: size of 1-st, 2-nd,... block of identical columns of Mi1132 _[4]: intvec wi: size of 1-st, 2-nd,... block of identical columns of Mi 1135 1133 (vars with same valuation) 1136 1134 @end format … … 1183 1181 1184 1182 ni controls the ordering of vars occuring in pi: ni=0 (resp. ni!=0) 1185 means that less (resp. more) complex vars come first@* 1186 (default: p1=product of all vars, n1=0) 1183 means that less (resp. more) complex vars come first (default: p1=product of all vars, n1=0),@* 1187 1184 the last pi (containing the remaining vars) may be omitted 1188 1185 COMPUTE: valuation (complexity) of variables with respect to id.@* -
Singular/LIB/ring.lib
rbb9471 r0bc582c 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: ring.lib,v 1.3 2 2008-03-25 15:20:08 SingularExp $";2 version="$Id: ring.lib,v 1.33 2009-04-06 09:17:01 seelisch Exp $"; 3 3 category="General purpose"; 4 4 info=" … … 279 279 If, however, a and b are local to a proc calling extendring, the 280 280 intvec iv must be used to let extendring know the values of a and b 281 @* - If a n intvec iv !=0 is given, iv[1],iv[2],... istaken for the281 @* - If a non-zero intvec iv is given, iv[1],iv[2],... are taken for the 282 282 1st, 2nd,... block of o, if o contains no substring \"w\" or \"W\" 283 283 i.e. no weighted ordering (in the above case o=\"ds,dp,ls\" … … 286 286 allowed) iv[1] is taken as size for the weight-vector, the next 287 287 iv[1] values of iv are taken as weights and the remaining values of 288 iv as block -size for the remaining non-weighted blocks.288 iv as block size for the remaining non-weighted blocks. 289 289 e.g. o=\"dp,ws,Dp,ds\", iv=3,2,3,4,2,5 creates the ordering 290 290 dp(2),ws(2,3,4),Dp(5),ds … … 416 416 proc fetchall (R, list #) 417 417 "USAGE: fetchall(R[,s]); R=ring/qring, s=string 418 CREATE: fetch all objects of ring R (of type poly/ideal/vector/module/number/ 419 matrix)into the basering.418 CREATE: fetch all objects of ring R (of type poly/ideal/vector/module/number/matrix) 419 into the basering. 420 420 If no 2nd argument is present, the names are the same as in R. If, 421 421 say, f is a poly in R and the 2nd argument is the string \"R\", then f 422 is map ed to f_R etc.422 is mapped to f_R etc. 423 423 RETURN: no return value 424 424 NOTE: As fetch, this procedure maps the 1st, 2nd, ... variable of R to the … … 462 462 proc imapall (R, list #) 463 463 "USAGE: imapall(R[,s]); R=ring/qring, s=string 464 CREATE: map all objects of ring R (of type poly/ideal/vector/module/number/ 465 matrix) into the basering,by applying imap to all objects of R.464 CREATE: map all objects of ring R (of type poly/ideal/vector/module/number/matrix) 465 into the basering by applying imap to all objects of R. 466 466 If no 2nd argument is present, the names are the same as in R. If, 467 467 say, f is a poly in R and the 3rd argument is the string \"R\", then f 468 is map ed to f_R etc.468 is mapped to f_R etc. 469 469 RETURN: no return value 470 470 NOTE: As imap, this procedure maps the variables of R to the variables with 471 the same name in the basering, the other variables are map ed to 0.471 the same name in the basering, the other variables are mapped to 0. 472 472 The 2nd argument is useful in order to avoid conflicts of names, the 473 473 empty string is allowed … … 509 509 "USAGE: mapall(R,i[,s]); R=ring/qring, i=ideal of basering, s=string 510 510 CREATE: map all objects of ring R (of type poly/ideal/vector/module/number/ 511 matrix, map) into the basering , by mapping the jth variable of R to512 the j th generator of the ideal i. If no 3rd argument is present, the511 matrix, map) into the basering by mapping the j-th variable of R to 512 the j-th generator of the ideal i. If no 3rd argument is present, the 513 513 names are the same as in R. If, say, f is a poly in R and the 3rd 514 argument is the string \"R\", then f is map ed to f_R etc.514 argument is the string \"R\", then f is mapped to f_R etc. 515 515 RETURN: no return value. 516 516 NOTE: This procedure has the same effect as defining a map, say psi, by … … 549 549 // j; print(M); phi; //phi maps R to S: x->c2, y->a2, z->b2 550 550 // ideal i1=a2,a+b,1; 551 // mapall(R,i1,\"\"); //map from R to S: x->a2, y->a+b, z->1551 // mapall(R,i1,\"\"); //map from R to S: x->a2, y->a+b, z->1 552 552 // names(S); 553 553 // j_; print(M_); phi_; 554 554 // changevar(\"T\",\"x()\",R); //change vars in R and call result T 555 // mapall(R,maxideal(1)); 555 // mapall(R,maxideal(1)); //identity map from R to T 556 556 // names(T); 557 557 // j; print(M); phi; … … 645 645 def S=changevar("x,y,z"); //change vars of s 646 646 setring S; 647 qring qS =std(fetch(s,i)); //create qring of S mod i (map ed to S)647 qring qS =std(fetch(s,i)); //create qring of S mod i (mapped to S) 648 648 def T=changevar("d,e,f,g,h",t); //change vars of t 649 649 setring T; … … 687 687 all input parameters of type string 688 688 RETURN: ideal 689 PURPOSE: compute sthe preimage of an ideal under a given map for non-global689 PURPOSE: compute the preimage of an ideal under a given map for non-global 690 690 orderings. 691 The second argument has to be the name of a map from the basering to691 The 2nd argument has to be the name of a map from the basering to 692 692 the given ring (or the name of an ideal defining such a map), and 693 693 the ideal has to be an ideal in the given ring. -
Singular/LIB/signcond.lib
rbb9471 r0bc582c 1 // $Id: signcond.lib,v 1. 7 2006-07-18 15:48:30 SingularExp $1 // $Id: signcond.lib,v 1.8 2009-04-06 09:17:01 seelisch Exp $ 2 2 // E. Tobis 12.Nov.2004 3 3 // last change 5. May 2005 (G.-M. Greuel) … … 26 26 27 27 proc firstoct(ideal I) 28 "USAGE: firstoct( i); iideal29 RETURN: number: the number of points of V( i) lying in the first octant30 ASSUME: i is a Groebner basis28 "USAGE: firstoct(I); I ideal 29 RETURN: number: the number of points of V(I) lying in the first octant 30 ASSUME: I is given by a Groebner basis. 31 31 SEE ALSO: signcnd 32 32 EXAMPLE: example firstoct; shows an example" … … 80 80 give rise to the sign condition expressed by the same position on 81 81 the first list. 82 See the example for further explanation of the output.83 ASSUME: I is a Groebner basis 84 NOTE: The procedure psigncnd performs some pretty printing of this output 82 See the example for further explanations of the output. 83 ASSUME: I is a Groebner basis. 84 NOTE: The procedure psigncnd performs some pretty printing of this output. 85 85 SEE ALSO: firstoct, psigncnd 86 86 EXAMPLE: example signcnd; shows an example" -
Singular/LIB/solve.lib
rbb9471 r0bc582c 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: solve.lib,v 1.3 7 2009-01-06 14:15:21 SingularExp $";2 version="$Id: solve.lib,v 1.38 2009-04-06 09:17:01 seelisch Exp $"; 3 3 category="Symbolic-numerical solving"; 4 4 info=" … … 28 28 proc laguerre_solve( poly f, list # ) 29 29 "USAGE: laguerre_solve(f [, m, l, n, s] ); f = polynomial,@* 30 m, l, n, s = integers (control parameters of the method) 30 m, l, n, s = integers (control parameters of the method)@* 31 31 m: precision of output in digits ( 4 <= m), if basering is not ring of 32 32 complex numbers; 33 33 l: precision of internal computation in decimal digits ( l >=8 ) 34 only if the basering is not complex or complex with smaller precision; 34 only if the basering is not complex or complex with smaller precision;@* 35 35 n: control of multiplicity of roots or of splitting of f into 36 36 squarefree factors … … 202 202 { 203 203 if(charstr(rn)=="0"){dbprint(prot,"// polynomial is squarefree");} 204 else{dbprint(prot,"// 204 else{dbprint(prot,"//split without result");} 205 205 } 206 206 } … … 517 517 proc solve( ideal G, list # ) 518 518 "USAGE: solve(G [, m, n [, l]] [,\"oldring\"] [,\"nodisplay\"] ); G = ideal, 519 m, n, l = integers (control parameters of the method), outR ring 519 m, n, l = integers (control parameters of the method), outR ring,@* 520 520 m: precision of output in digits ( 4 <= m) and of the generated ring 521 521 of complex numbers; … … 1476 1476 proc mp_res_mat( ideal i, list # ) 1477 1477 "USAGE: mp_res_mat(i [, k] ); i ideal, k integer, 1478 k=0: sparse resultant matrix of Gelfand, Kapranov and Zelevinsky, 1478 k=0: sparse resultant matrix of Gelfand, Kapranov and Zelevinsky,@* 1479 1479 k=1: resultant matrix of Macaulay (k=0 is default) 1480 1480 ASSUME: The number of elements in the input system must be the number of … … 2043 2043 proc triang_solve( list lfi, int prec, list # ) 2044 2044 "USAGE: triang_solve(l,p [,d] ); l=list, p,d=integers@* 2045 l a list of finitely many triangular systems, such that the union of2045 l is a list of finitely many triangular systems, such that the union of 2046 2046 their varieties equals the variety of the initial ideal.@* 2047 2047 p>0: gives precision of complex numbers in digits,@* -
Singular/LIB/triang.lib
rbb9471 r0bc582c 1 1 //last change: 13.02.2001 (Eric Westenberger) 2 2 ////////////////////////////////////////////////////////////////////////////// 3 version="$Id: triang.lib,v 1.1 2 2008-10-01 14:20:22 SingularExp $";3 version="$Id: triang.lib,v 1.13 2009-04-06 09:17:01 seelisch Exp $"; 4 4 category="Symbolic-numerical solving"; 5 5 info=" … … 629 629 If i = 2, then each polynomial of the triangular systems 630 630 is factorized. 631 NOTE: Algorithm of Moeller (see: Moeller, H.M.: 632 On decomposing systems of polynomial equations with 633 finitely many solutions, Appl. Algebra Eng. Commun. Comput. 4, 634 217 - 230, 1993). 631 NOTE: Algorithm of Moeller (see: Moeller, H.M.: On decomposing systems of 632 polynomial equations with finitely many solutions, Appl. Algebra Eng. 633 Commun. Comput. 4, 217 - 230, 1993). 635 634 EXAMPLE: example triangM; shows an example 636 635 " -
Singular/LIB/zeroset.lib
rbb9471 r0bc582c 1 1 // Last change 12.02.2001 (Eric Westenberger) 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: zeroset.lib,v 1.1 8 2008-10-09 09:31:58 SingularExp $";3 version="$Id: zeroset.lib,v 1.19 2009-04-06 09:17:01 seelisch Exp $"; 4 4 category="Symbolic-numerical solving"; 5 5 info=" 6 LIBRARY: zeroset.lib Procedures For Roots and Factorization7 AUTHOR: Thomas Bayer, email: tbayer@mathematik.uni-kl.de 8 http://wwwmayr.informatik.tu-muenchen.de/personen/bayert/ 9 Current Address: Institut fuer Informatik, TU Muenchen6 LIBRARY: zeroset.lib Procedures for roots and factorization 7 AUTHOR: Thomas Bayer, email: tbayer@mathematik.uni-kl.de,@* 8 http://wwwmayr.informatik.tu-muenchen.de/personen/bayert/@* 9 Current address: Hochschule Ravensburg-Weingarten 10 10 11 11 OVERVIEW: … … 18 18 of Singular for univariate factorization of polynomials over simple algebraic 19 19 extensions in characteristic 0. 20 21 NOTE: 20 22 Subprocedures with postfix 'Main' require that the ring contains a variable 21 23 'a' and no parameters, and the ideal 'mpoly', where 'minpoly' from the … … 23 25 24 26 PROCEDURES: 25 Quotient(f, g) quotient q of f w.r.t. g (in f = q*g + remainder)26 Remainder(f,g) remainder of the division of f by g27 Roots(f) computes all roots of f in an extension field of Q28 SQFRNorm(f) norm of f (f must be squarefree)29 ZeroSet(I) zero-set of the 0-dim. ideal I27 quotient(f, g) quotient q of f w.r.t. g (in f = q*g + remainder) 28 remainder(f,g) remainder of the division of f by g 29 roots(f) computes all roots of f in an extension field of Q 30 sqfrNorm(f) norm of f (f must be squarefree) 31 zeroSet(I) zero-set of the 0-dim. ideal I 30 32 31 33 AUXILIARY PROCEDURES: 32 EGCDMain(f, g) gcd over an algebraic extension field of Q33 FactorMain(f) factorization of f over an algebraic extension field34 InvertNumberMain(c) inverts an element of an algebraic extension field35 QuotientMain(f, g) quotient of f w.r.t. g36 RemainderMain(f,g) remainder of the division of f by g37 RootsMain(f) computes all roots of f, might extend the ground field38 SQFRNormMain(f) norm of f (f must be squarefree)39 ContainedQ(data, f) f in data ?40 SameQ(a, b) a == b (list a,b)34 egcdMain(f, g) gcd over an algebraic extension field of Q 35 factorMain(f) factorization of f over an algebraic extension field 36 invertNumberMain(c) inverts an element of an algebraic extension field 37 quotientMain(f, g) quotient of f w.r.t. g 38 remainderMain(f,g) remainder of the division of f by g 39 rootsMain(f) computes all roots of f, might extend the ground field 40 sqfrNormMain(f) norm of f (f must be squarefree) 41 containedQ(data, f) f in data ? 42 sameQ(a, b) a == b (list a,b) 41 43 "; 42 44 … … 57 59 58 60 // Improvement : 59 // a main problem is the growth of the coefficients. Try Roots(x7 - 1)61 // a main problem is the growth of the coefficients. Try roots(x7 - 1) 60 62 // return ideal mpoly ! 61 63 // mpoly is not monic, comes from primitive_extra … … 75 77 /////////////////////////////////////////////////////////////////////////////// 76 78 77 proc Roots(poly f)78 "USAGE: Roots(f); where f is a polynomial79 proc roots(poly f) 80 "USAGE: roots(f); where f is a polynomial 79 81 PURPOSE: compute all roots of f in a finite extension of the ground field 80 82 without multiplicities. … … 91 93 @end format 92 94 ASSUME: ground field to be Q or a simple extension of Q given by a minpoly 93 EXAMPLE: example Roots; shows an example95 EXAMPLE: example roots; shows an example 94 96 " 95 97 { … … 108 110 109 111 poly f = imap(ROB, f); 110 list result = RootsMain(f); // find roots of f112 list result = rootsMain(f); // find roots of f 111 113 112 114 // store the roots and the new representation of 'a' and transform … … 130 132 export(newA); 131 133 export(f); dbprint(dbPrt," 132 // ' Roots' created a new ring which contains the list 'roots' and134 // 'roots' created a new ring which contains the list 'roots' and 133 135 // the polynomials 'f' and 'newA' 134 136 // To access the roots, newA and the new representation of f, type 135 def R = Roots(f); setring R; roots; newA; f;137 def R = roots(f); setring R; roots; newA; f; 136 138 "); 137 139 return(RON); … … 142 144 minpoly = a2+1; 143 145 poly f = x3 - a; 144 def R1 = Roots(f);146 def R1 = roots(f); 145 147 setring R1; 146 148 minpoly; … … 155 157 /////////////////////////////////////////////////////////////////////////////// 156 158 157 proc RootsMain(poly f)158 "USAGE: RootsMain(f); where f is a polynomial159 proc rootsMain(poly f) 160 "USAGE: rootsMain(f); where f is a polynomial 159 161 PURPOSE: compute all roots of f in a finite extension of the ground field 160 162 without multiplicities. … … 162 164 @format 163 165 _[1] = roots of f, each entry is a polynomial 164 _[2] = 'newA' - if the ground field is Q( a') and the extension field165 is Q(a), then 'newA' is the representation of a'in Q(a)166 _[2] = 'newA' - if the ground field is Q(b) and the extension field 167 is Q(a), then 'newA' is the representation of b in Q(a) 166 168 _[3] = minpoly of the algebraic extension of the ground field 167 169 @end format 168 170 ASSUME: basering = Q[x,a] ideal mpoly must be defined, it might be 0! 169 171 NOTE: might change the ideal mpoly!! 170 EXAMPLE: example Roots; shows an example172 EXAMPLE: example roots; shows an example 171 173 " 172 174 { … … 182 184 // nonlinear factors are processed later 183 185 184 dbprint(dbPrt, " Roots of " + string(f) + ", minimal polynomial = " + string(mpoly[1]));185 factorList = FactorMain(f); // Factorize f186 dbprint(dbPrt, "roots of " + string(f) + ", minimal polynomial = " + string(mpoly[1])); 187 factorList = factorMain(f); // Factorize f 186 188 dbprint(dbPrt, (" prime factors of f are : " + string(factorList[1]))); 187 189 … … 193 195 linFactors++; // get the root from the linear factor 194 196 lc = LeadTerm(fa, 1)[3]; 195 fa = MultPolys( InvertNumberMain(lc), fa); // make factor monic197 fa = MultPolys(invertNumberMain(lc), fa); // make factor monic 196 198 roots[linFactors] = var(1) - fa; // fa is monic !! 197 199 } … … 227 229 // compute the roots of the nonlinear (irreducible, monic) factor f1 of f 228 230 // by extending the basefield by a' with minimal polynomial f1 229 // Then call Roots(f1) to find the roots of f1 over the new base field231 // Then call roots(f1) to find the roots of f1 over the new base field 230 232 231 233 f1 = nlFactors[1]; … … 247 249 result[3] = mpoly[1]; 248 250 oldMinPoly = mpoly[1]; 249 partSol = RootsMain(f1); // find roots of f1 over extended field251 partSol = rootsMain(f1); // find roots of f1 over extended field 250 252 251 253 if(oldMinPoly != partSol[3]) { // minpoly has changed ? … … 262 264 } 263 265 else { // more than one nonlinear (irreducible) factor (f_1,...,f_r) 264 // solve each of them by RootsMain(f_i), append their roots266 // solve each of them by rootsMain(f_i), append their roots 265 267 // change the minpoly and transform all previously computed 266 268 // roots if necessary. … … 271 273 for(i = 1; i <= size(nlFactors); i = i + 1) { 272 274 oldMinPoly = mpoly[1]; 273 partSol = RootsMain(nlFactors[i]); // main work275 partSol = rootsMain(nlFactors[i]); // main work 274 276 nlFactors[i] = 0; // delete factor 275 277 result[3] = partSol[3]; // store minpoly … … 297 299 /////////////////////////////////////////////////////////////////////////////// 298 300 299 proc ZeroSet(ideal I, list #)300 "USAGE: ZeroSet(I [,opt] ); I=ideal, opt=integer301 proc zeroSet(ideal I, list #) 302 "USAGE: zeroSet(I [,opt] ); I=ideal, opt=integer 301 303 PURPOSE: compute the zero-set of the zero-dim. ideal I, in a finite extension 302 304 of the ground field. … … 306 308 @format 307 309 - 'zeroset' is the list of the zeros of the ideal I, each zero is an ideal. 308 - if the ground field is Q( a') and the extension field is Q(a), then309 'newA' is the representation of a'in Q(a).310 - if the ground field is Q(b) and the extension field is Q(a), then 311 'newA' is the representation of b in Q(a). 310 312 If the basering contains a parameter 'a' and the minpoly remains unchanged 311 313 then 'newA' = 'a'. … … 315 317 ASSUME: dim(I) = 0, and ground field to be Q or a simple extension of Q given 316 318 by a minpoly. 317 OPTIONS: opt = 0 no primary decomposition (default)318 opt > 0 primary decomposition319 NOTE: If I contains an algebraic number (parameter) then 'I'must be319 OPTIONS: opt = 0: no primary decomposition (default) 320 opt > 0: primary decomposition 321 NOTE: If I contains an algebraic number (parameter) then I must be 320 322 transformed w.r.t. 'newA' in the new ring. 321 EXAMPLE: example ZeroSet; shows an example323 EXAMPLE: example zeroSet; shows an example 322 324 " 323 325 { … … 347 349 } 348 350 349 list result = ZeroSetMain(id, primaryDecQ);351 list result = zeroSetMain(id, primaryDecQ); 350 352 351 353 // store the zero-set, minimal polynomial and the new representative of 'a' … … 376 378 export(newA); 377 379 dbprint(dbPrt," 378 // ' ZeroSet' created a new ring which contains the list 'zeroset', the ideal380 // 'zeroSet' created a new ring which contains the list 'zeroset', the ideal 379 381 // 'id' and the polynomial 'newA'. 'id' is the ideal of the input transformed 380 382 // w.r.t. 'newA'. 381 383 // To access the zero-set, 'newA' and the new representation of the ideal, type 382 def R = ZeroSet(I); setring R; zeroset; newA; id;384 def R = zeroSet(I); setring R; zeroset; newA; id; 383 385 "); 384 386 setring RZSB; … … 390 392 minpoly = a2 + 1; 391 393 ideal I = x2 - 1/2, a*z - 1, y - 2; 392 def T = ZeroSet(I);394 def T = zeroSet(I); 393 395 setring T; 394 396 minpoly; … … 404 406 /////////////////////////////////////////////////////////////////////////////// 405 407 406 proc InvertNumberMain(poly f)407 "USAGE: InvertNumberMain(f); where f is a polynomial408 proc invertNumberMain(poly f) 409 "USAGE: invertNumberMain(f); where f is a polynomial 408 410 PURPOSE: compute 1/f if f is a number in Q(a), i.e., f is represented by a 409 411 polynomial in Q[a]. … … 468 470 /////////////////////////////////////////////////////////////////////////////// 469 471 470 proc Quotient(poly f, poly g)471 "USAGE: Quotient(f, g); where f,g are polynomials;472 proc quotient(poly f, poly g) 473 "USAGE: quotient(f, g); where f,g are polynomials; 472 474 PURPOSE: compute the quotient q and remainder r s.t. f = g*q + r, deg(r) < deg(g) 473 475 RETURN: list of polynomials … … 478 480 ASSUME: basering = Q[x] or Q(a)[x] 479 481 NOTE: outdated, use div/mod instead 480 EXAMPLE: example Quotient; shows an example482 EXAMPLE: example quotient; shows an example 481 483 " 482 484 { … … 487 489 poly f = imap(QUOB, f); 488 490 poly g = imap(QUOB, g); 489 list result = QuotientMain(f, g);491 list result = quotientMain(f, g); 490 492 491 493 setring(QUOB); … … 500 502 poly f = x4 - 2; 501 503 poly g = x - a; 502 list qr = Quotient(f, g);504 list qr = quotient(f, g); 503 505 qr; 504 506 qr[1]*g + qr[2] - f; 505 507 } 506 508 507 proc QuotientMain(poly f, poly g)508 "USAGE: QuotientMain(f, g); where f,g are polynomials509 proc quotientMain(poly f, poly g) 510 "USAGE: quotientMain(f, g); where f,g are polynomials 509 511 PURPOSE: compute the quotient q and remainder r s.th. f = g*q + r, deg(r) < deg(g) 510 512 RETURN: list of polynomials … … 516 518 this represents the ring Q(a)[x] together with its minimal polynomial. 517 519 NOTE: outdated, use div/mod instead 518 EXAMPLE: example Quotient; shows an example520 EXAMPLE: example quotient; shows an example 519 521 " 520 522 { … … 532 534 /////////////////////////////////////////////////////////////////////////////// 533 535 534 proc Remainder(poly f, poly g)535 "USAGE: Remainder(f, g); where f,g are polynomials536 proc remainder(poly f, poly g) 537 "USAGE: remainder(f, g); where f,g are polynomials 536 538 PURPOSE: compute the remainder of the division of f by g, i.e. a polynomial r 537 539 s.t. f = g*q + r, deg(r) < deg(g). … … 547 549 poly f = imap(REMB, f); 548 550 poly g = imap(REMB, g); 549 poly h = RemainderMain(f, g);551 poly h = remainderMain(f, g); 550 552 551 553 setring(REMB); … … 560 562 poly f = x4 - 1; 561 563 poly g = x3 - 1; 562 Remainder(f, g);563 } 564 565 proc RemainderMain(poly f, poly g)566 "USAGE: RemainderMain(f, g); where f,g are polynomials564 remainder(f, g); 565 } 566 567 proc remainderMain(poly f, poly g) 568 "USAGE: remainderMain(f, g); where f,g are polynomials 567 569 PURPOSE: compute the remainder r s.t. f = g*q + r, deg(r) < deg(g) 568 570 RETURN: poly … … 579 581 580 582 lc = LeadTerm(g, 1)[3]; 581 g1 = MultPolys( InvertNumberMain(lc), g); // make g monic583 g1 = MultPolys(invertNumberMain(lc), g); // make g monic 582 584 583 585 return(SimplifyPoly(reduce(f, std(g1)))); … … 586 588 /////////////////////////////////////////////////////////////////////////////// 587 589 588 proc EGCDMain(poly f, poly g)589 "USAGE: EGCDMain(f, g); where f,g are polynomials590 proc egcdMain(poly f, poly g) 591 "USAGE: egcdMain(f, g); where f,g are polynomials 590 592 PURPOSE: compute the polynomial gcd of f and g over Q(a)[x] 591 593 RETURN: poly … … 604 606 605 607 while(r2 != 0) { 606 r = RemainderMain(r1, r2);608 r = remainderMain(r1, r2); 607 609 r1 = r2; 608 610 r2 = r; … … 648 650 /////////////////////////////////////////////////////////////////////////////// 649 651 650 proc SQFRNorm(poly f)651 "USAGE: SQFRNorm(f); where f is a polynomial652 proc sqfrNorm(poly f) 653 "USAGE: sqfrNorm(f); where f is a polynomial 652 654 PURPOSE: compute the norm of the squarefree polynomial f in Q(a)[x]. 653 655 RETURN: list with 3 entries … … 659 661 ASSUME: f must be squarefree, basering = Q(a)[x] and minpoly != 0. 660 662 NOTE: the norm is an element of Q[x] 661 EXAMPLE: example SQFRNorm; shows an example663 EXAMPLE: example sqfrNorm; shows an example 662 664 " 663 665 { … … 667 669 setring SNR; 668 670 poly f = imap(SNB, f); 669 list result = SQFRNormMain(f); // squarefree norm of f671 list result = sqfrNormMain(f); // squarefree norm of f 670 672 671 673 setring SNB; … … 679 681 minpoly = a2+1; 680 682 poly f = x4 - 2*x + 1; 681 SQFRNorm(f);682 } 683 684 proc SQFRNormMain(poly f)685 "USAGE: SQFRNorm(f); where f is a polynomial683 sqfrNorm(f); 684 } 685 686 proc sqfrNormMain(poly f) 687 "USAGE: sqfrNorm(f); where f is a polynomial 686 688 PURPOSE: compute the norm of the squarefree polynomial f in Q(a)[x]. 687 689 RETURN: list with 3 entries … … 734 736 /////////////////////////////////////////////////////////////////////////////// 735 737 736 proc FactorMain(poly f)737 "USAGE: FactorMain(f); where f is a polynomial738 proc factorMain(poly f) 739 "USAGE: factorMain(f); where f is a polynomial 738 740 PURPOSE: compute the factorization of the squarefree poly f over Q(a)[t], 739 741 minpoly = p(a). … … 771 773 fac1[1] = 1; 772 774 fac2[1] = 1; 773 normList = SQFRNormMain(f);775 normList = sqfrNormMain(f); 774 776 // print(" factorize : deg = " + string(deg(normList[1], intvec(1,0)))); 775 777 factorList = factorize(normList[1]); // factor squarefree norm of f over Q[x] … … 782 784 for(i = 2; i <= size(factorList[1]); i = i + 1) { 783 785 H = factorList[1][i]; 784 h = EGCDMain(H, g);785 quo_rem = QuotientMain(g, h);786 h = egcdMain(H, g); 787 quo_rem = quotientMain(g, h); 786 788 g = quo_rem[1]; 787 789 fac1[i] = SimplifyPoly(F(h)); … … 793 795 /////////////////////////////////////////////////////////////////////////////// 794 796 795 proc ZeroSetMain(ideal I, int primDecQ)796 "USAGE: ZeroSetMain(ideal I, int opt); ideal I, int opt797 proc zeroSetMain(ideal I, int primDecQ) 798 "USAGE: zeroSetMain(ideal I, int opt); ideal I, int opt 797 799 PURPOSE: compute the zero-set of the zero-dim. ideal I, in a simple extension 798 800 of the ground field. … … 812 814 NOTE: opt = 0 no primary decomposition 813 815 opt > 0 use a primary decomposition 814 EXAMPLE: example ZeroSet; shows an example815 " 816 { 817 // main work is done in ZeroSetMainWork, here the zero-set of each ideal from the818 // primary decompostion is coputed by menas of ZeroSetMainWork, and then the816 EXAMPLE: example zeroSet; shows an example 817 " 818 { 819 // main work is done in zeroSetMainWork, here the zero-set of each ideal from the 820 // primary decompostion is coputed by menas of zeroSetMainWork, and then the 819 821 // minpoly and the parameter representing the algebraic extension are 820 822 // transformed according to 'newA', i.e., only bookeeping is done. … … 829 831 830 832 dbPrt = printlevel-voice+2; 831 dbprint(dbPrt, " ZeroSet of " + string(I) + ", minpoly = " + string(minpoly));833 dbprint(dbPrt, "zeroSet of " + string(I) + ", minpoly = " + string(minpoly)); 832 834 833 835 n = nvars(basering) - 1; … … 835 837 w[n + 1] = 0; 836 838 837 if(primDecQ == 0) { return( ZeroSetMainWork(I, w, 0)); }839 if(primDecQ == 0) { return(zeroSetMainWork(I, w, 0)); } 838 840 839 841 newA = var(n + 1); … … 862 864 oldMinPoly = mpoly[1]; 863 865 dbprint(dbPrt, " ideal#" + string(i) + " of " + string(size(idealList)) + " = " + string(J)); 864 currentSol = ZeroSetMainWork(J, w, 0);866 currentSol = zeroSetMainWork(J, w, 0); 865 867 866 868 if(oldMinPoly != currentSol[3]) { // change minpoly and transform solutions … … 883 885 /////////////////////////////////////////////////////////////////////////////// 884 886 885 proc ZeroSetMainWork(ideal id, intvec wt, int sVars)886 "USAGE: ZeroSetMainWork(I, wt, sVars);887 proc zeroSetMainWork(ideal id, intvec wt, int sVars) 888 "USAGE: zeroSetMainWork(I, wt, sVars); 887 889 PURPOSE: compute the zero-set of the zero-dim. ideal I, in a finite extension 888 890 of the ground field (without multiplicities). … … 958 960 // substitute each partial solution in generators and find the 959 961 // zero set of the resulting ideal by recursive application 960 // of ZeroSetMainWork !962 // of zeroSetMainWork ! 961 963 962 964 index = linIndex + nlinIndex; … … 968 970 gens = std(SimplifyData(Fsubs(generators))); // substitute partial solution 969 971 oldMinPoly = mpoly[1]; 970 partSol = ZeroSetMainWork(gens, wt, size(index) + sVars);972 partSol = zeroSetMainWork(gens, wt, size(index) + sVars); 971 973 972 974 if(oldMinPoly != partSol[3]) { // minpoly has changed … … 1028 1030 nrSols++; found++; 1029 1031 index[nrSols] = vars[1]; 1030 sol[nrSols] = var(vars[1]) - MultPolys( InvertNumberMain(LeadTerm(f, vars[1])[3]), f);1032 sol[nrSols] = var(vars[1]) - MultPolys(invertNumberMain(LeadTerm(f, vars[1])[3]), f); 1031 1033 } 1032 1034 } … … 1050 1052 1051 1053 proc NonLinearZeroSetMain(ideal I, intvec wt) 1052 "USAGE: ZeroSetMainWork(I, wt, sVars);1054 "USAGE: NonLinearZeroSetMain(I, wt); 1053 1055 PURPOSE: solves the (nonlinear) univariate polynomials in I 1054 1056 of the ground field (without multiplicities). … … 1103 1105 export(RIS1); 1104 1106 export(mpoly); 1105 roots = RootsMain(f);1107 roots = rootsMain(f); 1106 1108 1107 1109 // get "old" basering with new minpoly … … 1180 1182 'sol2' is a list of partial solutions (from 'NonLinearZeroSetMain') 1181 1183 ASSUME: 'sol2' is not empty 1182 NOTE: used by ' ZeroSetMainWork'1184 NOTE: used by 'zeroSetMainWork' 1183 1185 { 1184 1186 int i, j, k, m; … … 1211 1213 ideal I; 1212 1214 for(int i = 1; i <= nvars(basering) - 1; i = i + 1) { // built subs. map 1213 if( ContainedQ(index, i)) {1215 if(containedQ(index, i)) { 1214 1216 k++; 1215 1217 I[index[k]] = sol[k]; … … 1266 1268 /////////////////////////////////////////////////////////////////////////////// 1267 1269 1268 proc ContainedQ(data, f, list #)1269 "USAGE: ContainedQ(data, f [, opt]); data=list; f=any type,opt=integer1270 proc containedQ(data, f, list #) 1271 "USAGE: containedQ(data, f [, opt]); data=list; f=any type; opt=integer 1270 1272 PURPOSE: test if f is an element of data. 1271 1273 RETURN: int … … 1273 1275 1 if f contained in data 1274 1276 OPTIONS: opt = 0 : use '==' for comparing f with elements from data@* 1275 opt = 1 : use @code{ SameQ} for comparing f with elements from data1277 opt = 1 : use @code{sameQ} for comparing f with elements from data 1276 1278 " 1277 1279 { … … 1288 1290 } 1289 1291 else { 1290 if( SameQ(f, data[i])) { found = 1;}1292 if(sameQ(f, data[i])) { found = 1;} 1291 1293 else {i = i + 1;} 1292 1294 } … … 1297 1299 ////////////////////////////////////////////////////////////////////////////// 1298 1300 1299 proc SameQ(a, b)1300 "USAGE: SameQ(a, b); a,b=list/intvec1301 proc sameQ(a, b) 1302 "USAGE: sameQ(a, b); a,b=list/intvec 1301 1303 PURPOSE: test a == b elementwise, i.e., a[i] = b[i]. 1302 1304 RETURN: int
Note: See TracChangeset
for help on using the changeset viewer.