Ticket #43: gorzel_mail_17Nov2008.txt

File gorzel_mail_17Nov2008.txt, 8.5 KB (added by seelisch, 15 years ago)
Line 
1                                                           Hallo Hans,
2
3  hier noch ein paar BUG in Singular (Kernel & Librarries).
4
5 1.) Die Syntax von / entsprechend zu div, laeuft noch fuer bigint
6     in einem integer-ring.
7
8    (Problem schon zuvor fuer char = 0 beschrieben.)
9
10 //-----------------------------------------
11
12 // Syntax von "/" und "/ " OK fuer int und bigint,
13 // wenn kein Ring definiert ist.
14
15> > defined(basering);
160
17//  Test fuer int
18> > 111/2;
19   ? no ring active
20   ? error occurred in STDIN line 2: `111/2;`
21> > 111/ 2;
2255
23> > 111 div  2;
2455
25// Test fuer bigint
26> > 111111111111111111/2;
27   ? no ring active
28   ? error occurred in STDIN line 4: `111111111111111111/2;`
29
30> > 111111111111111111 div  2;
3155555555555555555
32> > typeof(_);
33bigint
34> > 111111111111111111/ 2;
3555555555555555555
36
37// Nun rationale Grundkoerper char =0:
38> > ring r=0,x,dp;
39// Test int
40> > 111/2;
41111/2
42> > 111/ 2;
4355
44> > 111 div  2;
4555
46// Test bigint
47> > 111111111111111111/2;
48111111111111111111/2
49> > 111111111111111111/ 2;    //<-- Achtung hier ein anderes Verhalten als
50111111111111111111/2        // bei int, es sollte ebenfalls ein div sein!
51> > 111111111111111111 div 2;
5255555555555555555
53
54
55// Nun fuer Koeffizientenbereich integer:
56
57
58> > ring r100 =(integer,100),x,dp;
59// ** You are using coefficients rings which are not fields.
60// ** Please note that only limited functionality is available
61// ** for these coefficients.
62// **
63// ** The following commands are meant to work:
64// ** - basic polynomial arithmetic
65// ** - std
66// ** - reduce
67
68// Test fuer int OK
69
70> > 111/2;
71   ? `111/2` is undefined
72   ? error occurred in STDIN line 19: `111/2;`
73> > 111/ 2;
7455
75> > 111 div  2;
7655
77
78> > 111111111111111111/2;                       // <-- Das ist OK
79   ? `111111111111111111/2` is undefined
80   ? error occurred in STDIN line 22: `111111111111111111/2;`
81
82> > 111111111111111111 div  2;   // OK
8355555555555555555
84
85> > 111111111111111111/ 2;              // <-- BUG  (*)
86// ** Division not possible, even by cancelling zero divisors.
87// ** Result is integer division without remainder.
885
89
90// Die Fehlermeldung entspricht nicht dem, was Singular tut.
91// Singular sollte hier ein div fuer bigint ausfuehren,
92// es wandelte aber den bigint zu number um, und fuehrte dann ein div aus!
93
94> > number  q= 111111111111111111;
95> > q;
9611
97> > 111111111111111111111111;
98111111111111111111111111
99> > typeof(_);
100bigint
101
102 //----------------------------------------------------
103
104  Zusammengefasst, entweder ganz die Syntax fuer "/ " anstelle von "div"
105  abschaffen, und einfach "/ " wie "/" behandeln.
106  Dann aber nicht bei (*) die Fehlermeldung und eine Rechnung.
107
108Vgl. auch: sing_355.htm#SEC396
109
110" 6.4 Miscellaneous oddities
111   1. integer division
112"
113
114 Die Frage ist: soll das dort beschriebene auch fuer bigint gelten??
115
116 //-------
117  Um noch einmal klar zu machen:
118   Es funktinioert einfach nicht die proc kmemory  aus general.lib richtig.
119   Denn memory hat als Rueckgabewert ein bigint!
120
121> > LIB "general.lib";
122
123   Sowohl ueber
124
125   a) char =0,
126
127> > ring r00=0,x,dp;
128> > kmemory(1);
129812031/1024    // sollte ein div sein
130
131  als auch
132
133  b) fuer integer, 100
134
135> > ring r100=(integer,100),x,dp;
136> > kmemory(1);
137// ** Division not possible, even by cancelling zero divisors.
138// ** Result is integer division without remainder.
1391
140
141
142 Bemerkung:
143
144  in proc kmemory (general.lib) steht
145
146   " return ((memory(n)+1023)/1024); "
147
148  hier sollte
149
150     return ((memory(n)+1023)/ 1024);
151
152  oder einfach
153
154
155  "return ((memory(n)+1023) div 1024);"
156
157
158  stehen.
159
160  (Aber dies ist nur einer de Fehler in general.lib.)
161
162  ============================================================================
163  Fehler in Libraries:
164  ============================================================================
165
166 1. content (poly.lib)
167
168proc content(f)
169"USAGE:   content(f); f polynomial/vector
170RETURN:  number, the content (greatest common factor of coefficients)
171         of the polynomial/vector f
172EXAMPLE: example content; shows an example
173"
174{
175  return(leadcoef(f)/leadcoef(cleardenom(f)));
176}
177
178 Fuehrt zu Fehlermeldung bei f = 0.
179
180  > ring r =0,x,dp;
181  > content(2x-4);     // OK
182  2
183  > content(-2x-4);   // Dies sollte eingentlich ebenfalls +2 sein!
184  -2
185
186  > content(0);
187     ? div. by 0
188     ? error occurred in poly.lib::content line 829: `
189return(leadcoef(f)/leadcoef(cleardenom(f)));`
190     ? leaving poly.lib::content
191     skipping text from `;` error at token `)`
192
193
194 Schreibe also:
195 -------------
196
197
198 {
199  if (f==0) {return(1);}
200  return(leadcoef(f)/leadcoef(cleardenom(f)));
201 }
202
203 Desweiteren, sollte der Rueckgabewert, als ggt,  ein positiver int sein.
204
205 Das eigentliche Problem ist aber, das cleardenom, nicht nur den content
206 rausteilt, sondern auch das Vorzeichen stets auf "+" setzt.
207
208 Daher vorlaeufig sogar besser folgendes schreiben:
209
210proc content(f)
211"USAGE:   content(f); f polynomial/vector
212RETURN:  number, the content (greatest common factor of coefficients)
213         of the polynomial/vector f
214EXAMPLE: example content; shows an example
215"
216{
217  number lc = leadcoef(f);
218  if (lc == 0) {return(1);}
219  if (lc < 0) { lc = -lc;}
220   return(lc/leadcoef(cleardenom(f)));
221}
222
223
224 II. Tippfehler im example part
225
226> > example permutation;
227// proc permutation from lib realrad.lib
228EXAMPLE:
229  list L1="Nur","ein","Beispiel";
230  permutaion(L1);
231   ? `permutaion` is not defined
232   ? error occurred in realrad.lib::permutation line 1145: `
233permutaion(L1);`
234   ? leaving realrad.lib::permutation
235> >
236
237example
238{ "EXAMPLE:"; echo = 2;
239  list L1="Nur","ein","Beispiel";
240  permutation(L1);                 // <-- Tippfehler
241  list L2=1,2,3,4;
242  permutation(L2);                 // <-- Tippfehler
243}
244
245 Wegen der internationalen Nutzer, besser
246
247  list L1="Nur","ein","Beispiel";
248
249 zu
250
251  list L1="Just","an","example";
252
253 aendern.
254
255 Anscheinend werden die example-Parts niemals zu internen Testzwecken
256 aufgerufen!?!
257
258 3.) In writelist (inout.lib) ebenso Meldungen auf deutsch im example-part
259von
260       durch englische Ausdruecke  ersetzen.
261
262inout.lib:   writelist("zumSpass","lustig",k);
263inout.lib:   read("zumSpass");
264inout.lib:   system("sh","/bin/rm res_list zumSpass");
265inout.lib:   // Under UNIX, this removes the files 'res_list' and 'zumSpass'
266inout.lib:   // must remove the just created files 'zumSpass' and
267'res_list' directly
268
269
2704.) Es tritt fuenfmal (sechsmal)
271
272   redefining auf, wenn man LIB "all.lib"; laedt.
273
274 Insbesondere gibt es keine redefining Meldung, wenn eine static proc
275 ueberschrieben wird ?!?
276
277// ** loaded /home/gorzelc/Singular/3-1-0/LIB/surfex.lib
278// ** redefining num_of_vars **
279
280// ** loaded /home/gorzelc/Singular/3-1-0/LIB/signcond.lib
281// ** redefining linreduce **
282
283// ** loaded /home/gorzelc/Singular/3-1-0/LIB/redcgs.lib
284// ** redefining subset **
285
286// ** loaded /home/gorzelc/Singular/3-1-0/LIB/hnoether.lib
287// ** redefining shortid **
288
289// ** loaded /home/gorzelc/Singular/3-1-0/LIB/gmssing.lib
290// ** redefining vfilt **
291
292
293gorzelc@linux:~/Singular/3-1-0/LIB> grep "proc num_of_vars" *.lib
294surfex.lib:proc num_of_vars(ideal I)
295surf.lib:static proc num_of_vars(ideal I)
296
297gorzelc@linux:~/Singular/3-1-0/LIB> grep "proc linreduce" *.lib
298bfct.lib:proc linreduce(poly f, ideal I, list #)
299solve.lib:static proc linreduce(ideal T, int v, number n)
300
301
302gorzelc@linux:~/Singular/3-1-0/LIB> grep "proc subset" *.lib
303brnoeth.lib:static proc subset (ideal I,ideal J)
304realrad.lib:static proc subset(int n)
305redcgs.lib:proc subset(J,K)
306
307
308gorzelc@linux:~/Singular/3-1-0/LIB> grep "proc shortid" *.lib
309groups.lib:static proc shortid (ideal id,int n)
310presolve.lib:proc shortid (id,int n,list #)
311
312gorzelc@linux:~/Singular/3-1-0/LIB> grep "proc vfilt" *.lib
313gmspoly.lib:static proc vfilt(matrix B,int d)
314gmssing.lib:proc vfilt(poly t)
315
316
317 Keine von diesen procs, die doppelt auftreten, wird mit dem vollen
318 Packagename aufgerufen.
319
320gorzelc@linux:~/Singular/3-1-0/LIB> grep "::" *.lib
321gorzelc@linux:~/Singular/3-1-0/LIB> grep "::vfilt" *.lib
322gorzelc@linux:~/Singular/3-1-0/LIB> grep "::shortid" *.lib
323gorzelc@linux:~/Singular/3-1-0/LIB> grep "::subset" *.lib
324gorzelc@linux:~/Singular/3-1-0/LIB> grep "::linreduce" *.lib
325gorzelc@linux:~/Singular/3-1-0/LIB> grep "::num_of_vars" *.lib
326
327
328 Manche sind zwar wesentlich syntyktisch gleich, und nur rueber kopiert,
329 es kann daher zu unkontrollierten Ausgaben kommen?!
330
331------
332
333  Gruesse,
334   Christian
335
336
337
338
339
340
341