# Changeset 0bc582c in git

Ignore:
Timestamp:
Apr 6, 2009, 11:17:01 AM (14 years ago)
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
7de8e4cf4e88e60e523f5ebb65a61c114ff3674a
Parents:
bb9471e2e1af065ffce285ee2e4d142ab2d974b0
Message:
```removed some docu bugs prior to release 3-1-0

Location:
Singular/LIB
Files:
8 edited

Unmodified
Removed
• ## Singular/LIB/graphics.lib

 rbb9471 //last change: 13.02.2001 (Eric Westenberger) /////////////////////////////////////////////////////////////////////////////// version="\$Id: graphics.lib,v 1.12 2008-12-12 17:22:35 Singular Exp \$"; version="\$Id: graphics.lib,v 1.13 2009-04-06 09:17:01 seelisch Exp \$"; category="Visualization"; info=" LIBRARY: graphics.lib    Procedures to use Graphics with Mathematica LIBRARY: graphics.lib    Procedures for graphical output using Mathematica AUTHOR:   Christian Gorzel, gorzelc@math.uni-muenster.de /////////////////////////////////////////////////////////////////////////////// proc staircase(string fname,ideal I) "USAGE:   staircase(s,I); s a string, I ideal in two variables proc staircase(ideal I) "USAGE:   staircase(I); I an ideal in two variables RETURN:  string with Mathematica input for displaying staircase diagrams of an ideal I, i.e. exponent vectors of the initial ideal of I NOTE:    ideal I should be given by a standard basis. Let s=\"\" and copy and NOTE:    ideal I should be given by a standard basis. Copy and paste the result into a Mathematica notebook. EXAMPLE: example staircase; shows an example ring r0 = 0,(x,y),ls; ideal I = -1x2y6-1x4y2, 7x6y5+1/2x7y4+6x4y6; staircase("",std(I)); staircase(std(I)); ring r1 = 0,(x,y),dp; ideal I = fetch(r0,I); staircase("",std(I)); staircase(std(I)); ring r2 = 0,(x,y),wp(2,3); ideal I = fetch(r0,I); staircase("",std(I)); staircase(std(I)); // Paste the output into a Mathematica notebook
• ## Singular/LIB/ntsolve.lib

 rbb9471 //(GMG, last modified 16.12.00) /////////////////////////////////////////////////////////////////////////////// version="\$Id: ntsolve.lib,v 1.15 2006-07-18 15:48:29 Singular Exp \$"; version="\$Id: ntsolve.lib,v 1.16 2009-04-06 09:17:01 seelisch Exp \$"; category="Symbolic-numerical solving"; info=" gls: contains the equations, for which a solution will be computed@* ini: ideal of initial values (approximate solutions to start with),@* ipar: control integers (default: ipar = 100,10) ipar: control integers (default: ipar = [100, 10]) @format ipar[1]: max. number of iterations ipar[2]: accuracy (we have the l_2-norm ||.||): accept solution @code{sol} ipar[2]: accuracy (we have the l_2-norm ||.||): accepts solution @code{sol} if ||gls(sol)|| < eps0*(0.1^ipar[2]) where eps0 = ||gls(ini)|| is the initial error a:   ideal of numbers, coordinates of an approximation of a common zero of G to start with (with a[i] to be substituted in var(i)),@* ipar: control integer vector (default: ipar = 100,10) ipar: control integer vector (default: ipar = [100, 10]) @format ipar[1]: max. number of iterations ipar[2]: accuracy (we have as norm |.| absolute value ): accept solution @code{sol} if |G(sol)| < |G(a)|*(0.1^ipar[2]). accepts solution @code{sol} if |G(sol)| < |G(a)|*(0.1^ipar[2]). @end format RETURN:  an ideal, coordinates of a better approximation of a zero of G
• ## Singular/LIB/presolve.lib

 rbb9471 /////////////////////////////////////////////////////////////////////////////// version="\$Id: presolve.lib,v 1.28 2009-02-20 09:26:50 Singular Exp \$"; version="\$Id: presolve.lib,v 1.29 2009-04-06 09:17:01 seelisch Exp \$"; category="Symbolic-numerical solving"; info=" @format L[1]: ideal obtained from i by substituting from the first n variables those which appear in a linear part of i, by putting this part into triangular which appear in a linear part of i, by putting this part into triangular form L[2]: ideal of variables which have been substituted k[x(1..m)]/i -> k[..variables from [4]..]/[1] @end format NOTE:    Applying elimpart to interred(i) may result in more sbstitutions. NOTE:    Applying elimpart to interred(i) may result in more substitutions. However, interred may be more expansive than elimpart for big ideals EXAMPLE: example elimpart; shows an example proc fastelim (ideal i, poly p, list #) "USAGE:   fastelim(i,p[h,o,a,b,e,m]); i=ideal, p=polynomial; h,o,a,b,e=integers "USAGE:   fastelim(i,p[h,o,a,b,e,m]); i=ideal, p=polynomial; h,o,a,b,e=integers@* p: product of variables to be eliminated;@* Optional parameters: proc hilbvec (@id, list #) "USAGE:   hilbvec(id[,c,o]); id=poly/ideal/vector/module/matrix, c,o=strings,@* c=char, o=ordering used by @code{hilb}@* (default: c=\"32003\", o=\"dp\") RETURN:  intvec of 1-st Hilbert-series of id, computed in char c and ordering o c=char, o=ordering used by @code{hilb} (default: c=\"32003\", o=\"dp\") RETURN:  intvec of 1st Hilbert-series of id, computed in char c and ordering o NOTE:    id must be homogeneous (i.e. all vars have weight 1) EXAMPLE: example hilbvec; shows an example proc solvelinearpart (id,list #) "USAGE:   solvelinearpart(id [,n] );  id=ideal/module, n=integer,@* (default: n=0) "USAGE:   solvelinearpart(id [,n] );  id=ideal/module, n=integer (default: n=0) RETURN:  (interreduced) generators of id of degree <=1 in reduced triangular form if n=0 [non-reduced triangular form if n!=0] ASSUME:  monomial ordering is a global ordering (p-ordering) NOTE:    may be used to solve a system of linear equations NOTE:    may be used to solve a system of linear equations, see @code{gauss_row} from 'matrix.lib' for a different method WARNING: the result is very likely to be false for 'real' coefficients, use - ni controls the sorting in i-th block (= vars occuring in pi): ni=0 (resp. ni!=0) means that least complex (resp. most complex) vars come first @* first - oi and mi define the monomial ordering of the i-th block: if mi =0, oi=ordstr(i-th block) id=poly/ideal/vector/module,@* p1,p2,...= polynomials (product of vars),@* n1,n2,...=integers@* n1,n2,...= integers@* (default: p1=product of all vars, n1=0) the last pi (containing the remaining vars) may be omitted ni=0 (resp. ni!=0) means that less (resp. more) complex vars come first [2]: a list with 4 entries for each pi: ideal ai : vars of pi in correct order, intvec vi: permutation vector describing the ordering in ai, intmat Mi: valuation matrix of ai, the columns of Mi being the _[1]: ideal ai : vars of pi in correct order, _[2]: intvec vi: permutation vector describing the ordering in ai, _[3]: intmat Mi: valuation matrix of ai, the columns of Mi being the valuation vectors of the vars in ai intvec wi: size of 1-st, 2-nd,... block of identical columns of Mi _[4]: intvec wi: size of 1-st, 2-nd,... block of identical columns of Mi (vars with same valuation) @end format ni controls the ordering of vars occuring in pi: ni=0 (resp. ni!=0) means that less (resp. more) complex vars come first@* (default: p1=product of all vars, n1=0) means that less (resp. more) complex vars come first (default: p1=product of all vars, n1=0),@* the last pi (containing the remaining vars) may be omitted COMPUTE: valuation (complexity) of variables with respect to id.@*
• ## Singular/LIB/ring.lib

 rbb9471 /////////////////////////////////////////////////////////////////////////////// version="\$Id: ring.lib,v 1.32 2008-03-25 15:20:08 Singular Exp \$"; version="\$Id: ring.lib,v 1.33 2009-04-06 09:17:01 seelisch Exp \$"; category="General purpose"; info=" If, however, a and b are local to a proc calling extendring, the intvec iv must be used to let extendring know the values of a and b @*        -  If an intvec iv !=0 is given, iv[1],iv[2],... is taken for the @*        -  If a non-zero intvec iv is given, iv[1],iv[2],... are taken for the 1st, 2nd,... block of o, if o contains no substring \"w\" or \"W\" i.e. no weighted ordering (in the above case o=\"ds,dp,ls\" allowed) iv[1] is taken as size for the weight-vector, the next iv[1] values of iv are taken as weights and the remaining values of iv as block-size for the remaining non-weighted blocks. iv as block size for the remaining non-weighted blocks. e.g. o=\"dp,ws,Dp,ds\", iv=3,2,3,4,2,5 creates the ordering dp(2),ws(2,3,4),Dp(5),ds proc fetchall (R, list #) "USAGE:   fetchall(R[,s]);  R=ring/qring, s=string CREATE:  fetch all objects of ring R (of type poly/ideal/vector/module/number/ matrix) into the basering. CREATE:  fetch all objects of ring R (of type poly/ideal/vector/module/number/matrix) into the basering. If no 2nd argument is present, the names are the same as in R. If, say, f is a poly in R and the 2nd argument is the string \"R\", then f is maped to f_R etc. is mapped to f_R etc. RETURN:  no return value NOTE:    As fetch, this procedure maps the 1st, 2nd, ... variable of R to the proc imapall (R, list #) "USAGE:   imapall(R[,s]);  R=ring/qring, s=string CREATE:  map all objects of ring R (of type poly/ideal/vector/module/number/ matrix) into the basering, by applying imap to all objects of R. CREATE:  map all objects of ring R (of type poly/ideal/vector/module/number/matrix) into the basering by applying imap to all objects of R. If no 2nd argument is present, the names are the same as in R. If, say, f is a poly in R and the 3rd argument is the string \"R\", then f is maped to f_R etc. is mapped to f_R etc. RETURN:  no return value NOTE:    As imap, this procedure maps the variables of R to the variables with the same name in the basering, the other variables are maped to 0. the same name in the basering, the other variables are mapped to 0. The 2nd argument is useful in order to avoid conflicts of names, the empty string is allowed "USAGE:   mapall(R,i[,s]);  R=ring/qring, i=ideal of basering, s=string CREATE:  map all objects of ring R (of type poly/ideal/vector/module/number/ matrix, map) into the basering, by mapping the jth variable of R to the jth generator of the ideal i. If no 3rd argument is present, the matrix, map) into the basering by mapping the j-th variable of R to the j-th generator of the ideal i. If no 3rd argument is present, the names are the same as in R. If, say, f is a poly in R and the 3rd argument is the string \"R\", then f is maped to f_R etc. argument is the string \"R\", then f is mapped to f_R etc. RETURN:  no return value. NOTE:    This procedure has the same effect as defining a map, say psi, by //   j; print(M); phi;    //phi maps R to S: x->c2, y->a2, z->b2 //   ideal i1=a2,a+b,1; //   mapall(R,i1,\"\");   //map from R to S: x->a2, y->a+b, z->1 //   mapall(R,i1,\"\");     //map from R to S: x->a2, y->a+b, z->1 //   names(S); //   j_; print(M_); phi_; //   changevar(\"T\",\"x()\",R);  //change vars in R and call result T //   mapall(R,maxideal(1));       //identity map from R to T //   mapall(R,maxideal(1));   //identity map from R to T //   names(T); //   j; print(M); phi; def S=changevar("x,y,z");       //change vars of s setring S; qring qS =std(fetch(s,i));      //create qring of S mod i (maped to S) qring qS =std(fetch(s,i));      //create qring of S mod i (mapped to S) def T=changevar("d,e,f,g,h",t); //change vars of t setring T; all input parameters of type string RETURN:  ideal PURPOSE: computes the preimage of an ideal under a given map for non-global PURPOSE: compute the preimage of an ideal under a given map for non-global orderings. The second argument has to be the name of a map from the basering to The 2nd argument has to be the name of a map from the basering to the given ring (or the name of an ideal defining such a map), and the ideal has to be an ideal in the given ring.
• ## Singular/LIB/signcond.lib

 rbb9471 // \$Id: signcond.lib,v 1.7 2006-07-18 15:48:30 Singular Exp \$ // \$Id: signcond.lib,v 1.8 2009-04-06 09:17:01 seelisch Exp \$ // E. Tobis  12.Nov.2004 // last change 5. May 2005 (G.-M. Greuel) proc firstoct(ideal I) "USAGE:    firstoct(i); i ideal RETURN:   number: the number of points of V(i) lying in the first octant ASSUME:   i is a Groebner basis "USAGE:    firstoct(I); I ideal RETURN:   number: the number of points of V(I) lying in the first octant ASSUME:   I is given by a Groebner basis. SEE ALSO: signcnd EXAMPLE:  example firstoct; shows an example" give rise to the sign condition expressed by the same position on the first list. See the example for further explanation of the output. ASSUME:    I is a Groebner basis NOTE:      The procedure psigncnd performs some pretty printing of this output See the example for further explanations of the output. ASSUME:    I is a Groebner basis. NOTE:      The procedure psigncnd performs some pretty printing of this output. SEE ALSO:  firstoct, psigncnd EXAMPLE:   example signcnd; shows an example"
• ## Singular/LIB/solve.lib

 rbb9471 /////////////////////////////////////////////////////////////////////////////// version="\$Id: solve.lib,v 1.37 2009-01-06 14:15:21 Singular Exp \$"; version="\$Id: solve.lib,v 1.38 2009-04-06 09:17:01 seelisch Exp \$"; category="Symbolic-numerical solving"; info=" proc laguerre_solve( poly f, list # ) "USAGE:   laguerre_solve(f [, m, l, n, s] ); f = polynomial,@* m, l, n, s = integers (control parameters of the method) m, l, n, s = integers (control parameters of the method)@* m: precision of output in digits ( 4 <= m), if basering is not ring of complex numbers; l: precision of internal computation in decimal digits ( l >=8 ) only if the basering is not complex or complex with smaller precision; only if the basering is not complex or complex with smaller precision;@* n: control of multiplicity of roots or of splitting of f into squarefree factors { if(charstr(rn)=="0"){dbprint(prot,"// polynomial is squarefree");} else{dbprint(prot,"// split without result");} else{dbprint(prot,"//split without result");} } } proc solve( ideal G, list # ) "USAGE:   solve(G [, m, n [, l]] [,\"oldring\"] [,\"nodisplay\"] ); G = ideal, m, n, l = integers (control parameters of the method), outR ring m, n, l = integers (control parameters of the method), outR ring,@* m: precision of output in digits ( 4 <= m) and of the generated ring of complex numbers; proc mp_res_mat( ideal i, list # ) "USAGE:   mp_res_mat(i [, k] ); i ideal, k integer, k=0: sparse resultant matrix of Gelfand, Kapranov and Zelevinsky, k=0: sparse resultant matrix of Gelfand, Kapranov and Zelevinsky,@* k=1: resultant matrix of Macaulay (k=0 is default) ASSUME:  The number of elements in the input system must be the number of proc triang_solve( list lfi, int prec, list # ) "USAGE:   triang_solve(l,p [,d] ); l=list, p,d=integers@* l a list of finitely many triangular systems, such that the union of l is a list of finitely many triangular systems, such that the union of their varieties equals the variety of the initial ideal.@* p>0: gives precision of complex numbers in digits,@*
• ## Singular/LIB/triang.lib

 rbb9471 //last change: 13.02.2001 (Eric Westenberger) ////////////////////////////////////////////////////////////////////////////// version="\$Id: triang.lib,v 1.12 2008-10-01 14:20:22 Singular Exp \$"; version="\$Id: triang.lib,v 1.13 2009-04-06 09:17:01 seelisch Exp \$"; category="Symbolic-numerical solving"; info=" If i = 2, then each polynomial of the triangular systems is factorized. NOTE:    Algorithm of Moeller (see: Moeller, H.M.: On decomposing systems of polynomial equations with finitely many solutions, Appl. Algebra Eng. Commun. Comput. 4, 217 - 230, 1993). NOTE:    Algorithm of Moeller (see: Moeller, H.M.: On decomposing systems of polynomial equations with finitely many solutions, Appl. Algebra Eng. Commun. Comput. 4, 217 - 230, 1993). EXAMPLE: example triangM; shows an example "
• ## Singular/LIB/zeroset.lib

 rbb9471 // Last change 12.02.2001 (Eric Westenberger) /////////////////////////////////////////////////////////////////////////////// version="\$Id: zeroset.lib,v 1.18 2008-10-09 09:31:58 Singular Exp \$"; version="\$Id: zeroset.lib,v 1.19 2009-04-06 09:17:01 seelisch Exp \$"; category="Symbolic-numerical solving"; info=" LIBRARY:  zeroset.lib      Procedures For Roots and Factorization AUTHOR:   Thomas Bayer,    email: tbayer@mathematik.uni-kl.de http://wwwmayr.informatik.tu-muenchen.de/personen/bayert/ Current Address: Institut fuer Informatik, TU Muenchen LIBRARY:  zeroset.lib      Procedures for roots and factorization AUTHOR:   Thomas Bayer,    email: tbayer@mathematik.uni-kl.de,@* http://wwwmayr.informatik.tu-muenchen.de/personen/bayert/@* Current address: Hochschule Ravensburg-Weingarten OVERVIEW: of Singular for univariate factorization of polynomials over simple algebraic extensions in characteristic 0. NOTE: Subprocedures with postfix 'Main' require that the ring contains a variable 'a' and no parameters, and the ideal 'mpoly', where 'minpoly' from the PROCEDURES: Quotient(f, g)    quotient q  of f w.r.t. g (in f = q*g + remainder) Remainder(f,g)    remainder of the division of f by g Roots(f)    computes all roots of f in an extension field of Q SQFRNorm(f)    norm of f (f must be squarefree) ZeroSet(I)    zero-set of the 0-dim. ideal I quotient(f, g)    quotient q  of f w.r.t. g (in f = q*g + remainder) remainder(f,g)    remainder of the division of f by g roots(f)    computes all roots of f in an extension field of Q sqfrNorm(f)    norm of f (f must be squarefree) zeroSet(I)    zero-set of the 0-dim. ideal I AUXILIARY PROCEDURES: EGCDMain(f, g)    gcd over an algebraic extension field of Q FactorMain(f)    factorization of f over an algebraic extension field InvertNumberMain(c)  inverts an element of an algebraic extension field QuotientMain(f, g)  quotient of f w.r.t. g RemainderMain(f,g)  remainder of the division of f by g RootsMain(f)    computes all roots of f, might extend the ground field SQFRNormMain(f)  norm of f (f must be squarefree) ContainedQ(data, f)  f in data ? SameQ(a, b)    a == b (list a,b) egcdMain(f, g)    gcd over an algebraic extension field of Q factorMain(f)    factorization of f over an algebraic extension field invertNumberMain(c)  inverts an element of an algebraic extension field quotientMain(f, g)  quotient of f w.r.t. g remainderMain(f,g)  remainder of the division of f by g rootsMain(f)    computes all roots of f, might extend the ground field sqfrNormMain(f)  norm of f (f must be squarefree) containedQ(data, f)  f in data ? sameQ(a, b)    a == b (list a,b) "; // Improvement : // a main problem is the growth of the coefficients. Try Roots(x7 - 1) // a main problem is the growth of the coefficients. Try roots(x7 - 1) // return ideal mpoly ! // mpoly is not monic, comes from primitive_extra /////////////////////////////////////////////////////////////////////////////// proc Roots(poly f) "USAGE:   Roots(f); where f is a polynomial proc roots(poly f) "USAGE:   roots(f); where f is a polynomial PURPOSE: compute all roots of f in a finite extension of the ground field without multiplicities. @end format ASSUME:  ground field to be Q or a simple extension of Q given by a minpoly EXAMPLE: example  Roots; shows an example EXAMPLE: example  roots; shows an example " { poly f = imap(ROB, f); list result = RootsMain(f);  // find roots of f list result = rootsMain(f);  // find roots of f // store the roots and the new representation of 'a' and transform export(newA); export(f); dbprint(dbPrt," // 'Roots' created a new ring which contains the list 'roots' and // 'roots' created a new ring which contains the list 'roots' and // the polynomials 'f' and 'newA' // To access the roots, newA and the new representation of f, type def R = Roots(f); setring R; roots; newA; f; def R = roots(f); setring R; roots; newA; f; "); return(RON); minpoly = a2+1; poly f = x3 - a; def R1 = Roots(f); def R1 = roots(f); setring R1; minpoly; /////////////////////////////////////////////////////////////////////////////// proc RootsMain(poly f) "USAGE:   RootsMain(f); where f is a polynomial proc rootsMain(poly f) "USAGE:   rootsMain(f); where f is a polynomial PURPOSE: compute all roots of f in a finite extension of the ground field without multiplicities. @format _[1] = roots of f, each entry is a polynomial _[2] = 'newA' - if the ground field is Q(a') and the extension field is Q(a), then 'newA' is the representation of a' in Q(a) _[2] = 'newA' - if the ground field is Q(b) and the extension field is Q(a), then 'newA' is the representation of b in Q(a) _[3] = minpoly of the algebraic extension of the ground field @end format ASSUME:  basering = Q[x,a] ideal mpoly must be defined, it might be 0! NOTE:    might change the ideal mpoly!! EXAMPLE: example  Roots; shows an example EXAMPLE: example  roots; shows an example " { // nonlinear factors are processed later dbprint(dbPrt, "Roots of " + string(f) +  ", minimal polynomial = " + string(mpoly[1])); factorList = FactorMain(f);          // Factorize f dbprint(dbPrt, "roots of " + string(f) +  ", minimal polynomial = " + string(mpoly[1])); factorList = factorMain(f);          // Factorize f dbprint(dbPrt, (" prime factors of f are : " + string(factorList[1]))); linFactors++;        // get the root from the linear factor lc = LeadTerm(fa, 1)[3]; fa = MultPolys(InvertNumberMain(lc), fa); // make factor monic fa = MultPolys(invertNumberMain(lc), fa); // make factor monic roots[linFactors] = var(1) - fa;  // fa is monic !! } // compute the roots of the nonlinear (irreducible, monic) factor f1 of f // by extending the basefield by a' with minimal polynomial f1 // Then call Roots(f1) to find the roots of f1 over the new base field // Then call roots(f1) to find the roots of f1 over the new base field f1 = nlFactors[1]; result[3] = mpoly[1]; oldMinPoly = mpoly[1]; partSol = RootsMain(f1);    // find roots of f1 over extended field partSol = rootsMain(f1);    // find roots of f1 over extended field if(oldMinPoly != partSol[3]) {    // minpoly has changed ? } else {  // more than one nonlinear (irreducible) factor (f_1,...,f_r) // solve each of them by RootsMain(f_i), append their roots // solve each of them by rootsMain(f_i), append their roots // change the minpoly and transform all previously computed // roots if necessary. for(i = 1; i <= size(nlFactors); i = i + 1) { oldMinPoly = mpoly[1]; partSol = RootsMain(nlFactors[i]);    // main work partSol = rootsMain(nlFactors[i]);    // main work nlFactors[i] = 0;        // delete factor result[3] = partSol[3];        // store minpoly /////////////////////////////////////////////////////////////////////////////// proc ZeroSet(ideal I, list #) "USAGE:   ZeroSet(I [,opt] ); I=ideal, opt=integer proc zeroSet(ideal I, list #) "USAGE:   zeroSet(I [,opt] ); I=ideal, opt=integer PURPOSE: compute the zero-set of the zero-dim. ideal I, in a finite extension of the ground field. @format - 'zeroset' is the list of the zeros of the ideal I, each zero is an ideal. - if the ground field is Q(a') and the extension field is Q(a), then 'newA' is the representation of a' in Q(a). - if the ground field is Q(b) and the extension field is Q(a), then 'newA' is the representation of b in Q(a). If the basering contains a parameter 'a' and the minpoly remains unchanged then 'newA' = 'a'. ASSUME:  dim(I) = 0, and ground field to be Q or a simple extension of Q given by a minpoly. OPTIONS: opt = 0 no primary decomposition (default) opt > 0 primary decomposition NOTE:    If I contains an algebraic number (parameter) then 'I' must be OPTIONS: opt = 0: no primary decomposition (default) opt > 0: primary decomposition NOTE:    If I contains an algebraic number (parameter) then I must be transformed w.r.t. 'newA' in the new ring. EXAMPLE: example ZeroSet; shows an example EXAMPLE: example zeroSet; shows an example " { } list result = ZeroSetMain(id, primaryDecQ); list result = zeroSetMain(id, primaryDecQ); // store the zero-set, minimal polynomial and the new representative of 'a' export(newA); dbprint(dbPrt," // 'ZeroSet' created a new ring which contains the list 'zeroset', the ideal // 'zeroSet' created a new ring which contains the list 'zeroset', the ideal // 'id' and the polynomial 'newA'. 'id' is the ideal of the input transformed // w.r.t. 'newA'. // To access the zero-set, 'newA' and the new representation of the ideal, type def R = ZeroSet(I); setring R; zeroset; newA; id; def R = zeroSet(I); setring R; zeroset; newA; id; "); setring RZSB; minpoly = a2 + 1; ideal I = x2 - 1/2, a*z - 1, y - 2; def T = ZeroSet(I); def T = zeroSet(I); setring T; minpoly; /////////////////////////////////////////////////////////////////////////////// proc InvertNumberMain(poly f) "USAGE:   InvertNumberMain(f); where f is a polynomial proc invertNumberMain(poly f) "USAGE:   invertNumberMain(f); where f is a polynomial PURPOSE: compute 1/f if f is a number in Q(a), i.e., f is represented by a polynomial in Q[a]. /////////////////////////////////////////////////////////////////////////////// proc Quotient(poly f, poly g) "USAGE:   Quotient(f, g); where f,g are polynomials; proc quotient(poly f, poly g) "USAGE:   quotient(f, g); where f,g are polynomials; PURPOSE: compute the quotient q and remainder r s.t. f = g*q + r, deg(r) < deg(g) RETURN:  list of polynomials ASSUME:  basering = Q[x] or Q(a)[x] NOTE: outdated, use div/mod instead EXAMPLE: example  Quotient; shows an example EXAMPLE: example  quotient; shows an example " { poly f = imap(QUOB, f); poly g = imap(QUOB, g); list result = QuotientMain(f, g); list result = quotientMain(f, g); setring(QUOB); poly f =  x4 - 2; poly g = x - a; list qr = Quotient(f, g); list qr = quotient(f, g); qr; qr[1]*g + qr[2] - f; } proc QuotientMain(poly f, poly g) "USAGE:   QuotientMain(f, g); where f,g are polynomials proc quotientMain(poly f, poly g) "USAGE:   quotientMain(f, g); where f,g are polynomials PURPOSE: compute the quotient q and remainder r s.th. f = g*q + r, deg(r) < deg(g) RETURN:  list of polynomials this represents the ring Q(a)[x] together with its minimal polynomial. NOTE: outdated, use div/mod instead EXAMPLE: example  Quotient; shows an example EXAMPLE: example  quotient; shows an example " { /////////////////////////////////////////////////////////////////////////////// proc Remainder(poly f, poly g) "USAGE:   Remainder(f, g); where f,g are polynomials proc remainder(poly f, poly g) "USAGE:   remainder(f, g); where f,g are polynomials PURPOSE: compute the remainder of the division of f by g, i.e. a polynomial r s.t. f = g*q + r, deg(r) < deg(g). poly f = imap(REMB, f); poly g = imap(REMB, g); poly h = RemainderMain(f, g); poly h = remainderMain(f, g); setring(REMB); poly f =  x4 - 1; poly g = x3 - 1; Remainder(f, g); } proc RemainderMain(poly f, poly g) "USAGE:   RemainderMain(f, g); where f,g are polynomials remainder(f, g); } proc remainderMain(poly f, poly g) "USAGE:   remainderMain(f, g); where f,g are polynomials PURPOSE: compute the remainder r s.t. f = g*q + r, deg(r) < deg(g) RETURN:  poly lc = LeadTerm(g, 1)[3]; g1 = MultPolys(InvertNumberMain(lc), g);  // make g monic g1 = MultPolys(invertNumberMain(lc), g);  // make g monic return(SimplifyPoly(reduce(f, std(g1)))); /////////////////////////////////////////////////////////////////////////////// proc EGCDMain(poly f, poly g) "USAGE:   EGCDMain(f, g); where f,g are polynomials proc egcdMain(poly f, poly g) "USAGE:   egcdMain(f, g); where f,g are polynomials PURPOSE: compute the polynomial gcd of f and g over Q(a)[x] RETURN:  poly while(r2 != 0) { r  = RemainderMain(r1, r2); r  = remainderMain(r1, r2); r1 = r2; r2 = r; /////////////////////////////////////////////////////////////////////////////// proc SQFRNorm(poly f) "USAGE:   SQFRNorm(f); where f is a polynomial proc sqfrNorm(poly f) "USAGE:   sqfrNorm(f); where f is a polynomial PURPOSE: compute the norm of the squarefree polynomial f in Q(a)[x]. RETURN:  list with 3 entries ASSUME:  f must be squarefree, basering = Q(a)[x] and minpoly != 0. NOTE:    the norm is an element of Q[x] EXAMPLE: example  SQFRNorm; shows an example EXAMPLE: example  sqfrNorm; shows an example " { setring SNR; poly f = imap(SNB, f); list result = SQFRNormMain(f);  // squarefree norm of f list result = sqfrNormMain(f);  // squarefree norm of f setring SNB; minpoly = a2+1; poly f =  x4 - 2*x + 1; SQFRNorm(f); } proc SQFRNormMain(poly f) "USAGE:   SQFRNorm(f); where f is a polynomial sqfrNorm(f); } proc sqfrNormMain(poly f) "USAGE:   sqfrNorm(f); where f is a polynomial PURPOSE: compute the norm of the squarefree polynomial f in Q(a)[x]. RETURN:  list with 3 entries /////////////////////////////////////////////////////////////////////////////// proc FactorMain(poly f) "USAGE:   FactorMain(f); where f is a polynomial proc factorMain(poly f) "USAGE:   factorMain(f); where f is a polynomial PURPOSE: compute the factorization of the squarefree poly f over Q(a)[t], minpoly  = p(a). fac1[1] = 1; fac2[1] = 1; normList = SQFRNormMain(f); normList = sqfrNormMain(f); // print(" factorize : deg = " + string(deg(normList[1], intvec(1,0)))); factorList = factorize(normList[1]);     // factor squarefree norm of f over Q[x] for(i = 2; i <= size(factorList[1]); i = i + 1) { H = factorList[1][i]; h = EGCDMain(H, g); quo_rem = QuotientMain(g, h); h = egcdMain(H, g); quo_rem = quotientMain(g, h); g = quo_rem[1]; fac1[i] = SimplifyPoly(F(h)); /////////////////////////////////////////////////////////////////////////////// proc ZeroSetMain(ideal I, int primDecQ) "USAGE:   ZeroSetMain(ideal I, int opt); ideal I, int opt proc zeroSetMain(ideal I, int primDecQ) "USAGE:   zeroSetMain(ideal I, int opt); ideal I, int opt PURPOSE: compute the zero-set of the zero-dim. ideal I, in a simple extension of the ground field. NOTE:    opt = 0  no primary decomposition opt > 0  use a primary decomposition EXAMPLE: example ZeroSet; shows an example " { // main work is done in ZeroSetMainWork, here the zero-set of each ideal from the // primary decompostion is coputed by menas of ZeroSetMainWork, and then the EXAMPLE: example zeroSet; shows an example " { // main work is done in zeroSetMainWork, here the zero-set of each ideal from the // primary decompostion is coputed by menas of zeroSetMainWork, and then the // minpoly and the parameter representing the algebraic extension are // transformed according to 'newA', i.e., only bookeeping is done. dbPrt = printlevel-voice+2; dbprint(dbPrt, "ZeroSet of " + string(I) + ", minpoly = " + string(minpoly)); dbprint(dbPrt, "zeroSet of " + string(I) + ", minpoly = " + string(minpoly)); n = nvars(basering) - 1; w[n + 1] = 0; if(primDecQ == 0) { return(ZeroSetMainWork(I, w, 0)); } if(primDecQ == 0) { return(zeroSetMainWork(I, w, 0)); } newA = var(n + 1); oldMinPoly = mpoly[1]; dbprint(dbPrt, " ideal#" + string(i) + " of " + string(size(idealList)) + " = " + string(J)); currentSol = ZeroSetMainWork(J, w, 0); currentSol = zeroSetMainWork(J, w, 0); if(oldMinPoly != currentSol[3]) {   // change minpoly and transform solutions /////////////////////////////////////////////////////////////////////////////// proc ZeroSetMainWork(ideal id, intvec wt, int sVars) "USAGE:   ZeroSetMainWork(I, wt, sVars); proc zeroSetMainWork(ideal id, intvec wt, int sVars) "USAGE:   zeroSetMainWork(I, wt, sVars); PURPOSE: compute the zero-set of the zero-dim. ideal I, in a finite extension of the ground field (without multiplicities). // substitute each partial solution in generators and find the // zero set of the resulting ideal by recursive application // of ZeroSetMainWork ! // of zeroSetMainWork ! index = linIndex + nlinIndex; gens = std(SimplifyData(Fsubs(generators)));    // substitute partial solution oldMinPoly = mpoly[1]; partSol = ZeroSetMainWork(gens, wt, size(index) + sVars); partSol = zeroSetMainWork(gens, wt, size(index) + sVars); if(oldMinPoly != partSol[3]) {    // minpoly has changed nrSols++; found++; index[nrSols] = vars[1]; sol[nrSols] = var(vars[1]) - MultPolys(InvertNumberMain(LeadTerm(f, vars[1])[3]), f); sol[nrSols] = var(vars[1]) - MultPolys(invertNumberMain(LeadTerm(f, vars[1])[3]), f); } } proc NonLinearZeroSetMain(ideal I, intvec wt) "USAGE:   ZeroSetMainWork(I, wt, sVars); "USAGE:   NonLinearZeroSetMain(I, wt); PURPOSE: solves the (nonlinear) univariate polynomials in I of the ground field (without multiplicities). export(RIS1); export(mpoly); roots = RootsMain(f); roots = rootsMain(f); // get "old" basering with new minpoly 'sol2' is a list of partial solutions (from 'NonLinearZeroSetMain') ASSUME:  'sol2' is not empty NOTE:    used by 'ZeroSetMainWork' NOTE:    used by 'zeroSetMainWork' { int i, j, k, m; ideal I; for(int i = 1; i <= nvars(basering) - 1; i = i + 1) {    // built subs. map if(ContainedQ(index, i)) { if(containedQ(index, i)) { k++; I[index[k]] = sol[k]; /////////////////////////////////////////////////////////////////////////////// proc ContainedQ(data, f, list #) "USAGE:    ContainedQ(data, f [, opt]); data=list; f=any type, opt=integer proc containedQ(data, f, list #) "USAGE:    containedQ(data, f [, opt]); data=list; f=any type; opt=integer PURPOSE:  test if f is an element of data. RETURN:   int 1 if f contained in data OPTIONS:  opt = 0 : use '==' for comparing f with elements from data@* opt = 1 : use @code{SameQ} for comparing f with elements from data opt = 1 : use @code{sameQ} for comparing f with elements from data " { } else { if(SameQ(f, data[i])) { found = 1;} if(sameQ(f, data[i])) { found = 1;} else {i = i + 1;} } ////////////////////////////////////////////////////////////////////////////// proc SameQ(a, b) "USAGE:    SameQ(a, b); a,b=list/intvec proc sameQ(a, b) "USAGE:    sameQ(a, b); a,b=list/intvec PURPOSE:  test a == b elementwise, i.e., a[i] = b[i]. RETURN:   int
Note: See TracChangeset for help on using the changeset viewer.