3 The symbol f is just a dummy symbol for creating a list f(A,B,C,C,...) where
5 A is the template expression
7 B is the result expression
9 C is an optional list of conditional expressions
15 const char *itab
[] = {
18 // 9 (need a caveat for 7 so we can put 9 after 7)
21 "f(x^a,x^(a+1)/(a+1))",
23 "f(exp(a*x),1/a*exp(a*x))",
24 "f(exp(a*x+b),1/a*exp(a*x+b))",
25 "f(x*exp(a*x^2),exp(a*x^2)/(2*a))",
26 "f(x*exp(a*x^2+b),exp(a*x^2+b)/(2*a))",
28 "f(log(a*x),x*log(a*x)-x)",
30 "f(a^x,a^x/log(a),or(not(number(a)),a>0))",
32 "f(1/(a+x^2),1/sqrt(a)*arctan(x/sqrt(a)),or(not(number(a)),a>0))",
34 "f(1/(a-x^2),1/sqrt(a)*arctanh(x/sqrt(a)))",
36 "f(1/sqrt(a-x^2),arcsin(x/(sqrt(a))))",
38 "f(1/sqrt(a+x^2),log(x+sqrt(a+x^2)))",
40 "f(1/(a+b*x),1/b*log(a+b*x))",
42 "f(1/(a+b*x)^2,-1/(b*(a+b*x)))",
44 "f(1/(a+b*x)^3,-1/(2*b)*1/(a+b*x)^2)",
46 "f(x/(a+b*x),x/b-a*log(a+b*x)/b/b)",
48 "f(x/(a+b*x)^2,1/b^2*(log(a+b*x)+a/(a+b*x)))",
50 "f(x^2/(a+b*x),1/b^2*(1/2*(a+b*x)^2-2*a*(a+b*x)+a^2*log(a+b*x)))",
52 "f(x^2/(a+b*x)^2,1/b^3*(a+b*x-2*a*log(a+b*x)-a^2/(a+b*x)))",
54 "f(x^2/(a+b*x)^3,1/b^3*(log(a+b*x)+2*a/(a+b*x)-1/2*a^2/(a+b*x)^2))",
56 "f(1/x*1/(a+b*x),-1/a*log((a+b*x)/x))",
58 "f(1/x*1/(a+b*x)^2,1/a*1/(a+b*x)-1/a^2*log((a+b*x)/x))",
60 "f(1/x*1/(a+b*x)^3,1/a^3*(1/2*((2*a+b*x)/(a+b*x))^2+log(x/(a+b*x))))",
62 "f(1/x^2*1/(a+b*x),-1/(a*x)+b/a^2*log((a+b*x)/x))",
64 "f(1/x^3*1/(a+b*x),(2*b*x-a)/(2*a^2*x^2)+b^2/a^3*log(x/(a+b*x)))",
66 "f(1/x^2*1/(a+b*x)^2,-(a+2*b*x)/(a^2*x*(a+b*x))+2*b/a^3*log((a+b*x)/x))",
68 "f(1/(a+b*x^2),1/sqrt(a*b)*arctan(x*sqrt(a*b)/a),or(not(number(a*b)),a*b>0))",
70 "f(1/(a+b*x^2),1/(2*sqrt(-a*b))*log((a+x*sqrt(-a*b))/(a-x*sqrt(-a*b))),or(not(number(a*b)),a*b<0))",
71 // 62 is the same as 60
73 "f(x/(a+b*x^2),1/2*1/b*log(a+b*x^2))",
75 "f(x^2/(a+b*x^2),x/b-a/b*integral(1/(a+b*x^2),x))",
77 "f(1/(a+b*x^2)^2,x/(2*a*(a+b*x^2))+1/2*1/a*integral(1/(a+b*x^2),x))",
80 "f(1/x*1/(a+b*x^2),1/2*1/a*log(x^2/(a+b*x^2)))",
82 "f(1/x^2*1/(a+b*x^2),-1/(a*x)-b/a*integral(1/(a+b*x^2),x))",
84 "f(1/(a+b*x^3),1/3*1/a*(a/b)^(1/3)*(1/2*log(((a/b)^(1/3)+x)^3/(a+b*x^3))+sqrt(3)*arctan((2*x-(a/b)^(1/3))*(a/b)^(-1/3)/sqrt(3))))",
86 "f(x^2/(a+b*x^3),1/3*1/b*log(a+b*x^3))",
88 "f(1/(a+b*x^4),1/2*1/a*(a/b/4)^(1/4)*(1/2*log((x^2+2*(a/b/4)^(1/4)*x+2*(a/b/4)^(1/2))/(x^2-2*(a/b/4)^(1/4)*x+2*(a/b/4)^(1/2)))+arctan(2*(a/b/4)^(1/4)*x/(2*(a/b/4)^(1/2)-x^2))),or(not(number(a*b)),a*b>0))",
90 "f(1/(a+b*x^4),1/2*(-a/b)^(1/4)/a*(1/2*log((x+(-a/b)^(1/4))/(x-(-a/b)^(1/4)))+arctan(x*(-a/b)^(-1/4))),or(not(number(a*b)),a*b<0))",
92 "f(x/(a+b*x^4),1/2*sqrt(b/a)/b*arctan(x^2*sqrt(b/a)),or(not(number(a*b)),a*b>0))",
94 "f(x/(a+b*x^4),1/4*sqrt(-b/a)/b*log((x^2-sqrt(-a/b))/(x^2+sqrt(-a/b))),or(not(number(a*b)),a*b<0))",
96 "f(x^2/(a+b*x^4),1/4*1/b*(a/b/4)^(-1/4)*(1/2*log((x^2-2*(a/b/4)^(1/4)*x+2*sqrt(a/b/4))/(x^2+2*(a/b/4)^(1/4)*x+2*sqrt(a/b/4)))+arctan(2*(a/b/4)^(1/4)*x/(2*sqrt(a/b/4)-x^2))),or(not(number(a*b)),a*b>0))",
98 "f(x^2/(a+b*x^4),1/4*1/b*(-a/b)^(-1/4)*(log((x-(-a/b)^(1/4))/(x+(-a/b)^(1/4)))+2*arctan(x*(-a/b)^(-1/4))),or(not(number(a*b)),a*b<0))",
100 "f(x^3/(a+b*x^4),1/4*1/b*log(a+b*x^4))",
102 "f(sqrt(a+b*x),2/3*1/b*sqrt((a+b*x)^3))",
104 "f(x*sqrt(a+b*x),-2*(2*a-3*b*x)*sqrt((a+b*x)^3)/15/b^2)",
106 "f(x^2*sqrt(a+b*x),2*(8*a^2-12*a*b*x+15*b^2*x^2)*sqrt((a+b*x)^3)/105/b^3)",
108 "f(sqrt(a+b*x)/x,2*sqrt(a+b*x)+a*integral(1/x*1/sqrt(a+b*x),x))",
110 "f(sqrt(a+b*x)/x^2,-sqrt(a+b*x)/x+b/2*integral(1/x*1/sqrt(a+b*x),x))",
112 "f(1/sqrt(a+b*x),2*sqrt(a+b*x)/b)",
114 "f(x/sqrt(a+b*x),-2/3*(2*a-b*x)*sqrt(a+b*x)/b^2)",
116 "f(x^2/sqrt(a+b*x),2/15*(8*a^2-4*a*b*x+3*b^2*x^2)*sqrt(a+b*x)/b^3)",
118 "f(1/x*1/sqrt(a+b*x),1/sqrt(a)*log((sqrt(a+b*x)-sqrt(a))/(sqrt(a+b*x)+sqrt(a))),or(not(number(a)),a>0))",
120 "f(1/x*1/sqrt(a+b*x),2/sqrt(-a)*arctan(sqrt(-(a+b*x)/a)),or(not(number(a)),a<0))",
122 "f(1/x^2*1/sqrt(a+b*x),-sqrt(a+b*x)/a/x-1/2*b/a*integral(1/x*1/sqrt(a+b*x),x))",
124 "f(sqrt(x^2+a),1/2*(x*sqrt(x^2+a)+a*log(x+sqrt(x^2+a))))",
126 "f(1/sqrt(x^2+a),log(x+sqrt(x^2+a)))",
128 "f(1/x*1/sqrt(x^2+a),arcsec(x/sqrt(-a))/sqrt(-a),or(not(number(a)),a<0))",
130 "f(1/x*1/sqrt(x^2+a),-1/sqrt(a)*log((sqrt(a)+sqrt(x^2+a))/x),or(not(number(a)),a>0))",
132 "f(sqrt(x^2+a)/x,sqrt(x^2+a)-sqrt(a)*log((sqrt(a)+sqrt(x^2+a))/x),or(not(number(a)),a>0))",
134 "f(sqrt(x^2+a)/x,sqrt(x^2+a)-sqrt(-a)*arcsec(x/sqrt(-a)),or(not(number(a)),a<0))",
136 "f(x/sqrt(x^2+a),sqrt(x^2+a))",
138 "f(x*sqrt(x^2+a),1/3*sqrt((x^2+a)^3))",
139 //164 need an unexpanded version?
140 "f(sqrt(a+x^6+3*a^(1/3)*x^4+3*a^(2/3)*x^2),1/4*(x*sqrt((x^2+a^(1/3))^3)+3/2*a^(1/3)*x*sqrt(x^2+a^(1/3))+3/2*a^(2/3)*log(x+sqrt(x^2+a^(1/3)))))",
141 // match doesn't work for the following
142 "f(sqrt(-a+x^6-3*a^(1/3)*x^4+3*a^(2/3)*x^2),1/4*(x*sqrt((x^2-a^(1/3))^3)-3/2*a^(1/3)*x*sqrt(x^2-a^(1/3))+3/2*a^(2/3)*log(x+sqrt(x^2-a^(1/3)))))",
144 "f(1/sqrt(a+x^6+3*a^(1/3)*x^4+3*a^(2/3)*x^2),x/a^(1/3)/sqrt(x^2+a^(1/3)))",
146 "f(x/sqrt(a+x^6+3*a^(1/3)*x^4+3*a^(2/3)*x^2),-1/sqrt(x^2+a^(1/3)))",
148 "f(x*sqrt(a+x^6+3*a^(1/3)*x^4+3*a^(2/3)*x^2),1/5*sqrt((x^2+a^(1/3))^5))",
150 "f(x^2*sqrt(x^2+a),1/4*x*sqrt((x^2+a)^3)-1/8*a*x*sqrt(x^2+a)-1/8*a^2*log(x+sqrt(x^2+a)))",
152 "f(x^3*sqrt(x^2+a),(1/5*x^2-2/15*a)*sqrt((x^2+a)^3),and(number(a),a>0))",
154 "f(x^3*sqrt(x^2+a),sqrt((x^2+a)^5)/5-a*sqrt((x^2+a)^3)/3,and(number(a),a<0))",
156 "f(x^2/sqrt(x^2+a),1/2*x*sqrt(x^2+a)-1/2*a*log(x+sqrt(x^2+a)))",
158 "f(x^3/sqrt(x^2+a),1/3*sqrt((x^2+a)^3)-a*sqrt(x^2+a))",
160 "f(1/x^2*1/sqrt(x^2+a),-sqrt(x^2+a)/a/x)",
162 "f(1/x^3*1/sqrt(x^2+a),-1/2*sqrt(x^2+a)/a/x^2+1/2*log((sqrt(a)+sqrt(x^2+a))/x)/a^(3/2),or(not(number(a)),a>0))",
164 "f(1/x^3*1/sqrt(x^2-a),1/2*sqrt(x^2-a)/a/x^2+1/2*1/(a^(3/2))*arcsec(x/(a^(1/2))),or(not(number(a)),a>0))",
166 "f(x^2*sqrt(a+x^6+3*a^(1/3)*x^4+3*a^(2/3)*x^2),1/6*x*sqrt((x^2+a^(1/3))^5)-1/24*a^(1/3)*x*sqrt((x^2+a^(1/3))^3)-1/16*a^(2/3)*x*sqrt(x^2+a^(1/3))-1/16*a*log(x+sqrt(x^2+a^(1/3))),or(not(number(a)),a>0))",
168 "f(x^2*sqrt(-a-3*a^(1/3)*x^4+3*a^(2/3)*x^2+x^6),1/6*x*sqrt((x^2-a^(1/3))^5)+1/24*a^(1/3)*x*sqrt((x^2-a^(1/3))^3)-1/16*a^(2/3)*x*sqrt(x^2-a^(1/3))+1/16*a*log(x+sqrt(x^2-a^(1/3))),or(not(number(a)),a>0))",
170 "f(x^3*sqrt(a+x^6+3*a^(1/3)*x^4+3*a^(2/3)*x^2),1/7*sqrt((x^2+a^(1/3))^7)-1/5*a^(1/3)*sqrt((x^2+a^(1/3))^5),or(not(number(a)),a>0))",
172 "f(x^3*sqrt(-a-3*a^(1/3)*x^4+3*a^(2/3)*x^2+x^6),1/7*sqrt((x^2-a^(1/3))^7)+1/5*a^(1/3)*sqrt((x^2-a^(1/3))^5),or(not(number(a)),a>0))",
174 "f(1/(x-a)/sqrt(x^2-a^2),-sqrt(x^2-a^2)/a/(x-a))",
176 "f(1/(x+a)/sqrt(x^2-a^2),sqrt(x^2-a^2)/a/(x+a))",
178 "f(sqrt(a-x^2),1/2*(x*sqrt(a-x^2)+a*arcsin(x/sqrt(abs(a)))))",
179 //201 (seems to be handled somewhere else)
181 "f(1/x*1/sqrt(a-x^2),-1/sqrt(a)*log((sqrt(a)+sqrt(a-x^2))/x),or(not(number(a)),a>0))",
183 "f(sqrt(a-x^2)/x,sqrt(a-x^2)-sqrt(a)*log((sqrt(a)+sqrt(a-x^2))/x),or(not(number(a)),a>0))",
185 "f(x/sqrt(a-x^2),-sqrt(a-x^2))",
187 "f(x*sqrt(a-x^2),-1/3*sqrt((a-x^2)^3))",
189 "f(x^2*sqrt(a-x^2),-x/4*sqrt((a-x^2)^3)+1/8*a*(x*sqrt(a-x^2)+a*arcsin(x/sqrt(a))),or(not(number(a)),a>0))",
191 "f(x^3*sqrt(a-x^2),(-1/5*x^2-2/15*a)*sqrt((a-x^2)^3),or(not(number(a)),a>0))",
193 "f(x^2/sqrt(a-x^2),-x/2*sqrt(a-x^2)+a/2*arcsin(x/sqrt(a)),or(not(number(a)),a>0))",
195 "f(1/x^2*1/sqrt(a-x^2),-sqrt(a-x^2)/a/x,or(not(number(a)),a>0))",
197 "f(sqrt(a-x^2)/x^2,-sqrt(a-x^2)/x-arcsin(x/sqrt(a)),or(not(number(a)),a>0))",
199 "f(sqrt(a-x^2)/x^3,-1/2*sqrt(a-x^2)/x^2+1/2*log((sqrt(a)+sqrt(a-x^2))/x)/sqrt(a),or(not(number(a)),a>0))",
201 "f(sqrt(a-x^2)/x^4,-1/3*sqrt((a-x^2)^3)/a/x^3,or(not(number(a)),a>0))",
203 "f(sqrt(a*x^2+b),x*sqrt(a*x^2+b)/2+b*log(x*sqrt(a)+sqrt(a*x^2+b))/2/sqrt(a),and(number(a),a>0))",
205 "f(sqrt(a*x^2+b),x*sqrt(a*x^2+b)/2+b*arcsin(x*sqrt(-a/b))/2/sqrt(-a),and(number(a),a<0))",
207 "f(sin(a*x),-cos(a*x)/a)",
209 "f(cos(a*x),sin(a*x)/a)",
211 "f(tan(a*x),-log(cos(a*x))/a)",
213 "f(1/tan(a*x),log(sin(a*x))/a)",
215 "f(1/cos(a*x),log(tan(pi/4+a*x/2))/a)",
217 "f(1/sin(a*x),log(tan(a*x/2))/a)",
219 "f(sin(a*x)^2,x/2-sin(2*a*x)/(4*a))",
221 "f(sin(a*x)^3,-cos(a*x)*(sin(a*x)^2+2)/(3*a))",
223 "f(sin(a*x)^4,3/8*x-sin(2*a*x)/(4*a)+sin(4*a*x)/(32*a))",
225 "f(cos(a*x)^2,x/2+sin(2*a*x)/(4*a))",
227 "f(cos(a*x)^3,sin(a*x)*(cos(a*x)^2+2)/(3*a))",
229 "f(cos(a*x)^4,3/8*x+sin(2*a*x)/(4*a)+sin(4*a*x)/(32*a))",
231 "f(1/sin(a*x)^2,-1/(a*tan(a*x)))",
233 "f(1/cos(a*x)^2,tan(a*x)/a)",
235 "f(sin(a*x)*cos(a*x),sin(a*x)^2/(2*a))",
237 "f(sin(a*x)^2*cos(a*x)^2,-sin(4*a*x)/(32*a)+x/8)",
239 "f(sin(a*x)/cos(a*x)^2,1/(a*cos(a*x)))",
241 "f(sin(a*x)^2/cos(a*x),(log(tan(pi/4+a*x/2))-sin(a*x))/a)",
243 "f(cos(a*x)/sin(a*x)^2,-1/(a*sin(a*x)))",
245 "f(1/(sin(a*x)*cos(a*x)),log(tan(a*x))/a)",
247 "f(1/(sin(a*x)*cos(a*x)^2),(1/cos(a*x)+log(tan(a*x/2)))/a)",
249 "f(1/(sin(a*x)^2*cos(a*x)),(log(tan(pi/4+a*x/2))-1/sin(a*x))/a)",
251 "f(1/(sin(a*x)^2*cos(a*x)^2),-2/(a*tan(2*a*x)))",
253 "f(sin(a+b*x),-cos(a+b*x)/b)",
255 "f(cos(a+b*x),sin(a+b*x)/b)",
256 // 337+ (with the addition of b)
257 "f(1/(b+b*sin(a*x)),-tan(pi/4-a*x/2)/a/b)",
258 // 337- (with the addition of b)
259 "f(1/(b-b*sin(a*x)),tan(pi/4+a*x/2)/a/b)",
260 // 338 (with the addition of b)
261 "f(1/(b+b*cos(a*x)),tan(a*x/2)/a/b)",
262 // 339 (with the addition of b)
263 "f(1/(b-b*cos(a*x)),-1/tan(a*x/2)/a/b)",
265 "f(1/(a+b*sin(x)),1/sqrt(b^2-a^2)*log((a*tan(x/2)+b-sqrt(b^2-a^2))/(a*tan(x/2)+b+sqrt(b^2-a^2))),b^2-a^2)", // check that b^2-a^2 is not zero
267 "f(1/(a+b*cos(x)),1/sqrt(b^2-a^2)*log((sqrt(b^2-a^2)*tan(x/2)+a+b)/(sqrt(b^2-a^2)*tan(x/2)-a-b)),b^2-a^2)", // check that b^2-a^2 is not zero
269 "f(x*sin(a*x),sin(a*x)/a^2-x*cos(a*x)/a)",
271 "f(x^2*sin(a*x),2*x*sin(a*x)/a^2-(a^2*x^2-2)*cos(a*x)/a^3)",
273 "f(x*cos(a*x),cos(a*x)/a^2+x*sin(a*x)/a)",
275 "f(x^2*cos(a*x),2*x*cos(a*x)/a^2+(a^2*x^2-2)*sin(a*x)/a^3)",
277 "f(arcsin(a*x),x*arcsin(a*x)+sqrt(1-a^2*x^2)/a)",
279 "f(arccos(a*x),x*arccos(a*x)+sqrt(1-a^2*x^2)/a)",
281 "f(arctan(a*x),x*arctan(a*x)-1/2*log(1+a^2*x^2)/a)",
282 // 485 (with addition of a)
283 "f(log(a*x),x*log(a*x)-x)",
284 // 486 (with addition of a)
285 "f(x*log(a*x),x^2*log(a*x)/2-x^2/4)",
286 // 487 (with addition of a)
287 "f(x^2*log(a*x),x^3*log(a*x)/3-1/9*x^3)",
289 "f(log(x)^2,x*log(x)^2-2*x*log(x)+2*x)",
290 // 493 (with addition of a)
291 "f(1/x*1/(a+log(x)),log(a+log(x)))",
293 "f(log(a*x+b),(a*x+b)*log(a*x+b)/a-x)",
295 "f(log(a*x+b)/x^2,a/b*log(x)-(a*x+b)*log(a*x+b)/b/x)",
297 "f(sinh(x),cosh(x))",
299 "f(cosh(x),sinh(x))",
301 "f(tanh(x),log(cosh(x)))",
303 "f(x*sinh(x),x*cosh(x)-sinh(x))",
305 "f(x*cosh(x),x*sinh(x)-cosh(x))",
307 "f(sinh(x)^2,sinh(2*x)/4-x/2)",
309 "f(tanh(x)^2,x-tanh(x))",
311 "f(cosh(x)^2,sinh(2*x)/4+x/2)",
313 "f(x^3*exp(a*x^2),exp(a*x^2)*(x^2/a-1/(a^2))/2)",
315 "f(x^3*exp(a*x^2+b),exp(a*x^2)*exp(b)*(x^2/a-1/(a^2))/2)",
317 "f(exp(a*x^2),-i*sqrt(pi)*erf(i*sqrt(a)*x)/sqrt(a)/2)",
319 "f(erf(a*x),x*erf(a*x)+exp(-a^2*x^2)/a/sqrt(pi))",
321 // these are needed for the surface integral in the manual
323 "f(x^2*(1-x^2)^(3/2),(x*sqrt(1-x^2)*(-8*x^4+14*x^2-3)+3*arcsin(x))/48)",
324 "f(x^2*(1-x^2)^(5/2),(x*sqrt(1-x^2)*(48*x^6-136*x^4+118*x^2-15)+15*arcsin(x))/384)",
325 "f(x^4*(1-x^2)^(3/2),(-x*sqrt(1-x^2)*(16*x^6-24*x^4+2*x^2+3)+3*arcsin(x))/128)",
327 "f(x*exp(a*x),exp(a*x)*(a*x-1)/(a^2))",
328 "f(x*exp(a*x+b),exp(a*x+b)*(a*x-1)/(a^2))",
330 "f(x^2*exp(a*x),exp(a*x)*(a^2*x^2-2*a*x+2)/(a^3))",
331 "f(x^2*exp(a*x+b),exp(a*x+b)*(a^2*x^2-2*a*x+2)/(a^3))",
333 "f(x^3*exp(a*x),exp(a*x)*x^3/a-3/a*integral(x^2*exp(a*x),x))",
334 "f(x^3*exp(a*x+b),exp(a*x+b)*x^3/a-3/a*integral(x^2*exp(a*x+b),x))",