1 | // $Id: classify.lib,v 1.8 1997-08-13 07:39:06 krueger Exp $ |
---|
2 | //============================================================================= |
---|
3 | // |
---|
4 | // Please send bugs and comments to krueger@mathematik.uni-kl.de |
---|
5 | // |
---|
6 | //============================================================================= |
---|
7 | |
---|
8 | LIBRARY: Classify.lib |
---|
9 | |
---|
10 | classify(f); compute the Class of f. |
---|
11 | |
---|
12 | // required libraries |
---|
13 | |
---|
14 | LIB "lib_Setring"; |
---|
15 | LIB "lib_RandomPoly"; |
---|
16 | LIB "Morse.lib"; |
---|
17 | LIB "tools.lib"; |
---|
18 | LIB "Kclass.lib"; |
---|
19 | LIB "Ausgaben.lib"; |
---|
20 | LIB "HKclass.lib"; |
---|
21 | LIB "NFlist.lib"; |
---|
22 | LIB "Hilbert.lib"; |
---|
23 | |
---|
24 | //============================================================================= |
---|
25 | //============================================================================= |
---|
26 | // TopLevel Funktion of the Arnold-Classifier. |
---|
27 | // |
---|
28 | proc classify (poly @f_in) |
---|
29 | USAGE: classify(f); f=poly |
---|
30 | COMPUTE: Normalform and singularity type of f |
---|
31 | RETURN: Normalform of f |
---|
32 | EXAMPLE: example classify; shows an example |
---|
33 | REMARK: This version of classify is only alpha. |
---|
34 | Please send bugs and comments to: |
---|
35 | "Kai Krueger" <krueger@mathematik.uni-kl.de> |
---|
36 | NOTE: The procedure init_debug(n); is usefull as trace-mode. |
---|
37 | n may range from 0 to 10, higher values of n give more informations. |
---|
38 | { |
---|
39 | // or set the shell-variable SG_DEBUG to the debugging level. |
---|
40 | if(system("version")<922) { |
---|
41 | "Sorry. You need to have at least Singular version 0.9.2.c" |
---|
42 | return; |
---|
43 | } |
---|
44 | |
---|
45 | def ring_top=basering; |
---|
46 | // Get characteristics of ring set it as default. |
---|
47 | if(defined(CharOfRing) == 1) { kill CharOfRing; } |
---|
48 | int CharOfRing = char(basering); |
---|
49 | export CharOfRing; |
---|
50 | |
---|
51 | if(checkring()) { return(@f_in); } |
---|
52 | int @show_nf = 1; // return normal form if set to '1' |
---|
53 | |
---|
54 | int @n = nvars(basering); |
---|
55 | |
---|
56 | // Save the name of initial ring |
---|
57 | int @i; |
---|
58 | |
---|
59 | // if trace/debug mode not set, do it! |
---|
60 | init_debug(); |
---|
61 | |
---|
62 | // define new ring |
---|
63 | if( defined(Rtop) == 1) { kill Rtop; } |
---|
64 | ring Rtop=char(basering),(x(1..@n)),(c,ds); |
---|
65 | export Rtop; |
---|
66 | |
---|
67 | map @Conv=ring_top,maxideal(1); |
---|
68 | setring ring_top; |
---|
69 | |
---|
70 | if(defined(ShowPoly) == 1) { kill ShowPoly; } |
---|
71 | map ShowPoly=Rtop,maxideal(1); |
---|
72 | export ShowPoly; |
---|
73 | setring Rtop; |
---|
74 | init(); |
---|
75 | |
---|
76 | string RingDisplay = "ring_top"; |
---|
77 | export RingDisplay; |
---|
78 | |
---|
79 | string @s1; |
---|
80 | string @s2; |
---|
81 | string @s4; |
---|
82 | @s1,@s2=Klassifiziere(@Conv(@f_in)); |
---|
83 | // @s1: f nach saemtlichen Koordinatentransformationen |
---|
84 | // @s2: Typ des Polynoms f z.b: E[18] |
---|
85 | @s4 = "poly @f_out="+@s1+";"; |
---|
86 | debug_log(10, "S1=", @s1); |
---|
87 | debug_log(10, "S2=", @s2); |
---|
88 | |
---|
89 | if( @s2[1,2]=="f " || @s2[1,4]=="The " || @s2=="Fehler!" || @s2=="A[0]") { |
---|
90 | if( @s2 != "Fehler!") { @s2; } |
---|
91 | if(@s1=="1" || @s2[1,4]=="The " || @s2=="Fehler!" ) { |
---|
92 | setring ring_top; |
---|
93 | return(@f_in); |
---|
94 | } |
---|
95 | setring Rtop; |
---|
96 | execute @s4; |
---|
97 | map @ConvUp=Rtop,maxideal(1); |
---|
98 | } |
---|
99 | else { |
---|
100 | setring RingB; |
---|
101 | execute @s4; |
---|
102 | setring Rtop; |
---|
103 | map @ConvUp=RingB,maxideal(1); |
---|
104 | } |
---|
105 | if(@show_nf==1) { |
---|
106 | poly @f_nf = normalform(@s2); |
---|
107 | for(@i=4;@i<=@n;@i=@i+1) { |
---|
108 | @f_nf = @f_nf + x(@i)^2; |
---|
109 | } |
---|
110 | if(DeBug>1) { "Normal form NF(f)=", @f_nf; } |
---|
111 | } |
---|
112 | poly @f_out = @ConvUp(@f_out); |
---|
113 | for(@i=CoRang+1;@i<=@n;@i=@i+1) { |
---|
114 | @f_out = @f_out + x(@i)^2; |
---|
115 | } |
---|
116 | setring ring_top; |
---|
117 | map @ConvBack=Rtop,maxideal(1); |
---|
118 | |
---|
119 | if(@show_nf == 1) { |
---|
120 | return(@ConvBack(@f_nf)); |
---|
121 | } |
---|
122 | else { return(@ConvBack(@f_out)); } |
---|
123 | } |
---|
124 | example |
---|
125 | {"EXAMPLE"; echo=2; |
---|
126 | ring r=0,(x,y,z),ds; |
---|
127 | init_debug(2); |
---|
128 | poly f=(x2+3y-2z)^2+xyz-(x-y3+x2*z3)^3; |
---|
129 | poly g=classify(f); |
---|
130 | } |
---|
131 | // E n d O f F i l e |
---|