source: git/Tst/Short/pfd.tst @ e0a503

spielwiese
Last change on this file since e0a503 was e0a503, checked in by Janko Boehm <bohem@…>, 4 years ago
pfd test file
  • Property mode set to 100644
File size: 2.5 KB
Line 
1LIB "tst.lib";
2tst_init();
3
4LIB "pfd.lib";
5
6example pfd;
7
8/* pfd(poly,poly) */
9ring r1 = 0, x(1..5), dp;
10poly f = -2*x(1)*x(3)+3*x(3)*x(4)+x(2)*x(5)+x(3)*x(5)-x(4)*x(5);
11poly g = x(1)*x(3)*(-x(2)+x(3)+x(4))*(x(1)-x(5))*x(5);
12list dec = pfd(f,g);
13displaypfd(dec);
14getStringpfd_indexed(dec);
15displaypfd_long(dec);
16getStringpfd(dec);
17checkpfd(list(f,g), dec);
18checkpfd(list(f,g), dec,10);
19kill dec;
20
21ring r2 = (0,i), (q,r,s,t), dp;
22minpoly = i^2+1;
23poly f = 5*i*q^2*r + s^3*r - r^4 + (1+i)*q*r*s*t + s^2*t^2 -t^3;
24poly g = 4/(1+i)*q*r^3*(i*r+s-t^2)^2*(q^2+r^2+s^2);
25list dec = pfd(f,g);
26displaypfd(dec);
27getStringpfd_indexed(dec);
28displaypfd_long(dec);
29getStringpfd(dec);
30checkpfd(list(f,g), dec);
31checkpfd(list(f,g), dec,10);
32kill dec;
33
34ring r3 = 5, (x,y,z), dp;
35poly f = 2*x^3-x^2*y+x*y^2+y^3-2*x^2*z-2*x*y*z-y^2*z+2*x*z^2+y*z^2-2*z^3;
36poly g = (x^2+3*y)^2*(x-2*y^2)*(x+y+1)^3*(2*x+3*y+4)*(x^2-x*y+y^2);
37list dec = pfd(f,g);
38displaypfd(dec);
39checkpfd(list(f,g), dec);
40checkpfd(list(f,g), dec,10);
41kill dec;
42
43ring r4 = 5, (x,y,z), lp;
44poly f = fetch(r3,f);
45poly g = fetch(r3,g);
46list dec = pfd(f,g);
47displaypfd(dec);
48checkpfd(list(f,g), dec);
49checkpfd(list(f,g), dec,10);
50kill dec;
51
52/* pfd(list) */
53ring s1 = 0, (x,y,z), dp;
54poly f1 = x*y+y*z+z*x-x-y-z+1;
55poly g1 = (z-2)*x^2*(y+1)^2*(x+2*y^2-z);
56poly f2 = 1;
57poly g2 = (z-2)*x^2*(y+1)^2*(x+2*y^2-z);
58poly f3 = x^4+y^4+z^4;
59poly g3 = (x^2+y^2+z^2)^2*(x+y+z)^3;
60list list_of_args = list(list(f1,g1), list(f2,g2), list(f3,g3));
61list dec = pfd(list_of_args);
62displaypfd(dec[1]);
63displaypfd(dec[2]);
64displaypfd(dec[3]);
65checkpfd(list(f1,g1), dec[1]);
66checkpfd(list(f2,g2), dec[2]);
67checkpfd(list(f3,g3), dec[3]);
68kill dec;
69
70/* pfd(matrix) */
71ring s2 = 3, (x,y,z), dp;
72poly f11 = (x+y+z+1)^3;
73poly g11 = (x-y)*(y-z)^2*(z-x)^3*(x^2+y^2+z^2);
74poly f12 = 1;
75poly g12 = (x-y)*(y-z)^2*(z-x)^3*(x^2+y^2+z^2);
76poly f21 = (x+2*y+3*z)^3-10;
77poly g21 = (x-y)^3*(y-z)^3*(z-x)^3*(x^2+y^2+z^2)^2;
78poly f22 = 1;
79poly g22 = (x-y)^3*(y-z)^3*(z-x)^3*(x^2+y^2+z^2)^2;
80list matrix_of_args = list(list(list(f11,g11), list(f12,g12)),
81                           list(list(f21,g21), list(f22,g22)));
82list dec = pfd(matrix_of_args);
83displaypfd(dec[1][1]);
84displaypfd(dec[1][2]);
85displaypfd(dec[2][1]);
86displaypfd(dec[2][2]);
87checkpfd(list(f11,g11), dec[1][1]);
88checkpfd(list(f12,g12), dec[1][2]);
89checkpfd(list(f21,g21), dec[2][1]);
90checkpfd(list(f22,g22), dec[2][2]);
91kill dec;
92
93
94tst_status(1);$
Note: See TracBrowser for help on using the repository browser.