1 | ring r=0,(x,y,z),lp; |
---|
2 | int a=12345; |
---|
3 | poly f=10; |
---|
4 | ideal i=x,y; |
---|
5 | module m=x*gen(1),y*gen(2); |
---|
6 | list l=f,i; |
---|
7 | intvec iv=1,2,3,45,5,6,7,8; |
---|
8 | timer=1; |
---|
9 | string s="sdgjgdksdgjs"; |
---|
10 | proc myprintmat(matrix m){ |
---|
11 | print(m); |
---|
12 | } |
---|
13 | proc stringproc1(){ |
---|
14 | return("blubber"); |
---|
15 | } |
---|
16 | proc listproc1(list l){ |
---|
17 | print(l); |
---|
18 | list erg=1,list(2,2784); |
---|
19 | return(erg); |
---|
20 | } |
---|
21 | proc testproc1(){ |
---|
22 | print("Hallo Welt"); |
---|
23 | return(1); |
---|
24 | } |
---|
25 | proc testproc2(poly p){ |
---|
26 | print("Hallo Welt"); |
---|
27 | print(p*p); |
---|
28 | return(p*p+p*p*p); |
---|
29 | } |
---|
30 | proc testproc3(vector p){ |
---|
31 | print("Hallo Welt ihr Vektoren"); |
---|
32 | print(p); |
---|
33 | return(p); |
---|
34 | } |
---|
35 | proc testproc4(number p){ |
---|
36 | print("Hallo Welt ihr Numbers"); |
---|
37 | print(p); |
---|
38 | return(p); |
---|
39 | } |
---|
40 | |
---|
41 | proc testproc5(int p){ |
---|
42 | print("Hallo Welt ihr ints"); |
---|
43 | print(p); |
---|
44 | return(p); |
---|
45 | } |
---|
46 | proc testproc6(poly p, poly q){ |
---|
47 | matrix m[3][10]; |
---|
48 | int i; |
---|
49 | int j; |
---|
50 | for(i=1;i<=3;i++){ |
---|
51 | for(j=1;j<=10;j++){ |
---|
52 | m[i,j]=p^i*q^j; |
---|
53 | } |
---|
54 | } |
---|
55 | |
---|
56 | return(m); |
---|
57 | } |
---|
58 | |
---|
59 | proc testproc7(module p){ |
---|
60 | print("Hallo Welt ihr Modules"); |
---|
61 | print(p); |
---|
62 | return(p); |
---|
63 | } |
---|
64 | proc testproc8(intvec iv){ |
---|
65 | print("Hallo Welt ihr Intvecs"); |
---|
66 | print(iv); |
---|
67 | return(iv); |
---|
68 | } |
---|
69 | |
---|
70 | list mylist=1,2,3; |
---|
71 | LIB("python_module.so"); |
---|
72 | Python_module::python("from Singular import * |
---|
73 | |
---|
74 | from interpreter import * |
---|
75 | functions=SingularGlobalsProxy() |
---|
76 | functions.setring(functions.r) |
---|
77 | print functions.mylist; |
---|
78 | functions.mylist=[1,2,[5,6]] |
---|
79 | print functions.mylist |
---|
80 | print functions.s |
---|
81 | functions.s='only a example' |
---|
82 | print functions.s |
---|
83 | functions.__getattr__('print')('Python ist fun und fun und fun') |
---|
84 | print functions.f |
---|
85 | print functions.i |
---|
86 | firstl=functions.l |
---|
87 | print firstl |
---|
88 | print functions.listproc1([1,[3,6]]) |
---|
89 | print functions.stringproc1() |
---|
90 | for i in firstl: |
---|
91 | print i |
---|
92 | |
---|
93 | x=functions.var(1) |
---|
94 | y=functions.var(2) |
---|
95 | i=Ideal() |
---|
96 | i.append(x) |
---|
97 | i.append(x+y) |
---|
98 | print i |
---|
99 | print functions.groebner(i); |
---|
100 | #print functions.std(i); |
---|
101 | xy=x*y |
---|
102 | functions.f=xy |
---|
103 | |
---|
104 | xye1=xy*gen(1) |
---|
105 | |
---|
106 | print functions.testproc2(xy) |
---|
107 | print functions.testproc3(xye1) |
---|
108 | print functions.testproc4(Number(3243287)) |
---|
109 | print functions.testproc5(325) |
---|
110 | print functions.testproc6(x,y) |
---|
111 | print functions.testproc7(functions.m) |
---|
112 | print functions.testproc8(tuple(range(10))) |
---|
113 | from Singular import foo2; |
---|
114 | m=functions.testproc6(x,y) |
---|
115 | functions.myprintmat(m) |
---|
116 | print functions.a |
---|
117 | print 'Read module:', functions.m |
---|
118 | |
---|
119 | print i |
---|
120 | print 'suc1' |
---|
121 | print i |
---|
122 | print functions.std(i) |
---|
123 | print functions.random(1,10) |
---|
124 | print 'hallo' |
---|
125 | print functions.intersect(i,i,i,i) |
---|
126 | |
---|
127 | v=IntVector() |
---|
128 | v.append(12) |
---|
129 | v.append(13) |
---|
130 | print len(v) |
---|
131 | print v |
---|
132 | |
---|
133 | print 'calling print' |
---|
134 | functions.__getattr__('print')(Ring()); |
---|
135 | print 'the end' |
---|
136 | print functions.ringlist(Ring()) |
---|
137 | print functions.iv |
---|
138 | functions.iv=v |
---|
139 | print functions.iv |
---|
140 | "); |
---|
141 | print(f); |
---|
142 | |
---|
143 | $ |
---|