1% Tests of the partial fraction module.
2
3% Author: Anthony C. Hearn
4
5off exp;
6
7
8
9pf(2/((x+1)^2*(x+2)),x);
10
11
12    2      - 2       2
13{-------,-------,----------}
14  x + 2   x + 1          2
15                  (x + 1)
16
17
18pf(x/((x+1)^2*(x+2)^2*(x+3)),x);
19
20
21     - 3
22{-----------,
23  4*(x + 3)
24
25   - 1
26 -------,
27  x + 2
28
29     - 2
30 ----------,
31         2
32  (x + 2)
33
34      7
35 -----------,
36  4*(x + 1)
37
38      - 1
39 ------------}
40           2
41  2*(x + 1)
42
43
44pf(x/(x^2-2x-3),x);
45
46
47      1           3
48{-----------,-----------}
49  4*(x + 1)   4*(x - 3)
50
51
52pf((10x^2-11x-6)/(x^3-x^2-2x),x);
53
54
55    5       2     3
56{-------,-------,---}
57  x + 1   x - 2   x
58
59
60pf(x^2/((x+1)*(x^2+1)),x);
61
62
63    x - 1          1
64{------------,-----------}
65      2        2*(x + 1)
66  2*(x  + 1)
67
68
69pf((2x^6-11x^5+37x^4-94x^3+212x^2-471x+661)
70 /(x^7-5x^6+5x^5-25x^4+115x^3-63x^2+135x-675),x);
71
72
73     x - 3
74{--------------,
75   2
76  x  + 2*x + 5
77
78       x - 3
79 -----------------,
80    2           2
81  (x  + 2*x + 5)
82
83    1
84 -------,
85  x - 3
86
87     1
88 ----------,
89         2
90  (x - 3)
91
92     1
93 ----------}
94         3
95  (x - 3)
96
97
98% A harder example.
99
100pf(((2*w**2+2*h**2*l**2*t**2+2*h**2*l**2*qst**2)*z**2-8*h**2*l**2*qst
101     *t*z+2*w**2+2*h**2*l**2*t**2+2*h**2*l**2*qst**2)/((w**2+h**4*l**2)
102     *((w**2+l**2*t**4+2*l**2*qst**2*t**2+l**2*qst**4)*z**4+(-8*l**2
103     *qst*t**3-8*l**2*qst**3*t)*z**3+(2*w**2+2*l**2*t**4+20*l**2*
104     qst**2*t**2+2*l**2*qst**4)*z**2+(-8*l**2*qst*t**3-8*l**2*qst**3
105     *t)*z+w**2+l**2*t**4+2*l**2*qst**2*t**2+l**2*qst**4))
106   -2*h**2/((w**2+h**4*l**2)*((t**2+qst**2+h**2)*z**2-4*qst*t*z+t**2
107      +qst**2+h**2)),z);
108
109
110          2    2    2                    2  2     2       2
111{(2*(((qst  + t )*(z  + 1) - 4*qst*t*z)*h *l  + (z  + 1)*w ))/(((
112
113              4    4    4      2              2    2    2
114          (qst  + t )*(z  + 2*z  + 1) - 8*(qst  + t )*(z  + 1)*qst*t*z
115
116                 4       2         2  2   2     4      2       2    4  2    2
117           + 2*(z  + 10*z  + 1)*qst *t )*l  + (z  + 2*z  + 1)*w )*(h *l  + w )),
118
119                                   2
120                              - 2*h
121 ---------------------------------------------------------------}
122       2    2    2                      2       2    4  2    2
123  ((qst  + t )*(z  + 1) - 4*qst*t*z + (z  + 1)*h )*(h *l  + w )
124
125
126% example requiring simplification of 2nd parameter
127
128pf(x/(x^2-1),mainvar(x/(x^2-1)));
129
130
131      1           1
132{-----------,-----------}
133  2*(x + 1)   2*(x - 1)
134
135
136end;
137
138Tested on x86_64-pc-windows CSL
139Time (counter 1): 16 ms
140
141End of Lisp run after 0.01+0.06 seconds
142real 0.21
143user 0.00
144sys 0.06
145