Annotation of OpenXM/src/kan96xx/Doc/hol.sm1, Revision 1.27
1.27 ! takayama 1: % $OpenXM: OpenXM/src/kan96xx/Doc/hol.sm1,v 1.26 2008/01/18 00:48:07 takayama Exp $
1.5 takayama 2: %% hol.sm1, 1998, 11/8, 11/10, 11/14, 11/25, 1999, 5/18, 6/5. 2000, 6/8
1.1 maekawa 3: %% rank, rrank, characteristic
4: %% This file is error clean.
5: /hol.version (2.990515) def
6: hol.version [(Version)] system_variable gt
7: { [(This package hol.sm1 requires the latest version of kan/sm1) nl
8: (Please get it from http://www.math.kobe-u.ac.jp/KAN)
9: ] cat
10: error
11: } { } ifelse
12:
1.5 takayama 13: $hol.sm1, basic package for holonomic systems (C) N.Takayama, 2000, 06/08 $
1.1 maekawa 14: message-quiet
15:
1.7 takayama 16: /gb.warning 0 def
1.18 takayama 17: /gb.oxRingStructure [[ ] [ ]] def
1.1 maekawa 18: /rank.v [(x) (y) (z)] def %% default value of v (variables).
19: /rank.ch [ ] def %% characteristic variety.
20: /rank.verbose 0 def
21: /rank {
22: /arg1 set
23: [/in-rank /aa /typev /setarg /f /v /vsss /vddd
24: /gg /wv /vd /vdweight /chv
25: /one
26: ] pushVariables
27: [(CurrentRingp) (KanGBmessage)] pushEnv
28: [
29:
30: /aa arg1 def
31: aa isArray { } { ( << array >> rank) error } ifelse
32: /setarg 0 def
33: aa { tag } map /typev set
34: typev [ ArrayP ] eq
35: { /f aa 0 get def
36: /v rank.v def
37: /setarg 1 def
38: } { } ifelse
39: typev [ArrayP StringP] eq
40: { /f aa 0 get def
41: /v [ aa 1 get to_records pop ] def
42: /setarg 1 def
43: } { } ifelse
44: typev [ArrayP ArrayP] eq
45: { /f aa 0 get def
46: /v aa 1 get def
47: /setarg 1 def
48: } { } ifelse
49: setarg { } { (rank : Argument mismatch) error } ifelse
50:
51: [(KanGBmessage) rank.verbose ] system_variable
52:
53: f { toString } map /f set
54: v { @@@.Dsymbol 2 1 roll 2 cat_n 1 } map
55: /vddd set %% vddd = [(Dx) 1 (Dy) 1 (Dz) 1]
56: v { @@@.Dsymbol 2 1 roll 2 cat_n } map
57: /vd set %% vd = [(Dx) (Dy) (Dz)]
58: /vdweight
59: vd { [ 2 1 roll -1 ] } map %% vdweight=[[(Dx) -1] [(Dy) -1] [(Dz) -1]]
60: def
61:
62: [v from_records
63: ring_of_differential_operators [vddd] weight_vector 0] define_ring
64: f { . dehomogenize } map /f set
65: [f] groebner_sugar 0 get /gg set
66:
67: /wv vddd weightv def
68: gg { wv init } map /chv set %%obtained the characteristic variety.
69: /rank.ch chv def
70: chv { toString } map /chv set
71:
72: [ v vd join from_records
73: ring_of_polynomials
74: [vddd] vdweight join weight_vector
75: 0
76: ] define_ring
77: [chv {.} map] groebner_sugar 0 get { init } map /chii set
78:
79: /rank.chii chii def
80: rank.verbose { chii message } { } ifelse
81: v {[ 2 1 roll . (1).]} map /one set
82: %% [[(x). (1).] [(y). (1).] [(z). (1).]]
83: %% chii { one replace } map %% buggy code.
84: %% Arg of hilb should be a reduced GB.
85: [chii { one replace } map] groebner 0 get
86: vd hilb /arg1 set
87: ] pop
88: popEnv
89: popVariables
90: arg1
91: } def
92:
93:
94: [(rank)
95: [( a rank b)
96: ( array a; number b)
97: (Example 1 : )
98: $ [ [( (x Dx)^2 + ( y Dy)^2) ( x Dx y Dy -1)] (x,y)] rank :: $
99: (Example 2 : )
100: $[ [( (x^3-y^2) Dx + 3 x^2) ( (x^3-y^2) Dy - 2 y)] (x,y)] rank :: $
101: ]
102: ] putUsages
103: (rank ) messagen-quiet
104:
105: /characteristic.verbose 0 def
106: /characteristic.v [(x) (y) (z)] def
107: /characteristic.ch [ ] def
108: /ch { characteristic } def
109: /characteristic {
110: /arg1 set
111: [/in-rank /aa /typev /setarg /f /v /vsss /vddd
112: /gg /wv /vd /chv
113: /one
114: ] pushVariables
115: [(CurrentRingp) (KanGBmessage)] pushEnv
116: [
117:
118: /aa arg1 def
119: aa isArray { } { ( << array >> characteristic) error } ifelse
120: /setarg 0 def
121: aa { tag } map /typev set
122: typev [ ArrayP ] eq
123: { /f aa 0 get def
124: /v characteristic.v def
125: /setarg 1 def
126: } { } ifelse
127: typev [ArrayP StringP] eq
128: { /f aa 0 get def
129: /v [ aa 1 get to_records pop ] def
130: /setarg 1 def
131: } { } ifelse
132: typev [ArrayP ArrayP] eq
133: { /f aa 0 get def
134: /v aa 1 get def
135: /setarg 1 def
136: } { } ifelse
137: setarg { } { (rank : Argument mismatch) error } ifelse
138:
139: [(KanGBmessage) characteristic.verbose ] system_variable
140:
141: f { toString } map /f set
142: v { @@@.Dsymbol 2 1 roll 2 cat_n 1 } map
143: /vddd set %% vddd = [(Dx) 1 (Dy) 1 (Dz) 1]
144: v { @@@.Dsymbol 2 1 roll 2 cat_n } map
145: /vd set %% vd = [(Dx) (Dy) (Dz)]
146:
147: [v from_records
148: ring_of_differential_operators [vddd] weight_vector 0] define_ring
149: f { . dehomogenize } map /f set
150: [f] groebner_sugar 0 get /gg set
151:
152: /wv vddd weightv def
153: gg { wv init } map /chv set
154: /characteristic.ch [chv] def
155: %% gg { wv init toString} map /chv set %%obtained the characteristic variety.
156: %% /characteristic.ch chv def
157:
158: %% [ v vd join from_records
159: %% ring_of_polynomials
160: %% [vddd] weight_vector
161: %% 0
162: %% ] define_ring
163: %% [chv {.} map] groebner_sugar 0 get /characteristic.ch set
164:
165: characteristic.ch /arg1 set
166: ] pop
167: popEnv
168: popVariables
169: arg1
170: } def
171:
172: [(characteristic)
173: [( a characteristic b)
174: ( array a; number b)
175: (b is the generator of the characteristic variety of a.)
176: (For the algorithm, see Japan J. of Industrial and Applied Math., 1994, 485--497.)
177: (Example 1 : )
178: $ [ [( (x Dx)^2 + ( y Dy)^2) ( x Dx y Dy -1)] (x,y)] characteristic :: $
179: (Example 2 : )
180: $[ [( (x^3-y^2) Dx + 3 x^2) ( (x^3-y^2) Dy - 2 y)] (x,y)] characteristic :: $
181: ]
182: ] putUsages
183: (characteristic ) messagen-quiet
184: [(ch)
185: [(ch is the abbreviation of characteristic.)
186: ( a ch b)
187: ( array a; number b)
188: (b is the generator of the characteristic variety of a.)
189: (For the algorithm, see, Japan J. of Industrial and Applied Math., 1994, 485--497.)
190: (Example 1 : )
191: $ [ [( (x Dx)^2 + ( y Dy)^2) ( x Dx y Dy -1)] (x,y)] ch :: $
192: (Example 2 : )
193: $[ [( (x^3-y^2) Dx + 3 x^2) ( (x^3-y^2) Dy - 2 y)] (x,y)] ch :: $
194: ]
195: ] putUsages
196: (ch ) messagen-quiet
197:
198: %%%% developing rrank.sm1
199: /rrank.v [(x) (y) (z)] def %% default value of v (variables).
200: /rrank.init [ ] def %% initial ideal.
201: /rrank.verbose 0 def
202: /rrank {
203: /arg1 set
204: [/in-rrank /aa /typev /setarg /f /v /vsss /vddd
205: /gg /wv /vd /vdweight
206: /one /i /chv
207: ] pushVariables
208: [(CurrentRingp) (KanGBmessage)] pushEnv
209: [
210:
211: /aa arg1 def
212: aa isArray { } { ( << array >> rrank) error } ifelse
213: /setarg 0 def
214: aa { tag } map /typev set
215: typev [ ArrayP ] eq
216: { /f aa 0 get def
217: /v rrank.v def
218: /setarg 1 def
219: } { } ifelse
220: typev [ArrayP StringP] eq
221: { /f aa 0 get def
222: /v [ aa 1 get to_records pop ] def
223: /setarg 1 def
224: } { } ifelse
225: typev [ArrayP ArrayP] eq
226: { /f aa 0 get def
227: /v aa 1 get def
228: /setarg 1 def
229: } { } ifelse
230: setarg { } { (rrank : Argument mismatch) error } ifelse
231:
232: [(KanGBmessage) rrank.verbose ] system_variable
233:
234: f { toString } map /f set
235: v { @@@.Dsymbol 2 1 roll 2 cat_n 1 } map
236:
237: v { @@@.Dsymbol 2 1 roll 2 cat_n } map
238: /vd set %% vd = [(Dx) (Dy) (Dz)] , v = [(x) (y) (z)]
239: /vdweight
240: [ 0 1 v length 1 sub { /i set v i get << 0 i sub >>
241: vd i get << i >> } for ]
242: def
243: rrank.verbose { vdweight message } { } ifelse
244:
245: [v from_records
246: ring_of_differential_operators [vdweight] weight_vector 0] define_ring
247: f { . dehomogenize homogenize } map /f set
248: [f] groebner 0 get {dehomogenize} map /gg set
249:
250: /wv vdweight weightv def
251: gg { wv init } map /rrank.init set %%obtained the initial ideal
252: rrank.init {toString} map /chv set
253: /arg1 [chv v] rank def
254: ] pop
255: popEnv
256: popVariables
257: arg1
258: } def
259:
260:
261: [(rrank)
262: [( a rrank b)
263: ( array a; number b)
264: (It computes the holonomic rank for regular holonomic system.)
265: (For the algorithm, see Grobner deformations of hypergeometric differential equations, 1999, Springer.)
266: (Chapter 2.)
267: (Example 1 : )
268: $ [ [( (x Dx)^2 + ( y Dy)^2) ( x Dx y Dy -1)] (x,y)] rrank :: $
269: ]
270: ] putUsages
271: (rrank ) messagen-quiet
272:
1.23 takayama 273:
274: % Take the value of arg1 in prior.
275: /mergeGroebnerOptions {
276: /arg2 set
277: /arg1 set
278: [/loc /glo /ans] pushVariables
279: [
280: /loc arg1 def
281: /glo arg2 def
282: /ans [ ] def
283: {
284: loc tag 0 eq { /ans glo def exit } { } ifelse
285: /ans glo loc join def
286: exit
287: } loop
288: /arg1 ans def
289: ] pop
290: popVariables
291: arg1
292: } def
293:
1.1 maekawa 294: /gb.v 1 def
295: /gb.verbose 0 def
1.4 takayama 296: /gb.options [ ] def
1.13 takayama 297: /gb.characteristic 0 def
1.14 takayama 298: /gb.homogenized 0 def
299: /gb.autoHomogenize 1 def
1.1 maekawa 300: /gb {
301: /arg1 set
302: [/in-gb /aa /typev /setarg /f /v
303: /gg /wv /termorder /vec /ans /rr /mm
1.23 takayama 304: /degreeShift /env2 /groebnerOptions
1.1 maekawa 305: ] pushVariables
306: [(CurrentRingp) (KanGBmessage)] pushEnv
307: [
308:
309: /aa arg1 def
310: aa isArray { } { ( << array >> gb) error } ifelse
1.23 takayama 311: aa getAttributeList configureGroebnerOption /groebnerOptions set
1.1 maekawa 312: /setarg 0 def
313: /wv 0 def
1.11 takayama 314: /degreeShift 0 def
1.1 maekawa 315: aa { tag } map /typev set
316: typev [ ArrayP ] eq
317: { /f aa 0 get def
318: /v gb.v def
319: /setarg 1 def
320: } { } ifelse
321: typev [ArrayP StringP] eq
322: { /f aa 0 get def
323: /v aa 1 get def
324: /setarg 1 def
325: } { } ifelse
1.10 takayama 326: typev [ArrayP RingP] eq
327: { /f aa 0 get def
328: /v aa 1 get def
329: /setarg 1 def
330: } { } ifelse
1.1 maekawa 331: typev [ArrayP ArrayP] eq
332: { /f aa 0 get def
333: /v aa 1 get from_records def
334: /setarg 1 def
335: } { } ifelse
336: typev [ArrayP StringP ArrayP] eq
337: { /f aa 0 get def
338: /v aa 1 get def
339: /wv aa 2 get def
340: /setarg 1 def
341: } { } ifelse
342: typev [ArrayP ArrayP ArrayP] eq
343: { /f aa 0 get def
344: /v aa 1 get from_records def
345: /wv aa 2 get def
346: /setarg 1 def
347: } { } ifelse
1.11 takayama 348: typev [ArrayP StringP ArrayP ArrayP] eq
349: { /f aa 0 get def
350: /v aa 1 get def
351: /wv aa 2 get def
352: /degreeShift aa 3 get def
353: /setarg 1 def
354: } { } ifelse
355: typev [ArrayP ArrayP ArrayP ArrayP] eq
356: { /f aa 0 get def
357: /v aa 1 get from_records def
358: /wv aa 2 get def
359: /degreeShift aa 3 get def
360: /setarg 1 def
361: } { } ifelse
1.1 maekawa 362:
1.12 takayama 363: /env1 getOptions def
364:
1.1 maekawa 365: setarg { } { (gb : Argument mismatch) error } ifelse
366:
367: [(KanGBmessage) gb.verbose ] system_variable
368:
369: %%% Start of the preprocess
1.10 takayama 370: v tag RingP eq {
371: /rr v def
372: }{
373: f getRing /rr set
374: } ifelse
1.1 maekawa 375: %% To the normal form : matrix expression.
376: f gb.toMatrixOfString /f set
377: /mm gb.itWasMatrix def
378:
1.14 takayama 379: rr tag 0 eq
380: v isInteger not
381: or {
1.1 maekawa 382: %% Define our own ring
383: v isInteger {
384: (Error in gb: Specify variables) error
385: } { } ifelse
386: wv isInteger {
387: [v ring_of_differential_operators
1.13 takayama 388: gb.characteristic] define_ring
1.1 maekawa 389: /termorder 1 def
390: }{
1.11 takayama 391: degreeShift isInteger {
392: [v ring_of_differential_operators
393: wv weight_vector
1.13 takayama 394: gb.characteristic] define_ring
1.11 takayama 395: wv gb.isTermOrder /termorder set
396: }{
397: [v ring_of_differential_operators
398: wv weight_vector
1.13 takayama 399: gb.characteristic
1.11 takayama 400: [(degreeShift) degreeShift]
401: ] define_ring
402: wv gb.isTermOrder /termorder set
403: } ifelse
1.1 maekawa 404: } ifelse
405: } {
406: %% Use the ring structre given by the input.
407: rr ring_def
408: /wv rr gb.getWeight def
409: wv gb.isTermOrder /termorder set
410: } ifelse
411: %%% Enf of the preprocess
412:
1.14 takayama 413: termorder {
414: /gb.homogenized 0 def
415: }{
416: /gb.homogenized 1 def
417: } ifelse
1.23 takayama 418: groebnerOptions gb.options mergeGroebnerOptions /groebnerOptions set
419: gb.verbose { (groebnerOptions = ) messagen groebnerOptions message } { } ifelse
1.1 maekawa 420: termorder {
1.22 takayama 421: f { {___ dehomogenize} map } map /f set
1.23 takayama 422: [f groebnerOptions] groebner_sugar 0 get /gg set
1.1 maekawa 423: }{
1.22 takayama 424: f { {___ dehomogenize} map} map /f set
1.14 takayama 425: gb.autoHomogenize {
426: f fromVectors { homogenize } map /f set
427: } { } ifelse
1.23 takayama 428: [f groebnerOptions] groebner 0 get /gg set
1.1 maekawa 429: }ifelse
430: wv isInteger {
431: /ans [gg gg {init} map] def
432: }{
433: /ans [gg gg {wv 0 get weightv init} map] def
434: }ifelse
435:
436: %% Postprocess : recover the matrix expression.
437: mm {
438: ans { /tmp set [mm tmp] toVectors } map
439: /ans set
440: }{ }
441: ifelse
1.17 takayama 442: ans getRing (oxRingStructure) dc /gb.oxRingStructure set
1.23 takayama 443: %% gg getAttributeList message
444: ans gg getAttributeList setAttributeList /ans set
1.1 maekawa 445: %%
1.12 takayama 446: env1 restoreOptions %% degreeShift changes "grade"
1.1 maekawa 447:
448: /arg1 ans def
449: ] pop
450: popEnv
451: popVariables
452: arg1
453: } def
454: (gb ) messagen-quiet
455:
456: /pgb {
457: /arg1 set
458: [/in-pgb /aa /typev /setarg /f /v
459: /gg /wv /termorder /vec /ans /rr /mm
1.23 takayama 460: /groebnerOptions
1.1 maekawa 461: ] pushVariables
462: [(CurrentRingp) (KanGBmessage) (UseCriterion1)] pushEnv
463: [
464:
465: /aa arg1 def
466: aa isArray { } { (<< array >> pgb) error } ifelse
1.23 takayama 467: aa getAttributeList configureGroebnerOption /groebnerOptions set
1.1 maekawa 468: /setarg 0 def
469: /wv 0 def
470: aa { tag } map /typev set
471: typev [ ArrayP ] eq
472: { /f aa 0 get def
473: /v gb.v def
474: /setarg 1 def
475: } { } ifelse
476: typev [ArrayP StringP] eq
477: { /f aa 0 get def
478: /v aa 1 get def
479: /setarg 1 def
480: } { } ifelse
481: typev [ArrayP ArrayP] eq
482: { /f aa 0 get def
483: /v aa 1 get from_records def
484: /setarg 1 def
485: } { } ifelse
486: typev [ArrayP StringP ArrayP] eq
487: { /f aa 0 get def
488: /v aa 1 get def
489: /wv aa 2 get def
490: /setarg 1 def
491: } { } ifelse
492: typev [ArrayP ArrayP ArrayP] eq
493: { /f aa 0 get def
494: /v aa 1 get from_records def
495: /wv aa 2 get def
496: /setarg 1 def
497: } { } ifelse
498:
499: setarg { } { (pgb : Argument mismatch) error } ifelse
500:
501: [(KanGBmessage) gb.verbose ] system_variable
502:
503: %%% Start of the preprocess
504: f getRing /rr set
505: %% To the normal form : matrix expression.
506: f gb.toMatrixOfString /f set
507: /mm gb.itWasMatrix def
508:
509: rr tag 0 eq {
510: %% Define our own ring
511: v isInteger {
512: (Error in pgb: Specify variables) error
513: } { } ifelse
514: wv isInteger {
515: [v ring_of_polynomials
1.13 takayama 516: gb.characteristic] define_ring
1.1 maekawa 517: /termorder 1 def
518: }{
519: [v ring_of_polynomials
520: wv weight_vector
1.13 takayama 521: gb.characteristic] define_ring
1.1 maekawa 522: wv gb.isTermOrder /termorder set
523: } ifelse
524: } {
525: %% Use the ring structre given by the input.
526: v isInteger not {
1.7 takayama 527: gb.warning {
528: (Warning : the given ring definition is not used.) message
529: } { } ifelse
1.1 maekawa 530: } { } ifelse
531: rr ring_def
532: /wv rr gb.getWeight def
533: wv gb.isTermOrder /termorder set
534: } ifelse
535: %%% Enf of the preprocess
536:
1.23 takayama 537: groebnerOptions gb.options mergeGroebnerOptions /groebnerOptions set
1.25 takayama 538: gb.verbose { (groebnerOptions = ) messagen groebnerOptions message } { } ifelse
1.1 maekawa 539: termorder {
540: f { {. dehomogenize} map } map /f set
541: [(UseCriterion1) 1] system_variable
1.25 takayama 542: [f groebnerOptions] groebner_sugar 0 get /gg set
1.1 maekawa 543: [(UseCriterion1) 0] system_variable
544: }{
545: f { {. dehomogenize} map} map /f set
546: f fromVectors { homogenize } map /f set
547: [(UseCriterion1) 1] system_variable
1.23 takayama 548: [f groebnerOptions] groebner 0 get /gg set
1.1 maekawa 549: [(UseCriterion1) 0] system_variable
550: }ifelse
551: wv isInteger {
552: /ans [gg gg {init} map] def
553: }{
554: /ans [gg gg {wv 0 get weightv init} map] def
555: }ifelse
556:
557: %% Postprocess : recover the matrix expression.
558: mm {
559: ans { /tmp set [mm tmp] toVectors } map
560: /ans set
561: }{ }
562: ifelse
563: %%
1.23 takayama 564: ans gg getAttributeList setAttributeList /ans set
1.1 maekawa 565:
566: /arg1 ans def
567: ] pop
568: popEnv
569: popVariables
570: arg1
571: } def
572:
573: /pgb.old {
574: /arg1 set
575: [/in-pgb /aa /typev /setarg /f /v
576: /gg /wv /termorder /vec /ans
577: ] pushVariables
578: [(CurrentRingp) (KanGBmessage) (UseCriterion1)] pushEnv
579: [
580:
581: /aa arg1 def
582: aa isArray { } { (array pgb) message (pgb) usage error } ifelse
583: /setarg 0 def
584: /wv 0 def
585: aa { tag } map /typev set
586: typev [ ArrayP ] eq
587: { /f aa 0 get def
588: /v gb.v def
589: /setarg 1 def
590: } { } ifelse
591: typev [ArrayP StringP] eq
592: { /f aa 0 get def
593: /v aa 1 get def
594: /setarg 1 def
595: } { } ifelse
596: typev [ArrayP ArrayP] eq
597: { /f aa 0 get def
598: /v aa 1 get from_records def
599: /setarg 1 def
600: } { } ifelse
601: typev [ArrayP StringP ArrayP] eq
602: { /f aa 0 get def
603: /v aa 1 get def
604: /wv aa 2 get def
605: /setarg 1 def
606: } { } ifelse
607: typev [ArrayP ArrayP ArrayP] eq
608: { /f aa 0 get def
609: /v aa 1 get from_records def
610: /wv aa 2 get def
611: /setarg 1 def
612: } { } ifelse
613:
614: setarg { } { (pgb : Argument mismatch) message error } ifelse
615:
616: [(KanGBmessage) gb.verbose ] system_variable
617:
618: %% Input must not be vectors.
619: f { toString } map /f set
620:
621: wv isInteger {
622: [v ring_of_polynomials
623: 0] define_ring
624: /termorder 1 def
625: }{
626: [v ring_of_polynomials
627: wv weight_vector
628: 0] define_ring
629: wv gb.isTermOrder /termorder set
630: } ifelse
631: termorder {
632: f { . dehomogenize } map /f set
633: [(UseCriterion1) 1] system_variable
634: [f] groebner_sugar 0 get /gg set
635: [(UseCriterion1) 0] system_variable
636: }{
637: f { . dehomogenize homogenize} map /f set
638: [(UseCriterion1) 1] system_variable
639: [f] groebner 0 get /gg set
640: [(UseCriterion1) 0] system_variable
641: }ifelse
642: wv isInteger {
643: /ans [gg gg {init} map] def
644: }{
645: /ans [gg gg {wv 0 get weightv init} map] def
646: }ifelse
647: /arg1 ans def
648: ] pop
649: popEnv
650: popVariables
651: arg1
652: } def
653: (pgb ) messagen-quiet
654:
655: /gb.toMatrixOfString {
656: /arg1 set
657: [/in-gb.toMatrixOfString /ff /aa /ans] pushVariables
658: [
659: /aa arg1 def
660: aa length 0 eq { /ans [ ] def /gb.toMatrixOfString.LLL goto }{ } ifelse
661: aa 0 get isArray {
662: /gb.itWasMatrix aa 0 get length def
663: }{
664: /gb.itWasMatrix 0 def
665: } ifelse
666: aa {
667: /ff set
668: ff isArray {
669: ff {toString} map /ff set
670: }{
671: [ff toString] /ff set
672: } ifelse
673: ff
674: } map /ans set
675: /gb.toMatrixOfString.LLL
676: /arg1 ans def
677: ] pop
678: popVariables
679: arg1
680: } def
681: [(gb.toMatrixOfString)
682: [(It translates given input into a matrix form which is a data structure)
683: (for computations of kernel, image, cokernel, etc.)
684: (gb.itWasMatrix is set to the length of the input vector.)
685: $Example 1: $
686: $ [ (x). (y).] gb.toMatrixOfString ==> [[(x)] [(y)]] $
687: $ gb.itWasMatrix is 0.$
688: $Example 2: $
689: $ [ [(x). (1).] [(y). (0).]] gb.toMatrixOfString ==> [ [(x) (1)] [(y) (0)]] $
690: $ gb.itWasMatrix is 2.$
691: ]] putUsages
692:
693: /gb.toMatrixOfPoly {
694: /arg1 set
695: [/in-gb.toMatrixOfPoly /ff /aa /ans] pushVariables
696: [
697: /aa arg1 def
698: aa length 0 eq { /ans [ ] def /gb.toMatrixOfPoly.LLL goto }{ } ifelse
699: aa 0 get isArray {
700: /gb.itWasMatrix aa 0 get length def
701: }{
702: /gb.itWasMatrix 0 def
703: } ifelse
704: aa {
705: /ff set
706: ff isArray {
707: }{
708: [ff] /ff set
709: } ifelse
710: ff
711: } map /ans set
712: /gb.toMatrixOfPoly.LLL
713: /arg1 ans def
714: ] pop
715: popVariables
716: arg1
717: } def
718: [(gb.toMatrixOfPoly)
719: [(It translates given input into a matrix form which is a data structure)
720: (for computations of kernel, image, cokernel, etc.)
721: (gb.itWasMatrix is set to the length of the input vector.)
722: $Example 1: $
723: $ [ (x). (y).] gb.toMatrixOfPoly ==> [[(x)] [(y)]] $
724: $ gb.itWasMatrix is 0.$
725: $Example 2: $
726: $ [ [(x). (1).] [(y). (0).]] gb.toMatrixOfPoly ==> [ [(x) (1)] [(y) (0)]] $
727: $ gb.itWasMatrix is 2.$
728: ]] putUsages
729:
730: /gb.getWeight {
731: /arg1 set
732: [/in-gb.getWeight /rr /ww /vv /ans /nn /ii] pushVariables
733: [(CurrentRingp)] pushEnv
734: [
735: /rr arg1 def
736: rr ring_def
737: getVariableNames /vv set
738: [(orderMatrix)] system_variable 0 get /ww set
739: /nn vv length 1 sub def
740: [0 1 nn {
741: /ii set
742: ww ii get 0 eq {
743: } {
744: vv ii get
745: ww ii get
746: } ifelse
747: } for
748: ] /ans set
749: /arg1 [ans] def
750: ] pop
751: popEnv
752: popVariables
753: arg1
754: } def
755: [(gb.getWeight)
756: [(ring gb.getWeight wv)
757: (It gets the weight vector field of the ring ring.)
758: ]] putUsages
759:
760:
761: /gb.isTermOrder {
762: /arg1 set
763: [/in-gb.isTermOrder /vv /ww /yes /i /j] pushVariables
764: [
765: /vv arg1 def
766: /yes 1 def
767: 0 1 vv length 1 sub {
768: /i set
769: /ww vv i get def
770: 0 1 ww length 1 sub {
771: /j set
772: ww j get isInteger {
773: ww j get 0 lt { /yes 0 def } { } ifelse
774: }{ } ifelse
775: }for
776: }for
777: /arg1 yes def
778: ] pop
779: popVariables
780: arg1
781: } def
782: [(gb)
783: [(a gb b)
784: (array a; array b;)
785: (b : [g ii]; array g; array in; g is a Grobner basis of f)
786: ( in the ring of differential operators.)
787: $ ii is the initial ideal in case of w is given or <<a>> belongs$
788: $ to a ring. In the other cases, it returns the initial monominal.$
789: (a : [f ]; array f; f is a set of generators of an ideal in a ring.)
790: (a : [f v]; array f; string v; v is the variables. )
791: (a : [f v w]; array f; string v; array of array w; w is the weight matirx.)
1.11 takayama 792: (a : [f v w ds]; array f; string v; array of array w; w is the weight matirx.)
793: ( array ds; ds is the degree shift )
1.1 maekawa 794: ( )
1.14 takayama 795: (gb.authoHomogenize 1 [default])
1.17 takayama 796: (gb.oxRingStructure )
1.14 takayama 797: ( )
1.1 maekawa 798: $Example 1: [ [( (x Dx)^2 + (y Dy)^2 -1) ( x y Dx Dy -1)] (x,y) $
799: $ [ [ (Dx) 1 ] ] ] gb pmat ; $
800: (Example 2: )
801: (To put h=1, type in, e.g., )
802: $ [ [(2 x Dx + 3 y Dy+6) (2 y Dx + 3 x^2 Dy)] (x,y) $
803: $ [[(x) -1 (Dx) 1 (y) -1 (Dy) 1]]] gb /gg set gg dehomogenize pmat ;$
804: ( )
805: $Example 3: [ [( (x Dx)^2 + (y Dy)^2 -1) ( x y Dx Dy -1)] (x,y) $
806: $ [ [ (Dx) 1 (Dy) 1] ] ] gb pmat ; $
807: ( )
808: $Example 4: [[ [(x^2) (y+x)] [(x+y) (y^3)] [(2 x^2+x y) (y+x+x y^3)]] (x,y) $
809: $ [ [ (x) -1 (y) -1] ] ] gb pmat ; $
1.12 takayama 810: ( )
811: $Example 5: [[ [(x^2) (y+x)] [(x+y) (y^3)] [(2 x^2+x y) (y+x+x y^3)]] (x,y) $
812: $ [ [ (x) -1 (y) -1] ] [[0 1] [-3 1] ] ] gb pmat ; $
1.23 takayama 813: ( )
814: $Example 6: [ [( (x Dx)^2 + (y Dy)^2 - x y Dx Dy + 1) ( x y Dx Dy -1)] (x,y) $
815: $ [ [ (Dx) 1 ] ] ] [(reduceOnly) 1] setAttributeList gb pmat ; $
816: ( )
817: $Example 7: [ [( (x Dx)^2 + (y Dy)^2 + 1) ( x y Dx Dy -1)] (x,y) $
818: $ [ [ (Dx) 1 ] ] ] [(gbCheck) 1] setAttributeList gb getAttributeList ::$
1.1 maekawa 819: ( )
820: (cf. gb, groebner, groebner_sugar, syz. )
821: ]] putUsages
822:
823: [(pgb)
824: [(a pgb b)
825: (array a; array b;)
826: (b : [g ii]; array g; array in; g is a Grobner basis of f)
827: ( in the ring of polynomials.)
828: $ ii is the initial ideal in case of w is given or <<a>>belongs$
829: $ to a ring. In the other cases, it returns the initial monominal.$
830: (a : [f ]; array f; f is a set of generators of an ideal in a ring.)
831: (a : [f v]; array f; string v; v is the variables.)
832: (a : [f v w]; array f; string v; array of array w; w is the weight matirx.)
833: $Example 1: [(x,y) ring_of_polynomials 0] define_ring $
834: $ [ [(x^2+y^2-4). (x y -1).] ] pgb :: $
835: $Example 2: [ [(x^2+y^2) (x y)] (x,y) [ [(x) -1 (y) -1] ] ] pgb :: $
1.23 takayama 836: $Example 3: [ [(x^2+y^2 + x y ) (x y)] (x,y) [ [(x) -1 (y) -1] ] ] $
1.24 takayama 837: $ [(reduceOnly) 1] setAttributeList pgb :: $
1.1 maekawa 838: (cf. gb, groebner, groebner_sugar, syz. )
839: ]] putUsages
840:
841:
842: %/syz.v 1 def
843: /syz.v 1 def
844: /syz.verbose 0 def
845: /syz {
846: /arg1 set
847: [/in-syz /aa /typev /setarg /f /v
848: /gg /wv /termorder /vec /ans /ggall /vectorInput /vsize /gtmp /gtmp2
849: /rr /mm
850: ] pushVariables
851: [(CurrentRingp) (KanGBmessage)] pushEnv
852: [
853:
854: /aa arg1 def
855: aa isArray { } { (<< array >> syz) error } ifelse
856: /setarg 0 def
857: /wv 0 def
858: aa { tag } map /typev set
859: typev [ ArrayP ] eq
860: { /f aa 0 get def
861: /v syz.v def
862: /setarg 1 def
863: } { } ifelse
864: typev [ArrayP StringP] eq
865: { /f aa 0 get def
866: /v aa 1 get def
867: /setarg 1 def
868: } { } ifelse
1.9 takayama 869: typev [ArrayP RingP] eq
870: { /f aa 0 get def
871: /v aa 1 get def
872: /setarg 1 def
873: } { } ifelse
1.1 maekawa 874: typev [ArrayP ArrayP] eq
875: { /f aa 0 get def
876: /v aa 1 get from_records def
877: /setarg 1 def
878: } { } ifelse
879: typev [ArrayP StringP ArrayP] eq
880: { /f aa 0 get def
881: /v aa 1 get def
882: /wv aa 2 get def
883: /setarg 1 def
884: } { } ifelse
1.9 takayama 885: typev [ArrayP RingP ArrayP] eq
886: { /f aa 0 get def
887: /v aa 1 get def
888: /wv aa 2 get def
889: /setarg 1 def
890: } { } ifelse
1.1 maekawa 891: typev [ArrayP ArrayP ArrayP] eq
892: { /f aa 0 get def
893: /v aa 1 get from_records def
894: /wv aa 2 get def
895: /setarg 1 def
896: } { } ifelse
897:
898: setarg { } { (syz : Argument mismatch) error } ifelse
899:
900: [(KanGBmessage) syz.verbose ] system_variable
901:
902:
903:
904: %%% Start of the preprocess
1.9 takayama 905: v tag RingP eq {
906: /rr v def
907: }{
908: f getRing /rr set
909: } ifelse
1.1 maekawa 910: %% To the normal form : matrix expression.
911: f gb.toMatrixOfString /f set
912: /mm gb.itWasMatrix def
913: mm 0 gt {
914: /vectorInput 1 def
915: }{
916: /vectorInput 1 def
917: } ifelse
918:
919: rr tag 0 eq {
920: %% Define our own ring
921: v isInteger {
922: (Error in syz: Specify variables) error
923: } { } ifelse
924: wv isInteger {
925: [v ring_of_differential_operators
926: 0] define_ring
927: /termorder 1 def
928: }{
929: [v ring_of_differential_operators
930: wv weight_vector
931: 0] define_ring
932: wv gb.isTermOrder /termorder set
933: } ifelse
934: }{
935: %% Use the ring structre given by the input.
936: v isInteger not {
1.7 takayama 937: gb.warning {
938: (Warning : the given ring definition is not used.) message
939: } { } ifelse
1.1 maekawa 940: } { } ifelse
941: rr ring_def
942: /wv rr gb.getWeight def
943: wv gb.isTermOrder /termorder set
944: } ifelse
945: %%% Enf of the preprocess
946:
947: termorder {
948: f { {. dehomogenize} map } map /f set
949: [f [(needBack) (needSyz)]] groebner_sugar /ggall set
950: ggall 2 get /gg set
951: }{
952: f { {. dehomogenize } map homogenize } map /f set
953: [f [(needBack) (needSyz)]] groebner /ggall set
954: ggall 2 get /gg set
955: }ifelse
956: vectorInput {
957: /vsize f 0 get length def %% input vector size.
958: /gtmp ggall 0 get def
959: [vsize gtmp] toVectors /gtmp set
960: ggall 0 gtmp put
961: }{ } ifelse
1.19 takayama 962:
1.27 ! takayama 963: gg length 0 eq { % there is no syzygy
! 964: ggall getRing (oxRingStructure) dc /gb.oxRingStructure set
! 965: }{
! 966: gg getRing (oxRingStructure) dc /gb.oxRingStructure set
! 967: } ifelse
1.19 takayama 968:
969: /arg1 [gg dehomogenize ggall] def
1.1 maekawa 970: ] pop
971: popEnv
972: popVariables
973: arg1
974: } def
975: (syz ) messagen-quiet
976:
977: [(syz)
978: [(a syz [b c])
979: (array a; array b; array c)
980: (b is a set of generators of the syzygies of f.)
981: (c = [gb, backward transformation, syzygy without dehomogenization].)
982: (See groebner.)
983: (a : [f ]; array f; f is a set of generators of an ideal in a ring.)
984: (a : [f v]; array f; string v; v is the variables.)
985: (a : [f v w]; array f; string v; array of array w; w is the weight matirx.)
1.9 takayama 986: ( v may be a ring object. )
1.1 maekawa 987: $Example 1: [(x,y) ring_of_polynomials 0] define_ring $
988: $ [ [(x^2+y^2-4). (x y -1).] ] syz :: $
989: $Example 2: [ [(x^2+y^2) (x y)] (x,y) [ [(x) -1 (y) -1] ] ] syz :: $
990: $Example 3: [ [( (x Dx)^2 + (y Dy)^2 -1) ( x y Dx Dy -1)] (x,y) $
991: $ [ [ (Dx) 1 ] ] ] syz pmat ; $
992: $Example 4: [ [(2 x Dx + 3 y Dy+6) (2 y Dx + 3 x^2 Dy)] (x,y) $
993: $ [[(x) -1 (Dx) 1 (y) -1 (Dy) 1]]] syz pmat ;$
994: $Example 5: [ [ [(x^2) (y+x)] [(x+y) (y^3)] [(2 x^2+x y) (y+x+x y^3)]] $
995: $ (x,y) ] syz pmat ;$
996: $Example 6: [ [ [(x^2) (y+x)] [(x+y) (y^3)] [(2 x^2+x y) (y+x+x y^3)]] $
997: $ (x,y) [[(x) -1 (y) -2]] ] syz pmat ;$
998: $Example 7: [ [ [(0) (0)] [(0) (0)] [(x) (y)]] $
999: $ [(x) (y)]] syz pmat ;$
1000: ]] putUsages
1001:
1002:
1003: %%%%%%%%%%%%%%%%%% package fs %%%%%%%%%%%%%%%%%%%%%%%
1004: [(genericAnn)
1005: [ (f [s v1 v2 ... vn] genericAnn [L1 ... Lm])
1006: (L1, ..., Lm are annihilating ideal for f^s.)
1007: (f is a polynomial of v1, ..., vn)
1008: (<string> | <poly> f, s, v1, ..., vn ; <poly> L1, ..., Lm )
1009: $Example: (x^3+y^3+z^3) [(s) (x) (y) (z)] genericAnn$
1010: ]
1011: ] putUsages ( genericAnn ) messagen-quiet
1012: /fs.verbose 0 def
1013: /genericAnn {
1014: /arg2 set /arg1 set
1015: [/in-genericAnn /f /vlist /s /vvv /nnn /rrr
1016: /v1 /ops /ggg /ggg0
1017: ] pushVariables
1018: [(CurrentRingp) (KanGBmessage)] pushEnv
1019: [
1020: /f arg1 def /vlist arg2 def
1021: f toString /f set
1022: vlist { toString } map /vlist set
1023: [(KanGBmessage) fs.verbose] system_variable
1024: /s vlist 0 get def
1025: /vvv (_u,_v,_t,) vlist rest { (,) 2 cat_n } map aload length /nnn set
1026: s nnn 2 add cat_n def
1027: fs.verbose { vvv message } { }ifelse
1028: [vvv ring_of_differential_operators
1029: [[(_u) 1 (_v) 1]] weight_vector 0] define_ring /rrr set
1030:
1031: [ (_u*_t). f . sub (_u*_v-1). ]
1032: vlist rest { /v1 set
1033: %%D-clean f . (D) v1 2 cat_n . 1 diff0 (_v*D_t). mul
1034: f . @@@.Dsymbol v1 2 cat_n . 1 diff0 [(_v*) @@@.Dsymbol (_t)] cat . mul
1035: @@@.Dsymbol v1 2 cat_n . add } map
1036: join
1037: /ops set
1038: ops {[[(h). (1).]] replace } map /ops set
1039: fs.verbose { ops message } { }ifelse
1040: [ops] groebner_sugar 0 get /ggg0 set
1041: fs.verbose { ggg0 message } { } ifelse
1042: ggg0 [(_u) (_v)] eliminatev
1043: %%D-clean { [(_t).] [ (D_t).] [s .] distraction
1044: { [(_t).] [ [@@@.Dsymbol (_t)] cat .] [s .] distraction
1045: [[s . << (0). s . sub (1). sub >>]] replace
1046: } map /arg1 set
1047: ] pop
1048: popEnv
1049: popVariables
1050: arg1
1051: } def
1052:
1053: %% Find differential equations for f^(m), r0 the minimal integral root.
1054: [(annfs)
1055: [( [ f v m r0] annfs g )
1056: (It returns the annihilating ideal of f^m where r0 must be smaller)
1057: (or equal to the minimal integral root of the b-function.)
1058: (Or, it returns the annihilating ideal of f^r0, r0 and the b-function)
1059: (where r0 is the minial integral root of b.)
1060: (For the algorithm, see J. Pure and Applied Algebra 117&118(1997), 495--518.)
1061: (Example 1: [(x^2+y^2+z^2+t^2) (x,y,z,t) -1 -2] annfs :: )
1062: $ It returns the annihilating ideal of (x^2+y^2+z^2+t^2)^(-1).$
1063: (Example 2: [(x^2+y^2+z^2+t^2) (x,y,z,t)] annfs :: )
1064: $ It returns the annihilating ideal of f^r0 and [r0, b-function]$
1065: $ where r0 is the minimal integral root of the b-function.$
1066: (Example 3: [(x^2+y^2+z^2) (x,y,z) -1 -1] annfs :: )
1067: (Example 4: [(x^3+y^3+z^3) (x,y,z)] annfs :: )
1068: (Example 5: [((x1+x2+x3)(x1 x2 + x2 x3 + x1 x3) - t x1 x2 x3 ) )
1069: ( (t,x1,x2,x3) -1 -2] annfs :: )
1070: ( Note that the example 4 uses huge memory space.)
1.26 takayama 1071: ( )
1072: (Note: This implementation is stable but obsolete. )
1073: (As to faster implementation, we refer to ann0 and ann of Risa/Asir )
1074: (Visit http://www.math.kobe-u.ac.jp/Asir )
1.1 maekawa 1075: ]] putUsages
1076: ( annfs ) messagen-quiet
1077: /annfs.verbose fs.verbose def
1078: /annfs.v [(x) (y) (z)] def
1079: /annfs.s (_s) def
1080: %% The first variable must be s.
1081: /annfs {
1082: /arg1 set
1083: [/in-annfs /aa /typev /setarg /v /m /r0 /gg /ss /fs /gg2
1084: /ans /vtmp /w2 /velim /bbb /rrr /r0
1085: ] pushVariables
1086: [(CurrentRingp) (KanGBmessage)] pushEnv
1087: [
1088:
1089: /aa arg1 def
1090: aa isArray { } { ( << array >> annfs) error } ifelse
1091: /setarg 0 def
1092: aa { tag } map /typev set
1093: /r0 [ ] def
1094: /m [ ] def
1095: /v annfs.v def
1096: aa 0 << aa 0 get toString >> put
1097: typev [ StringP ] eq
1098: { /f aa 0 get def
1099: /setarg 1 def
1100: } { } ifelse
1101: typev [StringP StringP] eq
1102: { /f aa 0 get def
1103: /v [ aa 1 get to_records pop ] def
1104: /setarg 1 def
1105: } { } ifelse
1106: typev [StringP ArrayP] eq
1107: { /f aa 0 get def
1108: /v aa 1 get def
1109: /setarg 1 def
1110: } { } ifelse
1111: typev [StringP ArrayP IntegerP IntegerP] eq
1112: { /f aa 0 get def
1113: /v aa 1 get def
1114: /m aa 2 get def
1115: /r0 aa 3 get def
1116: /setarg 1 def
1117: } { } ifelse
1118: typev [StringP StringP IntegerP IntegerP] eq
1119: { /f aa 0 get def
1120: /v [ aa 1 get to_records pop ] def
1121: /m aa 2 get def
1122: /r0 aa 3 get def
1123: /setarg 1 def
1124: } { } ifelse
1125: setarg 1 eq { } { (annfs : wrong argument) error } ifelse
1126:
1127: [annfs.s] v join /v set
1128:
1129: /ss v 0 get def
1130: annfs.verbose {
1131: (f, v, s, f^{m}, m+r0 = ) messagen
1132: [ f (, ) v (, ) ss (, )
1133: (f^) m (,) m (+) r0 ] {messagen} map ( ) message
1134: } { } ifelse
1135:
1136: f v genericAnn /fs set
1137:
1138: annfs.verbose {
1139: (genericAnn is ) messagen fs message
1140: } { } ifelse
1141: [(KanGBmessage) annfs.verbose] system_variable
1142:
1143: m isArray {
1144: %% Now, let us find the b-function. /vtmp /w2 /velim /bbb /rrr /r0
1145: v rest { /vtmp set vtmp @@@.Dsymbol vtmp 2 cat_n } map /velim set
1146: velim { 1 } map /w2 set
1147: annfs.verbose { w2 message } { } ifelse
1148: [v from_records ring_of_differential_operators
1149: [w2] weight_vector 0] define_ring
1150: [ fs { toString . } map [ f toString . ] join ]
1151: groebner_sugar 0 get velim eliminatev 0 get /bbb set
1152: [[(s) annfs.s] from_records ring_of_polynomials 0] define_ring
1153: bbb toString . [[annfs.s . (s).]] replace /bbb set
1154: annfs.verbose { bbb message } { } ifelse
1155: bbb findIntegralRoots /rrr set
1156: rrr 0 get /r0 set %% minimal integral root.
1157: annfs.verbose { rrr message } { } ifelse
1158: fs 0 get (ring) dc ring_def
1159: fs { [[annfs.s . r0 toString .]] replace } map /ans set
1160: /ans [ans [r0 bbb]] def
1161: /annfs.label1 goto
1162: } { } ifelse
1163: m 0 ge {
1164: (annfs works only for getting annihilating ideal for f^(negative))
1165: error
1166: } { } ifelse
1167: r0 isArray {
1168: [(Need to compute the minimal root of b-function) nl
1169: (It has not been implemented.) ] cat
1170: error
1171: } { } ifelse
1172:
1173: [v from_records ring_of_differential_operators 0] define_ring
1174: fs {toString . dehomogenize [[ss . r0 (poly) dc]] replace}
1175: map /gg set
1176: annfs.verbose { gg message } { } ifelse
1177:
1178: [ [f . << m r0 sub >> npower ] gg join
1179: [(needBack) (needSyz)]] groebner_sugar 2 get /gg2 set
1180:
1181: gg2 { 0 get } map /ans set
1182: /ans ans { dup (0). eq {pop} { } ifelse } map def
1183:
1184: /annfs.label1
1185: /arg1 ans def
1186: ] pop
1187: popEnv
1188: popVariables
1189: arg1
1190: } def
1191:
1192: /genericAnnWithL.s (s) def
1193: /annfs.verify 0 def
1194: /genericAnnWithL {
1195: /arg1 set
1196: [/in-genericAnnWithL /aa /typev /setarg /v /m /r0 /gg /ss /fs /gg2
1197: /ans /vtmp /w2 /velim /bbb /rrr /r0 /myL /mygb /jj
1198: ] pushVariables
1199: [(CurrentRingp) (KanGBmessage) (Homogenize)] pushEnv
1200: [
1201:
1202: /aa arg1 def
1203: aa isArray { } { ( << array >> annfs) error } ifelse
1204: /setarg 0 def
1205: aa { tag } map /typev set
1206: /r0 [ ] def
1207: /m [ ] def
1208: /v annfs.v def
1209: aa 0 << aa 0 get toString >> put
1210: typev [ StringP ] eq
1211: { /f aa 0 get def
1212: /setarg 1 def
1213: } { } ifelse
1214: typev [StringP StringP] eq
1215: { /f aa 0 get def
1216: /v [ aa 1 get to_records pop ] def
1217: /setarg 1 def
1218: } { } ifelse
1219: typev [StringP ArrayP] eq
1220: { /f aa 0 get def
1221: /v aa 1 get def
1222: /setarg 1 def
1223: } { } ifelse
1224: setarg 1 eq { } { (genericAnnWithL : wrong argument) error } ifelse
1225:
1226: [genericAnnWithL.s] v join /v set
1227:
1228: /ss v 0 get def
1229: annfs.verbose {
1230: (f, v, s, f^{m}, m+r0 = ) messagen
1231: [ f (, ) v (, ) ss (, )
1232: (f^) m (,) m (+) r0 ] {messagen} map ( ) message
1233: } { } ifelse
1234:
1235: f v genericAnn /fs set
1236:
1237: annfs.verbose {
1238: (genericAnn is ) messagen fs message
1239: } { } ifelse
1240: [(KanGBmessage) annfs.verbose] system_variable
1241:
1242: m isArray {
1243: %% Now, let us find the b-function. /vtmp /w2 /velim /bbb /rrr /r0
1244: v rest { /vtmp set vtmp @@@.Dsymbol vtmp 2 cat_n } map /velim set
1245: velim { 1 } map /w2 set
1246: annfs.verbose { w2 message } { } ifelse
1247: [v from_records ring_of_differential_operators
1248: [w2] weight_vector 0] define_ring
1249:
1250: [ [ f toString . ] fs { toString . } map join [(needBack)]]
1251: groebner_sugar /mygb set
1252: mygb 0 get velim eliminatev 0 get /bbb set
1253: mygb 0 get bbb position /jj set
1254: mygb 1 get jj get 0 get /myL set
1255:
1256: annfs.verbose { bbb message } { } ifelse
1257:
1258: annfs.verify {
1259: (Verifying L f - b belongs to genericAnn(f)) message
1260: [(Homogenize) 0] system_variable
1261: << myL f . mul bbb sub >>
1262: [fs { toString . } map] groebner_sugar 0 get
1263: reduction 0 get message
1264: (Is it zero? Then it's fine.) message
1265: } { } ifelse
1266:
1267: /ans [bbb [myL fs] ] def
1268: /annfs.label1 goto
1269: } { } ifelse
1270:
1271: /annfs.label1
1272: /arg1 ans def
1273: ] pop
1274: popEnv
1275: popVariables
1276: arg1
1277: } def
1278:
1279:
1280: [(genericAnnWithL)
1281: [$[f v] genericAnnWithL [b [L I]]$
1282: $String f,v; poly b,L; array of poly I;$
1283: $f is a polynomial given by a string. v is the variables.$
1284: $ v must not contain names s, e.$
1285: $b is the b-function (Bernstein-Sato polynomial) for f and$
1286: $ L is the operator satisfying L f^{s+1} = b(s) f^s $
1287: $ I is the annihilating ideal of f^s.$
1288: $cf. bfunction, annfs, genericAnn.$
1289: $Example 1: [(x^2+y^2) (x,y)] genericAnnWithL ::$
1290: $Example 2: [(x^2+y^2+z^2) (x,y,z)] genericAnnWithL ::$
1291: $Example 3: [(x^3-y^2 z^2) (x,y,z)] genericAnnWithL ::$
1292: ]] putUsages
1.2 takayama 1293:
1294: /reduction*.noH 0 def
1295: /reduction* {
1296: /arg1 set
1297: [/in-reduction* /aa /typev /setarg /f /v
1298: /gg /wv /termorder /vec /ans /rr /mm /h /size /a0 /a3
1.3 takayama 1299: /opt
1.2 takayama 1300: ] pushVariables
1301: [(CurrentRingp) (KanGBmessage)] pushEnv
1302: [
1303:
1304: /aa arg1 def
1305: aa isArray { } { ( << array >> reduction*) error } ifelse
1306: /setarg 0 def
1307: /wv 0 def
1308: aa { tag } map /typev set
1309: typev [StringP ArrayP ArrayP] eq
1310: typev [ArrayP ArrayP ArrayP] eq or
1311: typev [PolyP ArrayP ArrayP] eq or
1312: { /h aa 0 get def
1313: /f aa 1 get def
1314: /v aa 2 get from_records def
1315: /setarg 1 def
1316: } { } ifelse
1317: typev [StringP ArrayP ArrayP ArrayP] eq
1318: typev [ArrayP ArrayP ArrayP ArrayP] eq or
1319: typev [PolyP ArrayP ArrayP ArrayP] eq or
1320: { /h aa 0 get def
1321: /f aa 1 get def
1322: /v aa 2 get from_records def
1323: /wv aa 3 get def
1324: /setarg 1 def
1325: } { } ifelse
1326:
1327: setarg { } { (reduction* : Argument mismatch) error } ifelse
1328:
1329: [(KanGBmessage) gb.verbose ] system_variable
1330:
1331: %%% Start of the preprocess
1332: f getRing /rr set
1333:
1334:
1335: rr tag 0 eq {
1336: %% Define our own ring
1337: v isInteger {
1338: (Error in reduction*: Specify variables) error
1339: } { } ifelse
1340: wv isInteger {
1341: [v ring_of_differential_operators
1342: 0] define_ring
1343: /termorder 1 def
1344: }{
1345: [v ring_of_differential_operators
1346: wv weight_vector
1347: 0] define_ring
1348: wv gb.isTermOrder /termorder set
1349: } ifelse
1350: } {
1351: %% Use the ring structre given by the input.
1352: v isInteger not {
1.7 takayama 1353: gb.warning {
1354: (Warning : the given ring definition is not used.) message
1355: } { } ifelse
1.2 takayama 1356: } { } ifelse
1357: rr ring_def
1358: /wv rr gb.getWeight def
1359: wv gb.isTermOrder /termorder set
1360: } ifelse
1361: %%% Enf of the preprocess
1362:
1363: f 0 get isArray {
1364: /size f 0 get length def
1365: f { { toString . } map } map /f set
1366: f fromVectors /f set
1367: }{
1368: /size -1 def
1369: f { toString . } map /f set
1370: } ifelse
1371:
1372: h isArray {
1373: h { toString . } map /h set
1374: [h] fromVectors 0 get /h set
1375: }{
1376: h toString . /h set
1377: } ifelse
1378: f { toString . } map /f set
1.3 takayama 1379: getOptions /opt set
1380: [(ReduceLowerTerms) 1] system_variable
1.2 takayama 1381: reduction*.noH {
1382: h f reduction-noH /ans set
1383: } {
1384: h f reduction /ans set
1385: } ifelse
1.3 takayama 1386: opt restoreOptions
1.2 takayama 1387: size -1 eq not {
1388: [size ans 0 get] toVectors /a0 set
1389: [size ans 3 get] toVectors /a3 set
1390: /ans [a0 ans 1 get ans 2 get a3] def
1391: } { } ifelse
1392: /arg1 ans def
1393: ] pop
1394: popEnv
1395: popVariables
1396: arg1
1397: } def
1398:
1399:
1400: [(reduction*)
1401: [([f base v] reduction* [h c0 syz input])
1402: ([f base v weight] reduction* [h c0 syz input])
1403: (reduction* is an user interface for reduction and reduction-noH.)
1404: (If reduction*.noH is one, then reduction-noH will be called.)
1405: (Example 1: [(x^2) [(x^2+y^2-4) (x y-1)] [(x) (y)]] reduction* )
1406: (Example 2: [[(1) (y^2-1)] [ [(0) (y-1)] [(1) (y+1)]] [(x) (y)]] reduction*)
1407: (Example 3: [(x^2) [(x^2+y^2-4) (x y-1)] [(x) (y)] [[(x) 10]] ] reduction* )
1408: ]] putUsages
1.5 takayama 1409:
1410:
1411:
1412: %% 2000, 6/7, at Sevilla, Hernando Colon
1413: %% macros that deal with homogenized inputs.
1414: %% Sample: [ [(h+x). (x^3).] [(x). (x).]] /ff set
1415: %% [(Homogenize_vec) 0] system_varialbe
1416: %% (grade) (grave1v) switch_function
1417: %% YA homogenization: [ [(h^3*(h+x)). (x^3).] [(h x). (x).]] /ff set
1418: %% 4+0 3+1 2+0 1+1
1419: /gb_h {
1420: /arg1 set
1421: [/in-gb_h /aa /typev /setarg /f /v
1422: /gg /wv /termorder /vec /ans /rr /mm
1.23 takayama 1423: /gb_h.opt /groebnerOptions
1.5 takayama 1424: ] pushVariables
1425: [(CurrentRingp) (KanGBmessage) (Homogenize_vec)] pushEnv
1426: [
1427:
1428: /aa arg1 def
1.6 takayama 1429: gb.verbose { (Getting in gb_h) message } { } ifelse
1.5 takayama 1430: aa isArray { } { ( << array >> gb_h) error } ifelse
1.23 takayama 1431: aa getAttributeList configureGroebnerOption /groebnerOptions set
1.5 takayama 1432: /setarg 0 def
1433: /wv 0 def
1434: aa { tag } map /typev set
1435: typev [ ArrayP ] eq
1436: { /f aa 0 get def
1437: /v gb.v def
1438: /setarg 1 def
1439: } { } ifelse
1440: typev [ArrayP StringP] eq
1441: { /f aa 0 get def
1442: /v aa 1 get def
1443: /setarg 1 def
1444: } { } ifelse
1.10 takayama 1445: typev [ArrayP RingP] eq
1446: { /f aa 0 get def
1447: /v aa 1 get def
1448: /setarg 1 def
1449: } { } ifelse
1.5 takayama 1450: typev [ArrayP ArrayP] eq
1451: { /f aa 0 get def
1452: /v aa 1 get from_records def
1453: /setarg 1 def
1454: } { } ifelse
1455: typev [ArrayP StringP ArrayP] eq
1456: { /f aa 0 get def
1457: /v aa 1 get def
1458: /wv aa 2 get def
1459: /setarg 1 def
1460: } { } ifelse
1461: typev [ArrayP ArrayP ArrayP] eq
1462: { /f aa 0 get def
1463: /v aa 1 get from_records def
1464: /wv aa 2 get def
1465: /setarg 1 def
1466: } { } ifelse
1467:
1468: setarg { } { (gb_h : Argument mismatch) error } ifelse
1469:
1470: [(KanGBmessage) gb.verbose ] system_variable
1471:
1472: %%% Start of the preprocess
1.10 takayama 1473: v tag RingP eq {
1474: /rr v def
1475: }{
1476: f getRing /rr set
1477: } ifelse
1.5 takayama 1478: %% To the normal form : matrix expression.
1479: f gb.toMatrixOfString /f set
1480: /mm gb.itWasMatrix def
1481:
1482: rr tag 0 eq {
1483: %% Define our own ring
1484: v isInteger {
1485: (Error in gb_h: Specify variables) error
1486: } { } ifelse
1487: wv isInteger {
1488: [v ring_of_differential_operators
1489: 0] define_ring
1490: /termorder 1 def
1491: }{
1492: [v ring_of_differential_operators
1493: wv weight_vector
1494: 0] define_ring
1495: wv gb.isTermOrder /termorder set
1496: } ifelse
1497: } {
1498: %% Use the ring structre given by the input.
1499: v isInteger not {
1.7 takayama 1500: gb.warning {
1501: (Warning : the given ring definition is not used.) message
1502: } { } ifelse
1.5 takayama 1503: } { } ifelse
1504: rr ring_def
1505: /wv rr gb.getWeight def
1506: wv gb.isTermOrder /termorder set
1507: } ifelse
1508: getOptions /gb_h.opt set
1509: (grade) (module1v) switch_function
1.6 takayama 1510: [(Homogenize_vec) 0] system_variable
1.5 takayama 1511: %%% End of the preprocess
1512:
1.23 takayama 1513: groebnerOptions gb.options mergeGroebnerOptions /groebnerOptions set
1514: gb.verbose { (groebnerOptions = ) messagen groebnerOptions message } { } ifelse
1.5 takayama 1515: termorder {
1516: f { {. } map } map /f set
1.23 takayama 1517: [f groebnerOptions] groebner 0 get /gg set %% Do not use sugar.
1.5 takayama 1518: }{
1519: f { {. } map} map /f set
1520: f fromVectors /f set
1.23 takayama 1521: [f groebnerOptions] groebner 0 get /gg set
1.5 takayama 1522: }ifelse
1523: wv isInteger {
1524: /ans [gg gg {init} map] def
1525: }{
1526: /ans [gg gg {wv 0 get weightv init} map] def
1527: }ifelse
1528:
1529: %% Postprocess : recover the matrix expression.
1530: mm {
1531: ans { /tmp set [mm tmp] toVectors } map
1532: /ans set
1533: }{ }
1534: ifelse
1.23 takayama 1535: ans gg getAttributeList setAttributeList /ans set
1.5 takayama 1536: gb_h.opt restoreOptions
1.6 takayama 1537: gb.verbose { (Getting out of gb_h) message } { } ifelse
1.5 takayama 1538: %%
1539:
1540: /arg1 ans def
1541: ] pop
1542: popEnv
1543: popVariables
1544: arg1
1545: } def
1546: (gb_h ) messagen-quiet
1547: [(gb_h)
1548: [(a gb_h b)
1549: (array a; array b;)
1550: (b : [g ii]; array g; array in; g is a Grobner basis of f)
1551: ( in the ring of homogenized differential operators.)
1552: ( The input must be homogenized properly.)
1553: ( Inproper homogenization may cause an infinite loop.)
1554: ( Each element of vectors must be homogenized. If you are using )
1555: ( non-term orders, all elements of vectors must have the same degree with)
1556: ( a proper degree shift vector.)
1557: $ ii is the initial ideal in case of w is given or <<a>> belongs$
1558: $ to a ring. In the other cases, it returns the initial monominal.$
1559: $ [(Homogenize_vec) 0] system_variable (grade) (module1v) switch_function$
1560: (a : [f ]; array f; f is a set of generators of an ideal in a ring.)
1561: (a : [f v]; array f; string v; v is the variables. )
1.10 takayama 1562: (a : [f r]; array f; ring r )
1.5 takayama 1563: (a : [f v w]; array f; string v; array of array w; w is the weight matirx.)
1564: ( )
1565: $Example 1: [ [( (x Dx)^2 + (y Dy)^2 -h^4) ( x y Dx Dy -h^4)] (x,y) $
1566: $ [ [ (Dx) 1 ] ] ] gb_h pmat ; $
1567: $Example 2: [ [[(h+x) (x^3)] [(x) (x)]] (x)] gb_h pmat $
1568: $Example 3: [[ [(x^2) (y+x)] [(x+y) (y^3)] $
1569: $ [(2 x^2+x y) (y h^3 +x h^3 +x y^3)]] (x,y) $
1570: $ [ [ (x) -1 (y) -1] ] ] gb_h pmat ; $
1571: $ Infinite loop: see by [(DebugReductionRed) 1] system_variable$
1572: $Example 4: [[ [(x^2) (y+x)] [(x^2+y^2) (y)] $
1573: $ [(2 x^5+x y^4) (y h^3 +x h^3 +x y^3)]] (x,y) $
1574: $ [ [ (x) -1 (y) -1] ] ] gb_h pmat ; $
1575: $ This is fine because grade(v_1) = grade(v_2)+1 for all vectors. $
1.23 takayama 1576: $Example 5: [ [[(h+x) (x^3 + 2 h^3 + 2 x h^2)] [(x) (x)]] (x)] $
1.24 takayama 1577: $ [(reduceOnly) 1] setAttributeList gb_h pmat $
1.5 takayama 1578: ( )
1579: (cf. gb, groebner, syz_h. )
1580: ]] putUsages
1581:
1582: /syz_h {
1583: /arg1 set
1584: [/in-syz_h /aa /typev /setarg /f /v
1585: /gg /wv /termorder /vec /ans /ggall /vectorInput /vsize /gtmp /gtmp2
1586: /rr /mm
1587: /syz_h.opt
1588: ] pushVariables
1589: [(CurrentRingp) (KanGBmessage)] pushEnv
1590: [
1591:
1592: /aa arg1 def
1593: aa isArray { } { (<< array >> syz_h) error } ifelse
1594: /setarg 0 def
1595: /wv 0 def
1596: aa { tag } map /typev set
1597: typev [ ArrayP ] eq
1598: { /f aa 0 get def
1599: /v syz.v def
1600: /setarg 1 def
1601: } { } ifelse
1602: typev [ArrayP StringP] eq
1603: { /f aa 0 get def
1604: /v aa 1 get def
1605: /setarg 1 def
1606: } { } ifelse
1.10 takayama 1607: typev [ArrayP RingP] eq
1608: { /f aa 0 get def
1609: /v aa 1 get def
1610: /setarg 1 def
1611: } { } ifelse
1.5 takayama 1612: typev [ArrayP ArrayP] eq
1613: { /f aa 0 get def
1614: /v aa 1 get from_records def
1615: /setarg 1 def
1616: } { } ifelse
1617: typev [ArrayP StringP ArrayP] eq
1618: { /f aa 0 get def
1619: /v aa 1 get def
1620: /wv aa 2 get def
1621: /setarg 1 def
1622: } { } ifelse
1623: typev [ArrayP ArrayP ArrayP] eq
1624: { /f aa 0 get def
1625: /v aa 1 get from_records def
1626: /wv aa 2 get def
1627: /setarg 1 def
1628: } { } ifelse
1629:
1630: setarg { } { (syz_h : Argument mismatch) error } ifelse
1631:
1632: [(KanGBmessage) syz.verbose ] system_variable
1633:
1634:
1635:
1636: %%% Start of the preprocess
1.10 takayama 1637: v tag RingP eq {
1638: /rr v def
1639: }{
1640: f getRing /rr set
1641: } ifelse
1.5 takayama 1642: %% To the normal form : matrix expression.
1643: f gb.toMatrixOfString /f set
1644: /mm gb.itWasMatrix def
1645: mm 0 gt {
1646: /vectorInput 1 def
1647: }{
1648: /vectorInput 1 def
1649: } ifelse
1650:
1651: rr tag 0 eq {
1652: %% Define our own ring
1653: v isInteger {
1654: (Error in syz_h: Specify variables) error
1655: } { } ifelse
1656: wv isInteger {
1657: [v ring_of_differential_operators
1658: 0] define_ring
1659: /termorder 1 def
1660: }{
1661: [v ring_of_differential_operators
1662: wv weight_vector
1663: 0] define_ring
1664: wv gb.isTermOrder /termorder set
1665: } ifelse
1666: }{
1667: %% Use the ring structre given by the input.
1668: v isInteger not {
1.7 takayama 1669: gb.warning {
1670: (Warning : the given ring definition is not used.) message
1671: } { } ifelse
1.5 takayama 1672: } { } ifelse
1673: rr ring_def
1674: /wv rr gb.getWeight def
1675: wv gb.isTermOrder /termorder set
1676: } ifelse
1677:
1678: getOptions /syz_h.opt set
1679: (grade) (module1v) switch_function
1680: [(Homogenize_vec) 0] system_variable
1681: %%% End of the preprocess
1682:
1683: termorder {
1684: f { {. } map } map /f set
1685: [f [(needBack) (needSyz)]] groebner /ggall set %% Do not use sugar.
1686: ggall 2 get /gg set
1687: }{
1688: f { {. } map } map /f set
1689: [f [(needBack) (needSyz)]] groebner /ggall set
1690: ggall 2 get /gg set
1691: }ifelse
1692: vectorInput {
1693: /vsize f 0 get length def %% input vector size.
1694: /gtmp ggall 0 get def
1695: [vsize gtmp] toVectors /gtmp set
1696: ggall 0 gtmp put
1697: }{ } ifelse
1698:
1699: syz_h.opt restoreOptions
1700: %%
1701:
1702: /arg1 [gg ggall] def
1703: ] pop
1704: popEnv
1705: popVariables
1706: arg1
1707: } def
1708: (syz_h ) messagen-quiet
1709:
1710: [(syz_h)
1711: [(a syz_h [b c])
1712: (array a; array b; array c)
1713: (b is a set of generators of the syzygies of f in the ring of)
1714: (homogenized differential operators.)
1715: ( The input must be homogenized properly.)
1716: ( Inproper homogenization may cause an infinite loop.)
1717: ( Each element of vectors must be homogenized. If you are using )
1718: ( non-term orders, all elements of vectors must have the same degree with)
1719: ( a proper degree shift vector.)
1720: (c = [gb, backward transformation, syzygy without dehomogenization].)
1721: (See gb_h.)
1722: $ [(Homogenize_vec) 0] system_variable (grade) (module1v) switch_function$
1723: (a : [f ]; array f; f is a set of generators of an ideal in a ring.)
1724: (a : [f v]; array f; string v; v is the variables.)
1.10 takayama 1725: (a : [f r]; array f; ring r )
1.5 takayama 1726: (a : [f v w]; array f; string v; array of array w; w is the weight matirx.)
1727: $Example 1: [ [( (x Dx)^2 + (y Dy)^2 -h^4) ( x y Dx Dy -h^4)] (x,y) $
1728: $ [ [ (Dx) 1 ] ] ] syz_h pmat ; $
1729: $Example 2: [ [[(h+x) (x^3)] [(x) (x)]] (x)] syz_h pmat $
1730: $Example 3: [[ [(x^2) (y+x)] [(x+y) (y^3)] $
1731: $ [(2 x^2+x y) (y h^3 +x h^3 +x y^3)]] (x,y) $
1732: $ [ [ (x) -1 (y) -1] ] ] syz_h pmat ; $
1733: $ Infinite loop: see by [(DebugReductionRed) 1] system_variable$
1734: $Example 4: [[ [(x^2) (y+x)] [(x^2+y^2) (y)] $
1735: $ [(2 x^5+x y^4) (y h^3 +x h^3 +x y^3)]] (x,y) $
1736: $ [ [ (x) -1 (y) -1] ] ] syz_h pmat ; $
1737: $ This is fine because grade(v_1) = grade(v_2)+1 for all vectors. $
1738: $Example 5: [ [ [(0) (0)] [(0) (0)] [(x) (y)]] $
1739: $ [(x) (y)]] syz pmat ;$
1740: ]] putUsages
1741:
1742:
1743: /isSameIdeal {
1744: /arg1 set
1745: [/in-isSameIdeal /aa /ii /jj /iigg /jjgg /vv /ans /k /n /f] pushVariables
1746: [(CurrentRingp)] pushEnv
1747: [
1748: /aa arg1 def
1749: %% comparison of hilbert series has not yet been implemented.
1750: aa length 3 eq { }
1751: { ([ii jj vv] isSameIdeal) error } ifelse
1.6 takayama 1752: gb.verbose { (Getting in isSameIdeal) message } { } ifelse
1.5 takayama 1753: /ii aa 0 get def
1754: /jj aa 1 get def
1755: /vv aa 2 get def
1756: ii length 0 eq jj length 0 eq and
1757: { /ans 1 def /LLL.isSame goto } { } ifelse
1758: [ii vv] gb /iigg set
1759: [jj vv] gb /jjgg set
1760:
1761: iigg getRing ring_def
1762:
1763: /ans 1 def
1764: iigg 0 get { [ (toe_) 3 -1 roll ] gbext } map
1765: /iigg set
1766: jjgg 0 get { [ (toe_) 3 -1 roll ] gbext } map
1767: /jjgg set
1768:
1769: gb.verbose { ( ii < jj ?) messagen } { } ifelse
1770: iigg length /n set
1771: 0 1 n 1 sub {
1772: /k set
1773: iigg k get
1774: jjgg reduction-noH 0 get
1775: (0). eq not { /ans 0 def /LLL.isSame goto} { } ifelse
1776: gb.verbose { (o) messagen } { } ifelse
1777: } for
1778: gb.verbose { ( jj < ii ?) messagen } { } ifelse
1779: jjgg length /n set
1780: 0 1 n 1 sub {
1781: /k set
1782: jjgg k get
1783: iigg reduction-noH 0 get
1784: (0). eq not { /ans 0 def /LLL.isSame goto} { } ifelse
1785: gb.verbose { (o) messagen } { } ifelse
1786: } for
1787: /LLL.isSame
1788: gb.verbose { ( Done) message } { } ifelse
1789: /arg1 ans def
1790: ] pop
1791: popEnv
1792: popVariables
1793: arg1
1794: } def
1795: (isSameIdeal ) messagen-quiet
1796:
1797: [(isSameIdeal)
1798: [([ii jj vv] isSameIdeal bool)
1799: (ii, jj : ideal, vv : variables)
1800: (Note that ii and jj will be dehomogenized and compared in the ring)
1801: (of differential operators. cf. isSameIdeal_h)
1802: $Example 1: [ [(x^3) (y^2)] [(x^2+y) (y)] (x,y)] isSameIdeal $
1803: $Example 2: [ [[(x^3) (0)] [(y^2) (1)]] $
1804: $ [[(x^3+y^2) (1)] [(y^2) (1)]] (x,y)] isSameIdeal $
1805: ]] putUsages
1806:
1807: /isSameIdeal_h {
1808: /arg1 set
1.6 takayama 1809: [/in-isSameIdeal_h /aa /ii /jj /iigg /jjgg /vv /ans /k /n /f
1810: /isSameIdeal_h.opt
1811: ] pushVariables
1812: [(CurrentRingp) (Homogenize_vec)] pushEnv
1.5 takayama 1813: [
1814: /aa arg1 def
1.6 takayama 1815: gb.verbose { (Getting in isSameIdeal_h) message } { } ifelse
1.5 takayama 1816: %% comparison of hilbert series has not yet been implemented.
1817: aa length 3 eq { }
1818: { ([ii jj vv] isSameIdeal_h) error } ifelse
1819: /ii aa 0 get def
1820: /jj aa 1 get def
1821: /vv aa 2 get def
1822: ii length 0 eq jj length 0 eq and
1823: { /ans 1 def /LLL.isSame_h goto } { } ifelse
1824:
1825: [ii vv] gb_h /iigg set
1826: [jj vv] gb_h /jjgg set
1827:
1828: iigg getRing ring_def
1829:
1.6 takayama 1830: getOptions /isSameIdeal_h.opt set
1831: (grade) (module1v) switch_function
1832: [(Homogenize_vec) 0] system_variable
1.5 takayama 1833: /ans 1 def
1834: iigg 0 get { [ (toe_) 3 -1 roll ] gbext } map
1835: /iigg set
1836: jjgg 0 get { [ (toe_) 3 -1 roll ] gbext } map
1837: /jjgg set
1838:
1.8 takayama 1839: gb.verbose { (Comparing) message iigg message (and) message jjgg message }
1840: { } ifelse
1.5 takayama 1841: gb.verbose { ( ii < jj ?) messagen } { } ifelse
1842: iigg length /n set
1843: 0 1 n 1 sub {
1844: /k set
1845: iigg k get
1846: jjgg reduction 0 get
1847: (0). eq not { /ans 0 def /LLL.isSame_h goto} { } ifelse
1848: gb.verbose { (o) messagen } { } ifelse
1849: } for
1850: gb.verbose { ( jj < ii ?) messagen } { } ifelse
1851: jjgg length /n set
1852: 0 1 n 1 sub {
1853: /k set
1854: jjgg k get
1855: iigg reduction 0 get
1856: (0). eq not { /ans 0 def /LLL.isSame_h goto} { } ifelse
1857: gb.verbose { (o) messagen } { } ifelse
1858: } for
1859: /LLL.isSame_h
1860: gb.verbose { ( Done) message } { } ifelse
1.6 takayama 1861: isSameIdeal_h.opt restoreOptions
1.5 takayama 1862: /arg1 ans def
1863: ] pop
1864: popEnv
1865: popVariables
1866: arg1
1867: } def
1868: (isSameIdeal_h ) messagen-quiet
1869:
1870: [(isSameIdeal_h)
1871: [([ii jj vv] isSameIdeal_h bool)
1872: (ii, jj : ideal, vv : variables)
1873: (Note that ii and jj will be compared in the ring)
1874: (of homogenized differential operators. Each element of the vector must be)
1875: (homogenized.)
1876: $Example 1: [ [(x Dx - h^2) (Dx^2)] [(Dx^3) (x Dx-h^2)] (x)] isSameIdeal_h $
1877: $Example 2: [ [[(x Dx -h^2) (0)] [(Dx^2) (1)]] $
1878: $ [[(x Dx -h^2) (0)] [(Dx^2) (1)] [(Dx^3) (Dx)]] (x,y)] isSameIdeal_h $
1879: ]] putUsages
1880:
1.15 takayama 1881: /gb.reduction {
1882: /arg2 set
1883: /arg1 set
1884: [/in-gb.reduction /gbasis /flist /ans /gbasis2
1885: ] pushVariables
1886: [(CurrentRingp) (KanGBmessage)] pushEnv
1887: [
1888: /gbasis arg2 def
1889: /flist arg1 def
1890: gbasis 0 get tag 6 eq { }
1891: { (gb.reduction: the second argument must be a list of lists) error }
1892: ifelse
1893:
1894: gbasis length 1 eq {
1895: gbasis getRing ring_def
1896: /gbasis2 gbasis 0 get def
1897: } {
1898: [ [(1)] ] gbasis rest join gb 0 get getRing ring_def
1.22 takayama 1899: /gbasis2 gbasis 0 get ___ def
1.15 takayama 1900: } ifelse
1901:
1.5 takayama 1902:
1.22 takayama 1903: flist ___ /flist set
1.15 takayama 1904: flist tag 6 eq {
1905: flist { gbasis2 reduction } map /ans set
1906: }{
1907: flist gbasis2 reduction /ans set
1908: } ifelse
1909: /arg1 ans def
1910:
1911: ] pop
1912: popEnv
1913: popVariables
1914: arg1
1915: } def
1916:
1.20 takayama 1917: /gb.reduction_noh {
1918: /arg2 set
1919: /arg1 set
1920: [/in-gb.reduction_noh /gbasis /flist /ans /gbasis2
1921: ] pushVariables
1922: [(CurrentRingp) (KanGBmessage) (Homogenize)] pushEnv
1923: [
1924: /gbasis arg2 def
1925: /flist arg1 def
1926: gbasis 0 get tag 6 eq { }
1927: { (gb.reduction_noh: the second argument must be a list of lists) error }
1928: ifelse
1929:
1930: gbasis length 1 eq {
1931: gbasis getRing ring_def
1932: /gbasis2 gbasis 0 get def
1933: } {
1934: [ [(1)] ] gbasis rest join gb 0 get getRing ring_def
1.22 takayama 1935: /gbasis2 gbasis 0 get ___ def
1.20 takayama 1936: } ifelse
1937:
1938:
1.22 takayama 1939: flist ___ /flist set
1.20 takayama 1940: [(Homogenize) 0] system_variable
1941: flist tag 6 eq {
1942: flist { gbasis2 reduction } map /ans set
1943: }{
1944: flist gbasis2 reduction /ans set
1945: } ifelse
1946: /arg1 ans def
1947:
1948: ] pop
1949: popEnv
1950: popVariables
1951: arg1
1952: } def
1953:
1.15 takayama 1954: /gb.reduction.test {
1955: [
1956: [( 2*(1-x-y) Dx + 1 ) ( 2*(1-x-y) Dy + 1 )]
1957: (x,y) [[(Dx) 1 (Dy) 1] [(x) -1 (y) -1 (Dx) 1 (Dy) 1]]]
1958: gb /gg set
1959:
1960: ((h-x-y)*Dx) [gg 0 get] gb.reduction /gg2 set
1961: gg2 message
1962: (-----------------------------) message
1963:
1964: [[( 2*(h-x-y) Dx + h^2 ) ( 2*(h-x-y) Dy + h^2 )]
1965: (x,y) [[(Dx) 1 (Dy) 1] [(x) -1 (y) -1 (Dx) 1 (Dy) 1]]] /ggg set
1966: ((h-x-y)*Dx) ggg gb.reduction /gg4 set
1967: gg4 message
1968: (-----------------------------) message
1969: [gg2 gg4]
1970: } def
1971: [(gb.reduction)
1972: [ (f basis gb.reduction r)
1973: (f is reduced by basis by the normal form algorithm.)
1974: (The first element of basis <g_1,...,g_m> must be a Grobner basis.)
1975: (r is the return value format of reduction;)
1976: (r=[h,c0,syz,input], h = c0 f + \sum syz_i g_i)
1977: (basis is given in the argument format of gb.)
1.16 takayama 1978: $h[1,1](D)-homogenization is used.$
1.15 takayama 1979: (cf. reduction, gb, ecartd.gb, gb.reduction.test )
1980: $Example:$
1981: $ [[( 2*(h-x-y) Dx + h^2 ) ( 2*(h-x-y) Dy + h^2 )] $
1982: $ (x,y) [[(Dx) 1 (Dy) 1] [(x) -1 (y) -1 (Dx) 1 (Dy) 1]]] /ggg set $
1983: $ ((h-x-y)^2*Dx*Dy) ggg gb.reduction :: $
1.20 takayama 1984: ]] putUsages
1985:
1986: [(gb.reduction_noh)
1987: [ (f basis gb.reduction_noh r)
1988: (f is reduced by basis by the normal form algorithm.)
1989: (The first element of basis <g_1,...,g_m> must be a Grobner basis.)
1990: (r is the return value format of reduction;)
1991: (r=[h,c0,syz,input], h = c0 f + \sum syz_i g_i)
1992: (basis is given in the argument format of gb.)
1993: (cf. gb.reduction, gb )
1994: $Example:$
1995: $ [[( 2*Dx + 1 ) ( 2*Dy + 1 )] $
1996: $ (x,y) [[(Dx) 1 (Dy) 1]]] /ggg set $
1997: $ ((1-x-y)^2*Dx*Dy) ggg gb.reduction_noh :: $
1.15 takayama 1998: ]] putUsages
1.1 maekawa 1999:
2000: ( ) message-quiet ;
2001:
1.21 takayama 2002: /hol_loaded 1 def
1.1 maekawa 2003:
2004:
2005:
2006:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>