Annotation of OpenXM/src/kan96xx/Doc/hol.sm1, Revision 1.26
1.26 ! takayama 1: % $OpenXM: OpenXM/src/kan96xx/Doc/hol.sm1,v 1.25 2005/07/24 09:02:40 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:
963: gg getRing (oxRingStructure) dc /gb.oxRingStructure set
964:
965: /arg1 [gg dehomogenize ggall] def
1.1 maekawa 966: ] pop
967: popEnv
968: popVariables
969: arg1
970: } def
971: (syz ) messagen-quiet
972:
973: [(syz)
974: [(a syz [b c])
975: (array a; array b; array c)
976: (b is a set of generators of the syzygies of f.)
977: (c = [gb, backward transformation, syzygy without dehomogenization].)
978: (See groebner.)
979: (a : [f ]; array f; f is a set of generators of an ideal in a ring.)
980: (a : [f v]; array f; string v; v is the variables.)
981: (a : [f v w]; array f; string v; array of array w; w is the weight matirx.)
1.9 takayama 982: ( v may be a ring object. )
1.1 maekawa 983: $Example 1: [(x,y) ring_of_polynomials 0] define_ring $
984: $ [ [(x^2+y^2-4). (x y -1).] ] syz :: $
985: $Example 2: [ [(x^2+y^2) (x y)] (x,y) [ [(x) -1 (y) -1] ] ] syz :: $
986: $Example 3: [ [( (x Dx)^2 + (y Dy)^2 -1) ( x y Dx Dy -1)] (x,y) $
987: $ [ [ (Dx) 1 ] ] ] syz pmat ; $
988: $Example 4: [ [(2 x Dx + 3 y Dy+6) (2 y Dx + 3 x^2 Dy)] (x,y) $
989: $ [[(x) -1 (Dx) 1 (y) -1 (Dy) 1]]] syz pmat ;$
990: $Example 5: [ [ [(x^2) (y+x)] [(x+y) (y^3)] [(2 x^2+x y) (y+x+x y^3)]] $
991: $ (x,y) ] syz pmat ;$
992: $Example 6: [ [ [(x^2) (y+x)] [(x+y) (y^3)] [(2 x^2+x y) (y+x+x y^3)]] $
993: $ (x,y) [[(x) -1 (y) -2]] ] syz pmat ;$
994: $Example 7: [ [ [(0) (0)] [(0) (0)] [(x) (y)]] $
995: $ [(x) (y)]] syz pmat ;$
996: ]] putUsages
997:
998:
999: %%%%%%%%%%%%%%%%%% package fs %%%%%%%%%%%%%%%%%%%%%%%
1000: [(genericAnn)
1001: [ (f [s v1 v2 ... vn] genericAnn [L1 ... Lm])
1002: (L1, ..., Lm are annihilating ideal for f^s.)
1003: (f is a polynomial of v1, ..., vn)
1004: (<string> | <poly> f, s, v1, ..., vn ; <poly> L1, ..., Lm )
1005: $Example: (x^3+y^3+z^3) [(s) (x) (y) (z)] genericAnn$
1006: ]
1007: ] putUsages ( genericAnn ) messagen-quiet
1008: /fs.verbose 0 def
1009: /genericAnn {
1010: /arg2 set /arg1 set
1011: [/in-genericAnn /f /vlist /s /vvv /nnn /rrr
1012: /v1 /ops /ggg /ggg0
1013: ] pushVariables
1014: [(CurrentRingp) (KanGBmessage)] pushEnv
1015: [
1016: /f arg1 def /vlist arg2 def
1017: f toString /f set
1018: vlist { toString } map /vlist set
1019: [(KanGBmessage) fs.verbose] system_variable
1020: /s vlist 0 get def
1021: /vvv (_u,_v,_t,) vlist rest { (,) 2 cat_n } map aload length /nnn set
1022: s nnn 2 add cat_n def
1023: fs.verbose { vvv message } { }ifelse
1024: [vvv ring_of_differential_operators
1025: [[(_u) 1 (_v) 1]] weight_vector 0] define_ring /rrr set
1026:
1027: [ (_u*_t). f . sub (_u*_v-1). ]
1028: vlist rest { /v1 set
1029: %%D-clean f . (D) v1 2 cat_n . 1 diff0 (_v*D_t). mul
1030: f . @@@.Dsymbol v1 2 cat_n . 1 diff0 [(_v*) @@@.Dsymbol (_t)] cat . mul
1031: @@@.Dsymbol v1 2 cat_n . add } map
1032: join
1033: /ops set
1034: ops {[[(h). (1).]] replace } map /ops set
1035: fs.verbose { ops message } { }ifelse
1036: [ops] groebner_sugar 0 get /ggg0 set
1037: fs.verbose { ggg0 message } { } ifelse
1038: ggg0 [(_u) (_v)] eliminatev
1039: %%D-clean { [(_t).] [ (D_t).] [s .] distraction
1040: { [(_t).] [ [@@@.Dsymbol (_t)] cat .] [s .] distraction
1041: [[s . << (0). s . sub (1). sub >>]] replace
1042: } map /arg1 set
1043: ] pop
1044: popEnv
1045: popVariables
1046: arg1
1047: } def
1048:
1049: %% Find differential equations for f^(m), r0 the minimal integral root.
1050: [(annfs)
1051: [( [ f v m r0] annfs g )
1052: (It returns the annihilating ideal of f^m where r0 must be smaller)
1053: (or equal to the minimal integral root of the b-function.)
1054: (Or, it returns the annihilating ideal of f^r0, r0 and the b-function)
1055: (where r0 is the minial integral root of b.)
1056: (For the algorithm, see J. Pure and Applied Algebra 117&118(1997), 495--518.)
1057: (Example 1: [(x^2+y^2+z^2+t^2) (x,y,z,t) -1 -2] annfs :: )
1058: $ It returns the annihilating ideal of (x^2+y^2+z^2+t^2)^(-1).$
1059: (Example 2: [(x^2+y^2+z^2+t^2) (x,y,z,t)] annfs :: )
1060: $ It returns the annihilating ideal of f^r0 and [r0, b-function]$
1061: $ where r0 is the minimal integral root of the b-function.$
1062: (Example 3: [(x^2+y^2+z^2) (x,y,z) -1 -1] annfs :: )
1063: (Example 4: [(x^3+y^3+z^3) (x,y,z)] annfs :: )
1064: (Example 5: [((x1+x2+x3)(x1 x2 + x2 x3 + x1 x3) - t x1 x2 x3 ) )
1065: ( (t,x1,x2,x3) -1 -2] annfs :: )
1066: ( Note that the example 4 uses huge memory space.)
1.26 ! takayama 1067: ( )
! 1068: (Note: This implementation is stable but obsolete. )
! 1069: (As to faster implementation, we refer to ann0 and ann of Risa/Asir )
! 1070: (Visit http://www.math.kobe-u.ac.jp/Asir )
1.1 maekawa 1071: ]] putUsages
1072: ( annfs ) messagen-quiet
1073: /annfs.verbose fs.verbose def
1074: /annfs.v [(x) (y) (z)] def
1075: /annfs.s (_s) def
1076: %% The first variable must be s.
1077: /annfs {
1078: /arg1 set
1079: [/in-annfs /aa /typev /setarg /v /m /r0 /gg /ss /fs /gg2
1080: /ans /vtmp /w2 /velim /bbb /rrr /r0
1081: ] pushVariables
1082: [(CurrentRingp) (KanGBmessage)] pushEnv
1083: [
1084:
1085: /aa arg1 def
1086: aa isArray { } { ( << array >> annfs) error } ifelse
1087: /setarg 0 def
1088: aa { tag } map /typev set
1089: /r0 [ ] def
1090: /m [ ] def
1091: /v annfs.v def
1092: aa 0 << aa 0 get toString >> put
1093: typev [ StringP ] eq
1094: { /f aa 0 get def
1095: /setarg 1 def
1096: } { } ifelse
1097: typev [StringP StringP] eq
1098: { /f aa 0 get def
1099: /v [ aa 1 get to_records pop ] def
1100: /setarg 1 def
1101: } { } ifelse
1102: typev [StringP ArrayP] eq
1103: { /f aa 0 get def
1104: /v aa 1 get def
1105: /setarg 1 def
1106: } { } ifelse
1107: typev [StringP ArrayP IntegerP IntegerP] eq
1108: { /f aa 0 get def
1109: /v aa 1 get def
1110: /m aa 2 get def
1111: /r0 aa 3 get def
1112: /setarg 1 def
1113: } { } ifelse
1114: typev [StringP StringP IntegerP IntegerP] eq
1115: { /f aa 0 get def
1116: /v [ aa 1 get to_records pop ] def
1117: /m aa 2 get def
1118: /r0 aa 3 get def
1119: /setarg 1 def
1120: } { } ifelse
1121: setarg 1 eq { } { (annfs : wrong argument) error } ifelse
1122:
1123: [annfs.s] v join /v set
1124:
1125: /ss v 0 get def
1126: annfs.verbose {
1127: (f, v, s, f^{m}, m+r0 = ) messagen
1128: [ f (, ) v (, ) ss (, )
1129: (f^) m (,) m (+) r0 ] {messagen} map ( ) message
1130: } { } ifelse
1131:
1132: f v genericAnn /fs set
1133:
1134: annfs.verbose {
1135: (genericAnn is ) messagen fs message
1136: } { } ifelse
1137: [(KanGBmessage) annfs.verbose] system_variable
1138:
1139: m isArray {
1140: %% Now, let us find the b-function. /vtmp /w2 /velim /bbb /rrr /r0
1141: v rest { /vtmp set vtmp @@@.Dsymbol vtmp 2 cat_n } map /velim set
1142: velim { 1 } map /w2 set
1143: annfs.verbose { w2 message } { } ifelse
1144: [v from_records ring_of_differential_operators
1145: [w2] weight_vector 0] define_ring
1146: [ fs { toString . } map [ f toString . ] join ]
1147: groebner_sugar 0 get velim eliminatev 0 get /bbb set
1148: [[(s) annfs.s] from_records ring_of_polynomials 0] define_ring
1149: bbb toString . [[annfs.s . (s).]] replace /bbb set
1150: annfs.verbose { bbb message } { } ifelse
1151: bbb findIntegralRoots /rrr set
1152: rrr 0 get /r0 set %% minimal integral root.
1153: annfs.verbose { rrr message } { } ifelse
1154: fs 0 get (ring) dc ring_def
1155: fs { [[annfs.s . r0 toString .]] replace } map /ans set
1156: /ans [ans [r0 bbb]] def
1157: /annfs.label1 goto
1158: } { } ifelse
1159: m 0 ge {
1160: (annfs works only for getting annihilating ideal for f^(negative))
1161: error
1162: } { } ifelse
1163: r0 isArray {
1164: [(Need to compute the minimal root of b-function) nl
1165: (It has not been implemented.) ] cat
1166: error
1167: } { } ifelse
1168:
1169: [v from_records ring_of_differential_operators 0] define_ring
1170: fs {toString . dehomogenize [[ss . r0 (poly) dc]] replace}
1171: map /gg set
1172: annfs.verbose { gg message } { } ifelse
1173:
1174: [ [f . << m r0 sub >> npower ] gg join
1175: [(needBack) (needSyz)]] groebner_sugar 2 get /gg2 set
1176:
1177: gg2 { 0 get } map /ans set
1178: /ans ans { dup (0). eq {pop} { } ifelse } map def
1179:
1180: /annfs.label1
1181: /arg1 ans def
1182: ] pop
1183: popEnv
1184: popVariables
1185: arg1
1186: } def
1187:
1188: /genericAnnWithL.s (s) def
1189: /annfs.verify 0 def
1190: /genericAnnWithL {
1191: /arg1 set
1192: [/in-genericAnnWithL /aa /typev /setarg /v /m /r0 /gg /ss /fs /gg2
1193: /ans /vtmp /w2 /velim /bbb /rrr /r0 /myL /mygb /jj
1194: ] pushVariables
1195: [(CurrentRingp) (KanGBmessage) (Homogenize)] pushEnv
1196: [
1197:
1198: /aa arg1 def
1199: aa isArray { } { ( << array >> annfs) error } ifelse
1200: /setarg 0 def
1201: aa { tag } map /typev set
1202: /r0 [ ] def
1203: /m [ ] def
1204: /v annfs.v def
1205: aa 0 << aa 0 get toString >> put
1206: typev [ StringP ] eq
1207: { /f aa 0 get def
1208: /setarg 1 def
1209: } { } ifelse
1210: typev [StringP StringP] eq
1211: { /f aa 0 get def
1212: /v [ aa 1 get to_records pop ] def
1213: /setarg 1 def
1214: } { } ifelse
1215: typev [StringP ArrayP] eq
1216: { /f aa 0 get def
1217: /v aa 1 get def
1218: /setarg 1 def
1219: } { } ifelse
1220: setarg 1 eq { } { (genericAnnWithL : wrong argument) error } ifelse
1221:
1222: [genericAnnWithL.s] v join /v set
1223:
1224: /ss v 0 get def
1225: annfs.verbose {
1226: (f, v, s, f^{m}, m+r0 = ) messagen
1227: [ f (, ) v (, ) ss (, )
1228: (f^) m (,) m (+) r0 ] {messagen} map ( ) message
1229: } { } ifelse
1230:
1231: f v genericAnn /fs set
1232:
1233: annfs.verbose {
1234: (genericAnn is ) messagen fs message
1235: } { } ifelse
1236: [(KanGBmessage) annfs.verbose] system_variable
1237:
1238: m isArray {
1239: %% Now, let us find the b-function. /vtmp /w2 /velim /bbb /rrr /r0
1240: v rest { /vtmp set vtmp @@@.Dsymbol vtmp 2 cat_n } map /velim set
1241: velim { 1 } map /w2 set
1242: annfs.verbose { w2 message } { } ifelse
1243: [v from_records ring_of_differential_operators
1244: [w2] weight_vector 0] define_ring
1245:
1246: [ [ f toString . ] fs { toString . } map join [(needBack)]]
1247: groebner_sugar /mygb set
1248: mygb 0 get velim eliminatev 0 get /bbb set
1249: mygb 0 get bbb position /jj set
1250: mygb 1 get jj get 0 get /myL set
1251:
1252: annfs.verbose { bbb message } { } ifelse
1253:
1254: annfs.verify {
1255: (Verifying L f - b belongs to genericAnn(f)) message
1256: [(Homogenize) 0] system_variable
1257: << myL f . mul bbb sub >>
1258: [fs { toString . } map] groebner_sugar 0 get
1259: reduction 0 get message
1260: (Is it zero? Then it's fine.) message
1261: } { } ifelse
1262:
1263: /ans [bbb [myL fs] ] def
1264: /annfs.label1 goto
1265: } { } ifelse
1266:
1267: /annfs.label1
1268: /arg1 ans def
1269: ] pop
1270: popEnv
1271: popVariables
1272: arg1
1273: } def
1274:
1275:
1276: [(genericAnnWithL)
1277: [$[f v] genericAnnWithL [b [L I]]$
1278: $String f,v; poly b,L; array of poly I;$
1279: $f is a polynomial given by a string. v is the variables.$
1280: $ v must not contain names s, e.$
1281: $b is the b-function (Bernstein-Sato polynomial) for f and$
1282: $ L is the operator satisfying L f^{s+1} = b(s) f^s $
1283: $ I is the annihilating ideal of f^s.$
1284: $cf. bfunction, annfs, genericAnn.$
1285: $Example 1: [(x^2+y^2) (x,y)] genericAnnWithL ::$
1286: $Example 2: [(x^2+y^2+z^2) (x,y,z)] genericAnnWithL ::$
1287: $Example 3: [(x^3-y^2 z^2) (x,y,z)] genericAnnWithL ::$
1288: ]] putUsages
1.2 takayama 1289:
1290: /reduction*.noH 0 def
1291: /reduction* {
1292: /arg1 set
1293: [/in-reduction* /aa /typev /setarg /f /v
1294: /gg /wv /termorder /vec /ans /rr /mm /h /size /a0 /a3
1.3 takayama 1295: /opt
1.2 takayama 1296: ] pushVariables
1297: [(CurrentRingp) (KanGBmessage)] pushEnv
1298: [
1299:
1300: /aa arg1 def
1301: aa isArray { } { ( << array >> reduction*) error } ifelse
1302: /setarg 0 def
1303: /wv 0 def
1304: aa { tag } map /typev set
1305: typev [StringP ArrayP ArrayP] eq
1306: typev [ArrayP ArrayP ArrayP] eq or
1307: typev [PolyP ArrayP ArrayP] eq or
1308: { /h aa 0 get def
1309: /f aa 1 get def
1310: /v aa 2 get from_records def
1311: /setarg 1 def
1312: } { } ifelse
1313: typev [StringP ArrayP ArrayP ArrayP] eq
1314: typev [ArrayP ArrayP ArrayP ArrayP] eq or
1315: typev [PolyP ArrayP ArrayP ArrayP] eq or
1316: { /h aa 0 get def
1317: /f aa 1 get def
1318: /v aa 2 get from_records def
1319: /wv aa 3 get def
1320: /setarg 1 def
1321: } { } ifelse
1322:
1323: setarg { } { (reduction* : Argument mismatch) error } ifelse
1324:
1325: [(KanGBmessage) gb.verbose ] system_variable
1326:
1327: %%% Start of the preprocess
1328: f getRing /rr set
1329:
1330:
1331: rr tag 0 eq {
1332: %% Define our own ring
1333: v isInteger {
1334: (Error in reduction*: Specify variables) error
1335: } { } ifelse
1336: wv isInteger {
1337: [v ring_of_differential_operators
1338: 0] define_ring
1339: /termorder 1 def
1340: }{
1341: [v ring_of_differential_operators
1342: wv weight_vector
1343: 0] define_ring
1344: wv gb.isTermOrder /termorder set
1345: } ifelse
1346: } {
1347: %% Use the ring structre given by the input.
1348: v isInteger not {
1.7 takayama 1349: gb.warning {
1350: (Warning : the given ring definition is not used.) message
1351: } { } ifelse
1.2 takayama 1352: } { } ifelse
1353: rr ring_def
1354: /wv rr gb.getWeight def
1355: wv gb.isTermOrder /termorder set
1356: } ifelse
1357: %%% Enf of the preprocess
1358:
1359: f 0 get isArray {
1360: /size f 0 get length def
1361: f { { toString . } map } map /f set
1362: f fromVectors /f set
1363: }{
1364: /size -1 def
1365: f { toString . } map /f set
1366: } ifelse
1367:
1368: h isArray {
1369: h { toString . } map /h set
1370: [h] fromVectors 0 get /h set
1371: }{
1372: h toString . /h set
1373: } ifelse
1374: f { toString . } map /f set
1.3 takayama 1375: getOptions /opt set
1376: [(ReduceLowerTerms) 1] system_variable
1.2 takayama 1377: reduction*.noH {
1378: h f reduction-noH /ans set
1379: } {
1380: h f reduction /ans set
1381: } ifelse
1.3 takayama 1382: opt restoreOptions
1.2 takayama 1383: size -1 eq not {
1384: [size ans 0 get] toVectors /a0 set
1385: [size ans 3 get] toVectors /a3 set
1386: /ans [a0 ans 1 get ans 2 get a3] def
1387: } { } ifelse
1388: /arg1 ans def
1389: ] pop
1390: popEnv
1391: popVariables
1392: arg1
1393: } def
1394:
1395:
1396: [(reduction*)
1397: [([f base v] reduction* [h c0 syz input])
1398: ([f base v weight] reduction* [h c0 syz input])
1399: (reduction* is an user interface for reduction and reduction-noH.)
1400: (If reduction*.noH is one, then reduction-noH will be called.)
1401: (Example 1: [(x^2) [(x^2+y^2-4) (x y-1)] [(x) (y)]] reduction* )
1402: (Example 2: [[(1) (y^2-1)] [ [(0) (y-1)] [(1) (y+1)]] [(x) (y)]] reduction*)
1403: (Example 3: [(x^2) [(x^2+y^2-4) (x y-1)] [(x) (y)] [[(x) 10]] ] reduction* )
1404: ]] putUsages
1.5 takayama 1405:
1406:
1407:
1408: %% 2000, 6/7, at Sevilla, Hernando Colon
1409: %% macros that deal with homogenized inputs.
1410: %% Sample: [ [(h+x). (x^3).] [(x). (x).]] /ff set
1411: %% [(Homogenize_vec) 0] system_varialbe
1412: %% (grade) (grave1v) switch_function
1413: %% YA homogenization: [ [(h^3*(h+x)). (x^3).] [(h x). (x).]] /ff set
1414: %% 4+0 3+1 2+0 1+1
1415: /gb_h {
1416: /arg1 set
1417: [/in-gb_h /aa /typev /setarg /f /v
1418: /gg /wv /termorder /vec /ans /rr /mm
1.23 takayama 1419: /gb_h.opt /groebnerOptions
1.5 takayama 1420: ] pushVariables
1421: [(CurrentRingp) (KanGBmessage) (Homogenize_vec)] pushEnv
1422: [
1423:
1424: /aa arg1 def
1.6 takayama 1425: gb.verbose { (Getting in gb_h) message } { } ifelse
1.5 takayama 1426: aa isArray { } { ( << array >> gb_h) error } ifelse
1.23 takayama 1427: aa getAttributeList configureGroebnerOption /groebnerOptions set
1.5 takayama 1428: /setarg 0 def
1429: /wv 0 def
1430: aa { tag } map /typev set
1431: typev [ ArrayP ] eq
1432: { /f aa 0 get def
1433: /v gb.v def
1434: /setarg 1 def
1435: } { } ifelse
1436: typev [ArrayP StringP] eq
1437: { /f aa 0 get def
1438: /v aa 1 get def
1439: /setarg 1 def
1440: } { } ifelse
1.10 takayama 1441: typev [ArrayP RingP] eq
1442: { /f aa 0 get def
1443: /v aa 1 get def
1444: /setarg 1 def
1445: } { } ifelse
1.5 takayama 1446: typev [ArrayP ArrayP] eq
1447: { /f aa 0 get def
1448: /v aa 1 get from_records def
1449: /setarg 1 def
1450: } { } ifelse
1451: typev [ArrayP StringP ArrayP] eq
1452: { /f aa 0 get def
1453: /v aa 1 get def
1454: /wv aa 2 get def
1455: /setarg 1 def
1456: } { } ifelse
1457: typev [ArrayP ArrayP ArrayP] eq
1458: { /f aa 0 get def
1459: /v aa 1 get from_records def
1460: /wv aa 2 get def
1461: /setarg 1 def
1462: } { } ifelse
1463:
1464: setarg { } { (gb_h : Argument mismatch) error } ifelse
1465:
1466: [(KanGBmessage) gb.verbose ] system_variable
1467:
1468: %%% Start of the preprocess
1.10 takayama 1469: v tag RingP eq {
1470: /rr v def
1471: }{
1472: f getRing /rr set
1473: } ifelse
1.5 takayama 1474: %% To the normal form : matrix expression.
1475: f gb.toMatrixOfString /f set
1476: /mm gb.itWasMatrix def
1477:
1478: rr tag 0 eq {
1479: %% Define our own ring
1480: v isInteger {
1481: (Error in gb_h: Specify variables) error
1482: } { } ifelse
1483: wv isInteger {
1484: [v ring_of_differential_operators
1485: 0] define_ring
1486: /termorder 1 def
1487: }{
1488: [v ring_of_differential_operators
1489: wv weight_vector
1490: 0] define_ring
1491: wv gb.isTermOrder /termorder set
1492: } ifelse
1493: } {
1494: %% Use the ring structre given by the input.
1495: v isInteger not {
1.7 takayama 1496: gb.warning {
1497: (Warning : the given ring definition is not used.) message
1498: } { } ifelse
1.5 takayama 1499: } { } ifelse
1500: rr ring_def
1501: /wv rr gb.getWeight def
1502: wv gb.isTermOrder /termorder set
1503: } ifelse
1504: getOptions /gb_h.opt set
1505: (grade) (module1v) switch_function
1.6 takayama 1506: [(Homogenize_vec) 0] system_variable
1.5 takayama 1507: %%% End of the preprocess
1508:
1.23 takayama 1509: groebnerOptions gb.options mergeGroebnerOptions /groebnerOptions set
1510: gb.verbose { (groebnerOptions = ) messagen groebnerOptions message } { } ifelse
1.5 takayama 1511: termorder {
1512: f { {. } map } map /f set
1.23 takayama 1513: [f groebnerOptions] groebner 0 get /gg set %% Do not use sugar.
1.5 takayama 1514: }{
1515: f { {. } map} map /f set
1516: f fromVectors /f set
1.23 takayama 1517: [f groebnerOptions] groebner 0 get /gg set
1.5 takayama 1518: }ifelse
1519: wv isInteger {
1520: /ans [gg gg {init} map] def
1521: }{
1522: /ans [gg gg {wv 0 get weightv init} map] def
1523: }ifelse
1524:
1525: %% Postprocess : recover the matrix expression.
1526: mm {
1527: ans { /tmp set [mm tmp] toVectors } map
1528: /ans set
1529: }{ }
1530: ifelse
1.23 takayama 1531: ans gg getAttributeList setAttributeList /ans set
1.5 takayama 1532: gb_h.opt restoreOptions
1.6 takayama 1533: gb.verbose { (Getting out of gb_h) message } { } ifelse
1.5 takayama 1534: %%
1535:
1536: /arg1 ans def
1537: ] pop
1538: popEnv
1539: popVariables
1540: arg1
1541: } def
1542: (gb_h ) messagen-quiet
1543: [(gb_h)
1544: [(a gb_h b)
1545: (array a; array b;)
1546: (b : [g ii]; array g; array in; g is a Grobner basis of f)
1547: ( in the ring of homogenized differential operators.)
1548: ( The input must be homogenized properly.)
1549: ( Inproper homogenization may cause an infinite loop.)
1550: ( Each element of vectors must be homogenized. If you are using )
1551: ( non-term orders, all elements of vectors must have the same degree with)
1552: ( a proper degree shift vector.)
1553: $ ii is the initial ideal in case of w is given or <<a>> belongs$
1554: $ to a ring. In the other cases, it returns the initial monominal.$
1555: $ [(Homogenize_vec) 0] system_variable (grade) (module1v) switch_function$
1556: (a : [f ]; array f; f is a set of generators of an ideal in a ring.)
1557: (a : [f v]; array f; string v; v is the variables. )
1.10 takayama 1558: (a : [f r]; array f; ring r )
1.5 takayama 1559: (a : [f v w]; array f; string v; array of array w; w is the weight matirx.)
1560: ( )
1561: $Example 1: [ [( (x Dx)^2 + (y Dy)^2 -h^4) ( x y Dx Dy -h^4)] (x,y) $
1562: $ [ [ (Dx) 1 ] ] ] gb_h pmat ; $
1563: $Example 2: [ [[(h+x) (x^3)] [(x) (x)]] (x)] gb_h pmat $
1564: $Example 3: [[ [(x^2) (y+x)] [(x+y) (y^3)] $
1565: $ [(2 x^2+x y) (y h^3 +x h^3 +x y^3)]] (x,y) $
1566: $ [ [ (x) -1 (y) -1] ] ] gb_h pmat ; $
1567: $ Infinite loop: see by [(DebugReductionRed) 1] system_variable$
1568: $Example 4: [[ [(x^2) (y+x)] [(x^2+y^2) (y)] $
1569: $ [(2 x^5+x y^4) (y h^3 +x h^3 +x y^3)]] (x,y) $
1570: $ [ [ (x) -1 (y) -1] ] ] gb_h pmat ; $
1571: $ This is fine because grade(v_1) = grade(v_2)+1 for all vectors. $
1.23 takayama 1572: $Example 5: [ [[(h+x) (x^3 + 2 h^3 + 2 x h^2)] [(x) (x)]] (x)] $
1.24 takayama 1573: $ [(reduceOnly) 1] setAttributeList gb_h pmat $
1.5 takayama 1574: ( )
1575: (cf. gb, groebner, syz_h. )
1576: ]] putUsages
1577:
1578: /syz_h {
1579: /arg1 set
1580: [/in-syz_h /aa /typev /setarg /f /v
1581: /gg /wv /termorder /vec /ans /ggall /vectorInput /vsize /gtmp /gtmp2
1582: /rr /mm
1583: /syz_h.opt
1584: ] pushVariables
1585: [(CurrentRingp) (KanGBmessage)] pushEnv
1586: [
1587:
1588: /aa arg1 def
1589: aa isArray { } { (<< array >> syz_h) error } ifelse
1590: /setarg 0 def
1591: /wv 0 def
1592: aa { tag } map /typev set
1593: typev [ ArrayP ] eq
1594: { /f aa 0 get def
1595: /v syz.v def
1596: /setarg 1 def
1597: } { } ifelse
1598: typev [ArrayP StringP] eq
1599: { /f aa 0 get def
1600: /v aa 1 get def
1601: /setarg 1 def
1602: } { } ifelse
1.10 takayama 1603: typev [ArrayP RingP] eq
1604: { /f aa 0 get def
1605: /v aa 1 get def
1606: /setarg 1 def
1607: } { } ifelse
1.5 takayama 1608: typev [ArrayP ArrayP] eq
1609: { /f aa 0 get def
1610: /v aa 1 get from_records def
1611: /setarg 1 def
1612: } { } ifelse
1613: typev [ArrayP StringP ArrayP] eq
1614: { /f aa 0 get def
1615: /v aa 1 get def
1616: /wv aa 2 get def
1617: /setarg 1 def
1618: } { } ifelse
1619: typev [ArrayP ArrayP ArrayP] eq
1620: { /f aa 0 get def
1621: /v aa 1 get from_records def
1622: /wv aa 2 get def
1623: /setarg 1 def
1624: } { } ifelse
1625:
1626: setarg { } { (syz_h : Argument mismatch) error } ifelse
1627:
1628: [(KanGBmessage) syz.verbose ] system_variable
1629:
1630:
1631:
1632: %%% Start of the preprocess
1.10 takayama 1633: v tag RingP eq {
1634: /rr v def
1635: }{
1636: f getRing /rr set
1637: } ifelse
1.5 takayama 1638: %% To the normal form : matrix expression.
1639: f gb.toMatrixOfString /f set
1640: /mm gb.itWasMatrix def
1641: mm 0 gt {
1642: /vectorInput 1 def
1643: }{
1644: /vectorInput 1 def
1645: } ifelse
1646:
1647: rr tag 0 eq {
1648: %% Define our own ring
1649: v isInteger {
1650: (Error in syz_h: Specify variables) error
1651: } { } ifelse
1652: wv isInteger {
1653: [v ring_of_differential_operators
1654: 0] define_ring
1655: /termorder 1 def
1656: }{
1657: [v ring_of_differential_operators
1658: wv weight_vector
1659: 0] define_ring
1660: wv gb.isTermOrder /termorder set
1661: } ifelse
1662: }{
1663: %% Use the ring structre given by the input.
1664: v isInteger not {
1.7 takayama 1665: gb.warning {
1666: (Warning : the given ring definition is not used.) message
1667: } { } ifelse
1.5 takayama 1668: } { } ifelse
1669: rr ring_def
1670: /wv rr gb.getWeight def
1671: wv gb.isTermOrder /termorder set
1672: } ifelse
1673:
1674: getOptions /syz_h.opt set
1675: (grade) (module1v) switch_function
1676: [(Homogenize_vec) 0] system_variable
1677: %%% End of the preprocess
1678:
1679: termorder {
1680: f { {. } map } map /f set
1681: [f [(needBack) (needSyz)]] groebner /ggall set %% Do not use sugar.
1682: ggall 2 get /gg set
1683: }{
1684: f { {. } map } map /f set
1685: [f [(needBack) (needSyz)]] groebner /ggall set
1686: ggall 2 get /gg set
1687: }ifelse
1688: vectorInput {
1689: /vsize f 0 get length def %% input vector size.
1690: /gtmp ggall 0 get def
1691: [vsize gtmp] toVectors /gtmp set
1692: ggall 0 gtmp put
1693: }{ } ifelse
1694:
1695: syz_h.opt restoreOptions
1696: %%
1697:
1698: /arg1 [gg ggall] def
1699: ] pop
1700: popEnv
1701: popVariables
1702: arg1
1703: } def
1704: (syz_h ) messagen-quiet
1705:
1706: [(syz_h)
1707: [(a syz_h [b c])
1708: (array a; array b; array c)
1709: (b is a set of generators of the syzygies of f in the ring of)
1710: (homogenized differential operators.)
1711: ( The input must be homogenized properly.)
1712: ( Inproper homogenization may cause an infinite loop.)
1713: ( Each element of vectors must be homogenized. If you are using )
1714: ( non-term orders, all elements of vectors must have the same degree with)
1715: ( a proper degree shift vector.)
1716: (c = [gb, backward transformation, syzygy without dehomogenization].)
1717: (See gb_h.)
1718: $ [(Homogenize_vec) 0] system_variable (grade) (module1v) switch_function$
1719: (a : [f ]; array f; f is a set of generators of an ideal in a ring.)
1720: (a : [f v]; array f; string v; v is the variables.)
1.10 takayama 1721: (a : [f r]; array f; ring r )
1.5 takayama 1722: (a : [f v w]; array f; string v; array of array w; w is the weight matirx.)
1723: $Example 1: [ [( (x Dx)^2 + (y Dy)^2 -h^4) ( x y Dx Dy -h^4)] (x,y) $
1724: $ [ [ (Dx) 1 ] ] ] syz_h pmat ; $
1725: $Example 2: [ [[(h+x) (x^3)] [(x) (x)]] (x)] syz_h pmat $
1726: $Example 3: [[ [(x^2) (y+x)] [(x+y) (y^3)] $
1727: $ [(2 x^2+x y) (y h^3 +x h^3 +x y^3)]] (x,y) $
1728: $ [ [ (x) -1 (y) -1] ] ] syz_h pmat ; $
1729: $ Infinite loop: see by [(DebugReductionRed) 1] system_variable$
1730: $Example 4: [[ [(x^2) (y+x)] [(x^2+y^2) (y)] $
1731: $ [(2 x^5+x y^4) (y h^3 +x h^3 +x y^3)]] (x,y) $
1732: $ [ [ (x) -1 (y) -1] ] ] syz_h pmat ; $
1733: $ This is fine because grade(v_1) = grade(v_2)+1 for all vectors. $
1734: $Example 5: [ [ [(0) (0)] [(0) (0)] [(x) (y)]] $
1735: $ [(x) (y)]] syz pmat ;$
1736: ]] putUsages
1737:
1738:
1739: /isSameIdeal {
1740: /arg1 set
1741: [/in-isSameIdeal /aa /ii /jj /iigg /jjgg /vv /ans /k /n /f] pushVariables
1742: [(CurrentRingp)] pushEnv
1743: [
1744: /aa arg1 def
1745: %% comparison of hilbert series has not yet been implemented.
1746: aa length 3 eq { }
1747: { ([ii jj vv] isSameIdeal) error } ifelse
1.6 takayama 1748: gb.verbose { (Getting in isSameIdeal) message } { } ifelse
1.5 takayama 1749: /ii aa 0 get def
1750: /jj aa 1 get def
1751: /vv aa 2 get def
1752: ii length 0 eq jj length 0 eq and
1753: { /ans 1 def /LLL.isSame goto } { } ifelse
1754: [ii vv] gb /iigg set
1755: [jj vv] gb /jjgg set
1756:
1757: iigg getRing ring_def
1758:
1759: /ans 1 def
1760: iigg 0 get { [ (toe_) 3 -1 roll ] gbext } map
1761: /iigg set
1762: jjgg 0 get { [ (toe_) 3 -1 roll ] gbext } map
1763: /jjgg set
1764:
1765: gb.verbose { ( ii < jj ?) messagen } { } ifelse
1766: iigg length /n set
1767: 0 1 n 1 sub {
1768: /k set
1769: iigg k get
1770: jjgg reduction-noH 0 get
1771: (0). eq not { /ans 0 def /LLL.isSame goto} { } ifelse
1772: gb.verbose { (o) messagen } { } ifelse
1773: } for
1774: gb.verbose { ( jj < ii ?) messagen } { } ifelse
1775: jjgg length /n set
1776: 0 1 n 1 sub {
1777: /k set
1778: jjgg k get
1779: iigg reduction-noH 0 get
1780: (0). eq not { /ans 0 def /LLL.isSame goto} { } ifelse
1781: gb.verbose { (o) messagen } { } ifelse
1782: } for
1783: /LLL.isSame
1784: gb.verbose { ( Done) message } { } ifelse
1785: /arg1 ans def
1786: ] pop
1787: popEnv
1788: popVariables
1789: arg1
1790: } def
1791: (isSameIdeal ) messagen-quiet
1792:
1793: [(isSameIdeal)
1794: [([ii jj vv] isSameIdeal bool)
1795: (ii, jj : ideal, vv : variables)
1796: (Note that ii and jj will be dehomogenized and compared in the ring)
1797: (of differential operators. cf. isSameIdeal_h)
1798: $Example 1: [ [(x^3) (y^2)] [(x^2+y) (y)] (x,y)] isSameIdeal $
1799: $Example 2: [ [[(x^3) (0)] [(y^2) (1)]] $
1800: $ [[(x^3+y^2) (1)] [(y^2) (1)]] (x,y)] isSameIdeal $
1801: ]] putUsages
1802:
1803: /isSameIdeal_h {
1804: /arg1 set
1.6 takayama 1805: [/in-isSameIdeal_h /aa /ii /jj /iigg /jjgg /vv /ans /k /n /f
1806: /isSameIdeal_h.opt
1807: ] pushVariables
1808: [(CurrentRingp) (Homogenize_vec)] pushEnv
1.5 takayama 1809: [
1810: /aa arg1 def
1.6 takayama 1811: gb.verbose { (Getting in isSameIdeal_h) message } { } ifelse
1.5 takayama 1812: %% comparison of hilbert series has not yet been implemented.
1813: aa length 3 eq { }
1814: { ([ii jj vv] isSameIdeal_h) error } ifelse
1815: /ii aa 0 get def
1816: /jj aa 1 get def
1817: /vv aa 2 get def
1818: ii length 0 eq jj length 0 eq and
1819: { /ans 1 def /LLL.isSame_h goto } { } ifelse
1820:
1821: [ii vv] gb_h /iigg set
1822: [jj vv] gb_h /jjgg set
1823:
1824: iigg getRing ring_def
1825:
1.6 takayama 1826: getOptions /isSameIdeal_h.opt set
1827: (grade) (module1v) switch_function
1828: [(Homogenize_vec) 0] system_variable
1.5 takayama 1829: /ans 1 def
1830: iigg 0 get { [ (toe_) 3 -1 roll ] gbext } map
1831: /iigg set
1832: jjgg 0 get { [ (toe_) 3 -1 roll ] gbext } map
1833: /jjgg set
1834:
1.8 takayama 1835: gb.verbose { (Comparing) message iigg message (and) message jjgg message }
1836: { } ifelse
1.5 takayama 1837: gb.verbose { ( ii < jj ?) messagen } { } ifelse
1838: iigg length /n set
1839: 0 1 n 1 sub {
1840: /k set
1841: iigg k get
1842: jjgg reduction 0 get
1843: (0). eq not { /ans 0 def /LLL.isSame_h goto} { } ifelse
1844: gb.verbose { (o) messagen } { } ifelse
1845: } for
1846: gb.verbose { ( jj < ii ?) messagen } { } ifelse
1847: jjgg length /n set
1848: 0 1 n 1 sub {
1849: /k set
1850: jjgg k get
1851: iigg reduction 0 get
1852: (0). eq not { /ans 0 def /LLL.isSame_h goto} { } ifelse
1853: gb.verbose { (o) messagen } { } ifelse
1854: } for
1855: /LLL.isSame_h
1856: gb.verbose { ( Done) message } { } ifelse
1.6 takayama 1857: isSameIdeal_h.opt restoreOptions
1.5 takayama 1858: /arg1 ans def
1859: ] pop
1860: popEnv
1861: popVariables
1862: arg1
1863: } def
1864: (isSameIdeal_h ) messagen-quiet
1865:
1866: [(isSameIdeal_h)
1867: [([ii jj vv] isSameIdeal_h bool)
1868: (ii, jj : ideal, vv : variables)
1869: (Note that ii and jj will be compared in the ring)
1870: (of homogenized differential operators. Each element of the vector must be)
1871: (homogenized.)
1872: $Example 1: [ [(x Dx - h^2) (Dx^2)] [(Dx^3) (x Dx-h^2)] (x)] isSameIdeal_h $
1873: $Example 2: [ [[(x Dx -h^2) (0)] [(Dx^2) (1)]] $
1874: $ [[(x Dx -h^2) (0)] [(Dx^2) (1)] [(Dx^3) (Dx)]] (x,y)] isSameIdeal_h $
1875: ]] putUsages
1876:
1.15 takayama 1877: /gb.reduction {
1878: /arg2 set
1879: /arg1 set
1880: [/in-gb.reduction /gbasis /flist /ans /gbasis2
1881: ] pushVariables
1882: [(CurrentRingp) (KanGBmessage)] pushEnv
1883: [
1884: /gbasis arg2 def
1885: /flist arg1 def
1886: gbasis 0 get tag 6 eq { }
1887: { (gb.reduction: the second argument must be a list of lists) error }
1888: ifelse
1889:
1890: gbasis length 1 eq {
1891: gbasis getRing ring_def
1892: /gbasis2 gbasis 0 get def
1893: } {
1894: [ [(1)] ] gbasis rest join gb 0 get getRing ring_def
1.22 takayama 1895: /gbasis2 gbasis 0 get ___ def
1.15 takayama 1896: } ifelse
1897:
1.5 takayama 1898:
1.22 takayama 1899: flist ___ /flist set
1.15 takayama 1900: flist tag 6 eq {
1901: flist { gbasis2 reduction } map /ans set
1902: }{
1903: flist gbasis2 reduction /ans set
1904: } ifelse
1905: /arg1 ans def
1906:
1907: ] pop
1908: popEnv
1909: popVariables
1910: arg1
1911: } def
1912:
1.20 takayama 1913: /gb.reduction_noh {
1914: /arg2 set
1915: /arg1 set
1916: [/in-gb.reduction_noh /gbasis /flist /ans /gbasis2
1917: ] pushVariables
1918: [(CurrentRingp) (KanGBmessage) (Homogenize)] pushEnv
1919: [
1920: /gbasis arg2 def
1921: /flist arg1 def
1922: gbasis 0 get tag 6 eq { }
1923: { (gb.reduction_noh: the second argument must be a list of lists) error }
1924: ifelse
1925:
1926: gbasis length 1 eq {
1927: gbasis getRing ring_def
1928: /gbasis2 gbasis 0 get def
1929: } {
1930: [ [(1)] ] gbasis rest join gb 0 get getRing ring_def
1.22 takayama 1931: /gbasis2 gbasis 0 get ___ def
1.20 takayama 1932: } ifelse
1933:
1934:
1.22 takayama 1935: flist ___ /flist set
1.20 takayama 1936: [(Homogenize) 0] system_variable
1937: flist tag 6 eq {
1938: flist { gbasis2 reduction } map /ans set
1939: }{
1940: flist gbasis2 reduction /ans set
1941: } ifelse
1942: /arg1 ans def
1943:
1944: ] pop
1945: popEnv
1946: popVariables
1947: arg1
1948: } def
1949:
1.15 takayama 1950: /gb.reduction.test {
1951: [
1952: [( 2*(1-x-y) Dx + 1 ) ( 2*(1-x-y) Dy + 1 )]
1953: (x,y) [[(Dx) 1 (Dy) 1] [(x) -1 (y) -1 (Dx) 1 (Dy) 1]]]
1954: gb /gg set
1955:
1956: ((h-x-y)*Dx) [gg 0 get] gb.reduction /gg2 set
1957: gg2 message
1958: (-----------------------------) message
1959:
1960: [[( 2*(h-x-y) Dx + h^2 ) ( 2*(h-x-y) Dy + h^2 )]
1961: (x,y) [[(Dx) 1 (Dy) 1] [(x) -1 (y) -1 (Dx) 1 (Dy) 1]]] /ggg set
1962: ((h-x-y)*Dx) ggg gb.reduction /gg4 set
1963: gg4 message
1964: (-----------------------------) message
1965: [gg2 gg4]
1966: } def
1967: [(gb.reduction)
1968: [ (f basis gb.reduction r)
1969: (f is reduced by basis by the normal form algorithm.)
1970: (The first element of basis <g_1,...,g_m> must be a Grobner basis.)
1971: (r is the return value format of reduction;)
1972: (r=[h,c0,syz,input], h = c0 f + \sum syz_i g_i)
1973: (basis is given in the argument format of gb.)
1.16 takayama 1974: $h[1,1](D)-homogenization is used.$
1.15 takayama 1975: (cf. reduction, gb, ecartd.gb, gb.reduction.test )
1976: $Example:$
1977: $ [[( 2*(h-x-y) Dx + h^2 ) ( 2*(h-x-y) Dy + h^2 )] $
1978: $ (x,y) [[(Dx) 1 (Dy) 1] [(x) -1 (y) -1 (Dx) 1 (Dy) 1]]] /ggg set $
1979: $ ((h-x-y)^2*Dx*Dy) ggg gb.reduction :: $
1.20 takayama 1980: ]] putUsages
1981:
1982: [(gb.reduction_noh)
1983: [ (f basis gb.reduction_noh r)
1984: (f is reduced by basis by the normal form algorithm.)
1985: (The first element of basis <g_1,...,g_m> must be a Grobner basis.)
1986: (r is the return value format of reduction;)
1987: (r=[h,c0,syz,input], h = c0 f + \sum syz_i g_i)
1988: (basis is given in the argument format of gb.)
1989: (cf. gb.reduction, gb )
1990: $Example:$
1991: $ [[( 2*Dx + 1 ) ( 2*Dy + 1 )] $
1992: $ (x,y) [[(Dx) 1 (Dy) 1]]] /ggg set $
1993: $ ((1-x-y)^2*Dx*Dy) ggg gb.reduction_noh :: $
1.15 takayama 1994: ]] putUsages
1.1 maekawa 1995:
1996: ( ) message-quiet ;
1997:
1.21 takayama 1998: /hol_loaded 1 def
1.1 maekawa 1999:
2000:
2001:
2002:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>