source: git/Singular/LIB/polyclass.lib @ a66494

spielwiese
Last change on this file since a66494 was a66494, checked in by Hans Schoenemann <hannes@…>, 6 years ago
fix: for Merge pull request #832 (LIB in mod_init)
  • Property mode set to 100644
File size: 5.6 KB
Line 
1//////////////////////////////////////////////////////////////////////////////
2version="version polyclass.lib 4.1.0.3 Nov_2017 "; // $Id$
3category="Commutative Algebra";
4info="
5LIBRARY: polyclass.lib   Data types for normal form equations
6AUTHORS:               Janko Boehm,      email: boehm@mathematik.uni-kl.de
7                       Magdaleen Marais, email: magdaleen.marais@up.ac.za
8                       Gerhard Pfister,  email: pfister@mathematik.uni-kl.de
9
10
11OVERVIEW:
12This library implements a ring independent polynomial type used for the return value in
13classify2.lib and realclassify.lib. You can use +,  * and == for addition, multiplication
14and comparison. The key over contains the base ring of the polynomial, the key value its
15value as a polynomial of type poly. The constructor can be called by assigning a polynomial
16of type poly to a polynomial of type Poly via =.
17
18Moreover the library implements a class NormalformEquation consisting out of a string type,
19an integer milnorNumber, a Poly normalFormEquation, and integer modality, a list of numbers
20parameters, a list variables, an integer corank, in the real case, an integer inertiaIndex,
21a list of open intervals represented as lists consisting out of two rationals used to select
22a real root of the minimal polynomial (which is stored in the variable minpoly of the polynomial
23ring containing normalFormEquation, that is, in normalFormEquation.in), or if no minimal
24polynomial is defined then an interval containing the rational parameter value.
25
26KEYWORDS:
27polynomials
28
29SEE ALSO: realclassify_lib, classify2_lib
30
31PROCEDURES:
32makePoly(f);  constructor for ring independent polynomial type Poly
33printPoly(f); print routine for polynomial type Poly
34printNormalFormEquation(F); print routine for normal form equations
35";
36
37LIB "sing.lib";
38
39static proc mod_init()
40{
41  newstruct("Poly","ring in,poly value");
42  newstruct("NormalFormEquation","list vars, string singularityType, int milnorNumber, Poly normalFormEquation, int modality, list parameters, int corank, int inertiaIndex, int determinacy, int realCase");
43  system("install","Poly","print",printPoly,1);
44  system("install","Poly","string",stringPoly,1);
45  system("install","Poly","+",addPoly,2);
46  system("install","Poly","*",multPoly,2);
47  system("install","Poly","^",expPoly,2);
48  system("install","Poly","==",equalPoly,2);
49  system("install","Poly","=",makePoly,1);
50  system("install","NormalFormEquation","print",printNormalFormEquation,1);
51}
52
53proc printNormalFormEquation(NormalFormEquation F)
54"USAGE: printNormalFormEquation(F); F NormalFormEquation
55RETURN: print a normal form equation
56EXAMPLE: example printNormalFormEquation, shows an example"
57{
58def R=basering;
59Poly f=F.normalFormEquation;
60def SS=f.in;
61setring SS;
62"Corank = "+string(F.corank);
63if (F.realCase){"Inertia index = "+string(F.inertiaIndex);}
64"Normalform equation of type = "+(F.singularityType);
65"Normalform equation = "+string(f.value);
66"Milnor number = "+string(F.milnorNumber);
67"Modality = "+string(F.modality);
68if (F.modality>=1){
69  if (F.modality==1){
70      "Parameter term = "+string(F.parameters[1][1]);
71  } else {
72      string paraterms="Parameter terms = ";
73      for (int i =1;i<=size(F.parameters);i++){
74          paraterms=paraterms+string(F.parameters[i][1]);
75          if (i<size(F.parameters)){paraterms = paraterms +", ";}
76      }
77      paraterms;
78  }
79  if (minpoly!=0){"Minimal polynomial = "+string(minpoly);}
80  if (F.realCase && minpoly!=0){
81      if (F.modality>1){ERROR("Not implemented");}
82      "Interval = ["+string(F.parameters[1][2][1])+", "+string(F.parameters[1][2][2])+"]";
83  }
84}
85"Determinacy <= "+string(F.determinacy);
86setring R;
87}
88example
89{
90 "EXAMPLE:"; echo=2;
91 ring R=(0,a),(x,y,z,w),ds;
92 minpoly = a^2-2;
93 Poly f=x^4+x^2*y^2+a*y^8+z^2-w^2;
94 NormalFormEquation F;
95 F.vars = ringlist(R)[2];
96 F.realCase = 1;
97 F.normalFormEquation = f;
98 F.modality = 1;
99 F.corank = 2;
100 F.inertiaIndex = 1;
101 F.determinacy = 8;
102 F.milnorNumber = milnor(f.value);
103 F.parameters = list(list(a*y^8,list(0,2)));
104 F.singularityType = "X[13]";
105 F;
106 ring R=(0),(x,y,z,w),ds;
107 Poly f=x^4+x^2*y^2+7*y^8+z^2-w^2;
108 NormalFormEquation F;
109 F.vars = ringlist(R)[2];
110 F.realCase = 1;
111 F.normalFormEquation = f;
112 F.modality = 1;
113 F.corank = 2;
114 F.inertiaIndex = 1;
115 F.determinacy = 8;
116 F.milnorNumber = milnor(f.value);
117 F.parameters = list(list(7*y^8,list(-6,8)));
118 F.singularityType = "X[13]";
119 F;
120
121}
122
123
124
125proc makePoly(poly f)
126"USAGE: makePoly(f); f poly
127RETURN: make a ring independent Poly from a poly in the basering
128EXAMPLE: example makePoly, shows an example"
129{
130Poly F;
131F.in=basering;
132F.value=f;
133return(F);
134}
135example
136{
137 "EXAMPLE:"; echo=2;
138 ring R=0,(x,y),dp;
139 Poly f=3*x^2+x*y+1;
140 Poly g=2*x+y^3;
141 f*g;
142 f+g;
143 f^3;
144}
145
146
147static proc printPoly(Poly f)
148"USAGE: printPoly(f); f Poly
149RETURN: print Poly
150EXAMPLE: example printPoly, shows an example"
151{
152def R=basering;
153def SS=f.in;
154setring SS;
155f.value;
156setring R;
157}
158example
159{
160 "EXAMPLE:"; echo=2;
161 ring R=0,(x,y),dp;
162 Poly f=3*x^2+x*y+1;
163 f;
164}
165
166static proc stringPoly(Poly f)
167{
168def R=basering;
169def SS=f.in;
170setring SS;
171string st = string(f.value);
172setring R;
173return(st);}
174
175
176static proc addPoly(Poly f,Poly g)
177{
178def R=basering;
179def S1=f.in;
180setring S1;
181Poly fplusg=f.value+g.value;
182setring R;
183return(fplusg);}
184
185static proc multPoly(Poly f,Poly g)
186{
187def R=basering;
188def S1=f.in;
189setring S1;
190Poly ftimesg=(f.value)*(g.value);
191setring R;
192return(ftimesg);}
193
194
195static proc equalPoly(Poly f,Poly g)
196{
197def R=basering;
198def S1=f.in;
199setring S1;
200int fgequal=(f.value)==(g.value);
201setring R;
202return(fequal);}
203
204
205static proc expPoly(Poly f,int n)
206{
207def R=basering;
208def S1=f.in;
209setring S1;
210Poly fexpn=(f.value)^n;
211setring R;
212return(fexpn);}
213
214
215
216
Note: See TracBrowser for help on using the repository browser.