5 * This is a set of test integrals for testing various parts of the
6 * integration routines.
10 * We're testing irinte now, which handles things like x^m*sqrt(R^(2*p+1))
11 * for integral values of m and p.
17 * Tests of den1den1, 1/x/sqrt(R)
20 /* G&R a < 0, del < 0 */
21 integrate(1/x/sqrt(x^2-1),x);
24 /* G&R a > 0, del > 0 */
25 integrate(1/x/sqrt(x^2+1),x);
28 /* G&R a > 0, del = 0 */
29 /*integrate(1/x/sqrt(x^2-2*x+1),x);*/
31 /* G&R a < 0, del < 0 */
32 integrate(1/x/sqrt(-6+5*x-x^2),x);
33 asin(5*x/abs(x)-12/abs(x))/sqrt(6);
36 integrate(1/x/sqrt(-x^2+x-1),x);
37 %i*asinh(x/(sqrt(3)*abs(x))-2/(sqrt(3)*abs(x)));
41 * Test of denn, 1/sqrt(R^(2*p+1))
44 (assume(4*a*c-b^2>0), assume(c > 0), assume(a > 0), assume(b > 0),
48 /* 1/sqrt(R), repeated roots */
49 integrate(1/sqrt(c*x^2+b*x+b^2/4/c),x);
50 log(x+b/(2*c))/sqrt(c);
52 /* 1/sqrt(R^(2*p+1), p > 0, repeated roots */
53 integrate(1/sqrt(c*x^2+b*x+b^2/4/c)^3,x);
54 -1/(2*c^(3/2)*(x+b/(2*c))^2);
58 * 1/sqrt(R), distinct roots,
59 * G&R 2.261 case c > 0, del > 0
61 integrate(1/sqrt(R),x);
62 1/sqrt(c)*asinh((2*c*x+b)/sqrt(4*a*c-b^2));
65 * 1/sqrt(R^3), distinct roots,
68 factor(integrate(1/R^(3/2),x));
69 2*(2*c*x+b)/((4*a*c-b^2)*sqrt(c*x^2+b*x+a));
74 * G&R 2.263 eq. 3, for reduction; eq 4 for explicit solution.
76 factor(integrate(1/R^(5/2),x));
77 2*(2*c*x+b)*(8*c^2*x^2+8*b*c*x+12*a*c-b^2)
78 /(3*(4*a*c-b^2)^2*(c*x^2+b*x+a)^(3/2));
80 * Tests of den1denn, 1/x/sqrt(R^(2*p+1))
84 * G&R 2.268 gives the general solution for this:
86 * integrate(1/x/sqrt(R^(2*n+1)),x) =
87 * 1/(2*n-1)/a/sqrt(R^(2*n-1))
88 * - b/2/a*integrate(1/sqrt(R^(2*n+1)),x)
89 * + 1/a*integrate(1/x/sqrt(R^(2*n-1)),x)
91 * For this example, n = 1
93 * integrate(1/x/sqrt(R^3),x) =
95 * - b/2/a*integrate(1/sqrt(R^3),x)
96 * + 1/a*integrate(1/x/sqrt(R),x)
98 * and we already know the answers to the other two integrals.
100 integrate(1/x/sqrt(R^3),x);
101 -asinh(b*x/(sqrt(4*a*c-b^2)*abs(x))+2*a/(sqrt(4*a*c-b^2)*abs(x)))
103 -2*b*c*x/(a*(4*a*c-b^2)*sqrt(c*x^2+b*x+a))
104 -b^2/(a*(4*a*c-b^2)*sqrt(c*x^2+b*x+a))+1/(a*sqrt(c*x^2+b*x+a));
107 * Tests of nummdenn x^m/sqrt(R^(2*p+1))
111 * See G&R 2.264, eq 2:
113 * integrate(x/sqrt(R),x) =
114 * sqrt(R)/c - b/(2*c)*integrate(1/sqrt(R),x)
116 integrate(x/sqrt(R),x);
117 sqrt(''R)/c-b*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(2*c^(3/2));
120 * See G&R 2.264, eq 3:
122 * integrate(x^2/sqrt(R),x) =
123 * (x/(2*c)-3*b/(4*c^2))*sqrt(R)
124 * + (3*b^2/(8*c^2) - a/(2*c))*integrate(1/sqrt(R),x)
126 integrate(x^2/sqrt(R),x);
127 -a*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(2*c^(3/2))
128 +3*b^2*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(8*c^(5/2))
129 +x*sqrt(c*x^2+b*x+a)/(2*c)-3*b*sqrt(c*x^2+b*x+a)/(4*c^2);
133 * Test of repeated roots
135 integrate(x^2/sqrt(c*x^2+b*x+b^2/4/c),x);
136 b^2*log(x+b/(2*c))/(4*c^(5/2))+x^2/(2*sqrt(c))-b*x/(2*c^(3/2));
138 integrate(x^2/sqrt(c*x^2+b*x+b^2/4/c)^3,x);
139 log(x+b/(2*c))/c^(3/2)+b*x/(c^(5/2)*(x+b/(2*c))^2)
140 +3*b^2/(8*c^(7/2)*(x+b/(2*c))^2);
142 integrate(x^2/sqrt(c*x^2+b*x+b^2/4/c)^5,x);
143 -1/(2*c^(5/2)*(x+b/(2*c))^2)+b/(3*c^(7/2)*(x+b/(2*c))^3)
144 -b^2/(16*c^(9/2)*(x+b/(2*c))^4);
147 * Test denmnumn sqrt(R^(2*p+1))/x^m.
150 integrate(sqrt(R)/x,x);
151 -sqrt(a)*asinh(b*x/(sqrt(4*a*c-b^2)*abs(x))
152 +2*a/(sqrt(4*a*c-b^2)*abs(x)))
153 +b*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(2*sqrt(c))+sqrt(c*x^2+b*x+a);
155 integrate(sqrt(R^3)/x,x),radexpand:all;
156 -a^(3/2)*asinh(b*x/(sqrt(4*a*c-b^2)*abs(x))
157 +2*a/(sqrt(4*a*c-b^2)*abs(x)))
158 +3*a*b*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(4*sqrt(c))
159 -b^3*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(16*c^(3/2))
160 +(c*x^2+b*x+a)^(3/2)/3+b*x*sqrt(c*x^2+b*x+a)/4
161 +b^2*sqrt(c*x^2+b*x+a)/(8*c)+a*sqrt(c*x^2+b*x+a);
163 integrate(sqrt(R)/x^2,x);
164 -b*asinh(b*x/(sqrt(4*a*c-b^2)*abs(x))+2*a/(sqrt(4*a*c-b^2)*abs(x)))
166 +sqrt(c)*asinh((2*c*x+b)/sqrt(4*a*c-b^2))-sqrt(c*x^2+b*x+a)/x;
168 integrate(sqrt(R^3)/x^2,x),radexpand:all;
170 *asinh(b*x/(sqrt(4*a*c-b^2)*abs(x))+2*a/(sqrt(4*a*c-b^2)*abs(x)))
172 +3*a*sqrt(c)*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/2
173 +3*b^2*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(8*sqrt(c))
174 -(c*x^2+b*x+a)^(3/2)/x+3*c*x*sqrt(c*x^2+b*x+a)/2
175 +9*b*sqrt(c*x^2+b*x+a)/4;
177 /* Same as above, but test a = 0 (nonconstquadenum) */
178 integrate(sqrt(R-a)/x,x);
179 b*log(2*sqrt(c)*sqrt(c*x^2+b*x)+2*c*x+b)/(2*sqrt(c))+sqrt(c*x^2+b*x);
181 integrate(sqrt((R-a)^3)/x,x),radexpand:all;
182 -b^3*log(2*sqrt(c)*sqrt(c*x^2+b*x)+2*c*x+b)/(16*c^(3/2))
183 +(c*x^2+b*x)^(3/2)/3+b*x*sqrt(c*x^2+b*x)/4+b^2*sqrt(c*x^2+b*x)/(8*c);
185 integrate(sqrt(R-a)/x^2,x);
186 sqrt(c)*log(2*sqrt(c)*sqrt(c*x^2+b*x)+2*c*x+b)-2*sqrt(c*x^2+b*x)/x;
188 integrate(sqrt((R-a)^3)/x^2,x),radexpand:all;
189 3*b^2*log(2*sqrt(c)*sqrt(c*x^2+b*x)+2*c*x+b)/(8*sqrt(c))
190 +(c*x^2+b*x)^(3/2)/(2*x)+3*b*sqrt(c*x^2+b*x)/4;
192 integrate(sqrt((R-a)^3)/x^3,x),radexpand:all;
193 3*b*sqrt(c)*log(2*sqrt(c)*sqrt(c*x^2+b*x)+2*c*x+b)/2
194 +(c*x^2+b*x)^(3/2)/x^2-3*b*sqrt(c*x^2+b*x)/x;
197 * Test denmdenn 1/sqrt(R^(2*p+1))/x^m
199 integrate(1/sqrt(R)/x^2,x);
200 b*asinh(b*x/(sqrt(4*a*c-b^2)*abs(x))+2*a/(sqrt(4*a*c-b^2)*abs(x)))
202 -sqrt(c*x^2+b*x+a)/(a*x);
204 integrate(1/sqrt(R)/x^3,x);
205 c*asinh(b*x/(sqrt(4*a*c-b^2)*abs(x))+2*a/(sqrt(4*a*c-b^2)*abs(x)))
208 *asinh(b*x/(sqrt(4*a*c-b^2)*abs(x))+2*a/(sqrt(4*a*c-b^2)*abs(x)))
209 /(8*a^(5/2))+3*b*sqrt(c*x^2+b*x+a)/(4*a^2*x)
210 -sqrt(c*x^2+b*x+a)/(2*a*x^2);
212 integrate(1/sqrt(R^3)/x^2,x);
213 3*b*asinh(b*x/(sqrt(4*a*c-b^2)*abs(x))+2*a/(sqrt(4*a*c-b^2)*abs(x)))
215 -8*c^2*x/(a*(4*a*c-b^2)*sqrt(c*x^2+b*x+a))
216 +3*b^2*c*x/(a^2*(4*a*c-b^2)*sqrt(c*x^2+b*x+a))
217 -1/(a*x*sqrt(c*x^2+b*x+a))-4*b*c/(a*(4*a*c-b^2)*sqrt(c*x^2+b*x+a))
218 +3*b^3/(2*a^2*(4*a*c-b^2)*sqrt(c*x^2+b*x+a))
219 -3*b/(2*a^2*sqrt(c*x^2+b*x+a));
221 integrate(1/sqrt(R^3)/x^3,x);
222 3*c*asinh(b*x/(sqrt(4*a*c-b^2)*abs(x))+2*a/(sqrt(4*a*c-b^2)*abs(x)))
225 *asinh(b*x/(sqrt(4*a*c-b^2)*abs(x))+2*a/(sqrt(4*a*c-b^2)*abs(x)))
226 /(8*a^(7/2))+13*b*c^2*x/(a^2*(4*a*c-b^2)*sqrt(c*x^2+b*x+a))
227 -15*b^3*c*x/(4*a^3*(4*a*c-b^2)*sqrt(c*x^2+b*x+a))
228 +5*b/(4*a^2*x*sqrt(c*x^2+b*x+a))-1/(2*a*x^2*sqrt(c*x^2+b*x+a))
229 +13*b^2*c/(2*a^2*(4*a*c-b^2)*sqrt(c*x^2+b*x+a))
230 -15*b^4/(8*a^3*(4*a*c-b^2)*sqrt(c*x^2+b*x+a))
231 -3*c/(2*a^2*sqrt(c*x^2+b*x+a))+15*b^2/(8*a^3*sqrt(c*x^2+b*x+a));
233 /* Same as above, but test the case of a = 0 (test noconstquad) */
234 integrate(1/sqrt(R-a)/x^2,x);
235 4*c*sqrt(c*x^2+b*x)/(3*b^2*x)-2*sqrt(c*x^2+b*x)/(3*b*x^2);
237 integrate(1/sqrt(R-a)/x^3,x);
238 -16*c^2*sqrt(c*x^2+b*x)/(15*b^3*x)+8*c*sqrt(c*x^2+b*x)/(15*b^2*x^2)
239 -2*sqrt(c*x^2+b*x)/(5*b*x^3);
241 integrate(1/sqrt((R-a)^3)/x^2,x),radexpand:all;
242 -32*c^3*x/(5*b^4*sqrt(c*x^2+b*x))+4*c/(5*b^2*x*sqrt(c*x^2+b*x))
243 -2/(5*b*x^2*sqrt(c*x^2+b*x))
244 -16*c^2/(5*b^3*sqrt(c*x^2+b*x));
246 integrate(1/sqrt((R-a)^3)/x^3,x),radexpand:all;
247 256*c^4*x/(35*b^5*sqrt(c*x^2+b*x))-32*c^2/(35*b^3*x*sqrt(c*x^2+b*x))
248 +16*c/(35*b^2*x^2*sqrt(c*x^2+b*x))
249 -2/(7*b*x^3*sqrt(c*x^2+b*x))
250 +128*c^3/(35*b^4*sqrt(c*x^2+b*x));
253 * Test nummnumn x^m*sqrt(R^(2*p+1))
256 integrate(sqrt(R),x);
257 a*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(2*sqrt(c))
258 -b^2*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(8*c^(3/2))
259 +x*sqrt(c*x^2+b*x+a)/2+b*sqrt(c*x^2+b*x+a)/(4*c);
261 integrate(x*sqrt(R),x);
262 -a*b*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(4*c^(3/2))
263 +b^3*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(16*c^(5/2))
264 +(c*x^2+b*x+a)^(3/2)/(3*c)-b*x*sqrt(c*x^2+b*x+a)/(4*c)
265 -b^2*sqrt(c*x^2+b*x+a)/(8*c^2);
267 integrate(x^2*sqrt(R),x);
268 a*(5*b^2-4*a*c)*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(32*c^(5/2))
269 -b^2*(5*b^2-4*a*c)*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(128*c^(7/2))
270 +x*(c*x^2+b*x+a)^(3/2)/(4*c)-5*b*(c*x^2+b*x+a)^(3/2)/(24*c^2)
271 +(5*b^2-4*a*c)*x*sqrt(c*x^2+b*x+a)/(32*c^2)
272 +b*(5*b^2-4*a*c)*sqrt(c*x^2+b*x+a)/(64*c^3);
274 integrate(x^3*sqrt(R),x);
275 -7*a*b*(5*b^2-4*a*c)*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(320*c^(7/2))
276 +7*b^3*(5*b^2-4*a*c)*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(1280*c^(9/2))
277 +a^2*b*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(10*c^(5/2))
278 -a*b^3*asinh((2*c*x+b)/sqrt(4*a*c-b^2))/(40*c^(7/2))
279 +x^2*(c*x^2+b*x+a)^(3/2)/(5*c)-7*b*x*(c*x^2+b*x+a)^(3/2)/(40*c^2)
280 -2*a*(c*x^2+b*x+a)^(3/2)/(15*c^2)+7*b^2*(c*x^2+b*x+a)^(3/2)/(48*c^3)
281 -7*b*(5*b^2-4*a*c)*x*sqrt(c*x^2+b*x+a)/(320*c^3)
282 +a*b*x*sqrt(c*x^2+b*x+a)/(10*c^2)
283 -7*b^2*(5*b^2-4*a*c)*sqrt(c*x^2+b*x+a)/(640*c^4)
284 +a*b^2*sqrt(c*x^2+b*x+a)/(20*c^3);
286 /* Integration is not correct: invalid 'false' term in results - ID: 3470668 */
287 (assume(4*a*c > 1), 0);
290 integrate(x^4 / (a*x^2 + x + c)^(5/2), x);
291 'integrate(x^4 / (a*x^2 + x + c)^(5/2), x);
293 (forget(4*a*c > 1), 0);
296 /*------------------------------------------------------------------------------*/
298 * I (rtoy) have not verified any of these, except for the cases so marked.
302 * Sample integrals from MIT LCS TR-092, Wang's thesis on definite integration
306 /* Verified by doing the indefinite integral and taking limits */
307 /* Tests mtoinf and zmtorat */
308 factor(integrate((x^2+a1*x+b1)/(x^4+10*x^2+9),x,minf,inf));
313 * Evaluating the indefinite integral and taking appropriate limits
314 * gives the equivalent answer
316 /* Tests ztoinf and zmtorat */
317 factor(integrate((x^2+a1*x+b1)/(x^4+10*x^2+9),x,0,inf));
318 (%pi*b1+3*log(3)*a1+3*%pi)/24;
323 * Wang gives 2*%pi/3/sqrt(3), which is equivalent. Why doesn't maxima
324 * know that atan(sqrt(3)) is %pi/3?
326 /* Verified by doing evaluating indefinite integral */
327 /* Tests ztoinf and zmtorat */
328 integrate(1/(x^2+x+1),x,0,inf);
329 2*sqrt(3)*atan(sqrt(3))/3;
333 * Using contour integration, we see this has poles at %i and 2*%i. The
334 * residues are 0 and -%i/3, respectively, so the integral is 2*%pi/3.
336 /* Tests ztoinf and zmtorat */
337 integrate((x-%i)/((x-2*%i)*(x^2+1)),x,minf,inf);
341 /* Tests ztoinf and zmtorat */
342 integrate((x-%i)/((x-2*%i)*(x^2+1)),x,0,inf);
343 (6*%i*log(2)+6*%pi)/18;
348 * Wang gives 4*%pi/9/sqrt(3)-1/2, which is equivalent.
351 /* Verified via indefinite integral */
352 /* Tests ztoinf and zmtorat */
353 integrate(1/(x^2+x+1)^3,x,0,inf);
354 (8*sqrt(3)*%pi-27)/54;
358 /* Verified via indefinite integral */
359 /* Tests ztoinf and batapp */
360 integrate(1/((1+x)*sqrt(x)),x,0,inf);
365 * First, we need assume(k < 0, k+1>0). Then we also need to tell
366 * maxima k is not an integer. Then maxima can evaluate this integral.
368 /* Tests ztoinf and batapp */
369 (assume(kj<0,kj+1>0,exp(kj)<1),0);
371 (declare(kj,noninteger),0);
373 integrate(x^kj/(x+3),x,0,inf);
377 /* I think Wang meant the integral from a to inf, not 0 to inf. */
379 * Tests parse-integrand, method-by-limits, dintegrate,
380 * method-radical-poly, intsubs.
382 integrate(1/(x^2*sqrt(x^2-a^2)),x,a,inf);
387 * Wang gives 1024/6567561
389 * This particular integral matches form III with M = 6, N = 6, A = B
392 * Based on his procedure, the case N>=M holds, and the integral is
394 * H*diff(U(1,1+z2,1+z3),z2,6)
396 * evaluated at z2=z3=0, where U(a,b,c) = 1/(sqrt(c)*(b/2+sqrt(a*c)))
397 * and H = (-1)^N*sqrt(%pi)/2/gamma(3/2+N). If we substitute the
398 * values in, we find the answer is 2048/6567561.
400 * Thus, Wang's answer is wrong.
403 * Tests method-by-limits, dintegrate, method-radical-poly, intsubs.
405 integrate(x^6/(x^2+x+1)^(15/2),x,0,inf);
410 * The single pole in the upper half plane is %i, and the residue of
411 * exp(%i*x)/(x^2+1) is -%i/2*exp(-1), so the integral is as given.
413 /* Tests mtoinf, mtosc */
414 integrate(cos(x)/(x^2+1),x,minf,inf);
419 * The single pole in the upper half plane is %i, and the residue of
420 * x*exp(%i*x)/(x^2+1) is exp(-1)/2, so the integral is as given.
422 /* Tests mtoinf, mtosc */
423 integrate(x*sin(x)/(x^2+1),x,minf,inf);
427 /* This follows from the above example. Besides the function is odd. */
428 integrate(x*cos(x)/(x^2+1),x,minf,inf);
434 * %pi/2*((-1/sqrt(3)-%i)*%e^((sqrt(3)-%i)/2) + (%i-1/sqrt(3))*%e^((-sqrt(3)-%i)/2))
436 * That can't be right because the result has real and imaginary parts.
438 * Maxima calculates this correctly.
440 /* Tests mtoinf, mtosc */
441 integrate(x*cos(x)/(x^2+x+1),x,minf,inf);
442 %e^-(sqrt(3)/2)*(3*%pi*sin(1/2)-sqrt(3)*%pi*cos(1/2))/3;
445 /* Tests mtoinf, mtosc */
446 integrate(1/(%e^(%i*x)*(x^2+1)),x,minf,inf);
453 * I think Wang's answer is wrong.
455 * If we exponentialize the integrand, we get
457 * %i*exp(-2*%i*x)/2/(x^2+1) - %i/2/(x^2+1).
459 * The integral of the second term is obviously %i*%pi/2. The
460 * integral of the first term can be down via residues, using the
461 * residue at x = -%i, which is -exp(-2)/4. Thus, the integral should
462 * be %i*%pi*exp(-2)/2-%i*%pi/2. (We need to change the sign of the
463 * residue because we traverse the real axis in the opposite
466 /* Tests mtoinf, mtosc */
467 integrate(sin(x)/(%e^(%i*x)*(x^2+1)),x,minf,inf);
468 -%e^(-2)*(%e^2-1)*%i*%pi/2;
472 * Wang gives %pi/%e^2
474 * I think Wang's answer is wrong.
476 * Using the same derivation as above, we get
478 * %i/2/(x^2+1)*(exp(-3*%i*x)-exp(-%i*x).
480 * We use the lower half plane and compute the residue at x = -%i,
481 * which is exp(-3)*(exp(2)-1)/4. Thus, the integral is
482 * -%i*%pi*exp(-3)*(exp(2)-1)/2.
484 /* Tests mtoinf, mtosc */
485 integrate(sin(x)/(%e^(2*%i*x)*(x^2+1)),x,minf,inf);
486 -%e^(-3)*(%e^2-1)*%i*%pi/2;
488 /* Integration of products of sin(nz)/(nz) sometimes fails - ID: 3497046 */
489 integrate(sin(z)/z*sin(3*z)/(3*z)*sin(5*z)/(5*z)*sin(7*z)/(7*z),z,minf,inf);
494 * Wang gives 3*gamma(3/7)*cos(3*%pi/14)/(7*9^(3/7))
496 * I've verified the derivation and the value, so I think this is right.
498 /* Tests ztoinf, scaxn */
499 integrate(cos(9*x^(7/3)),x,0,inf);
500 3*gamma(3/7)*cos(3*%pi/14)/(7*9^(3/7));
505 * Wang gives 3*gamma(3/7)*sin(3*%pi/14)/(7*9^(3/7))
509 /* Tests ztoinf, scaxn */
510 integrate(sin(9*x^(7/3)),x,0,inf);
511 3*gamma(3/7)*sin(3*%pi/14)/(7*9^(3/7));
516 * Wang gives gamma((2*%i+4)/3)/3/(%i/2)^((2*%i+4)/3)
518 * I think this is right, in a sense. The final formula he gives is
519 * wrong, but the derivation leading up to it is correct, except that
520 * he has the wrong value for integrate(x^m*exp(k*x^n),x,0,inf).
522 * However, Wang also says these integrals only converge if
523 * n-realpart(m)>1, and we have n=3 and realpart(m)=2, so we don't
524 * satisfy the convergence criterion.
527 integrate(x^(3/2*%i+3)/exp(%i*x^3/2),x,0,inf);
528 (-sqrt(3)*%i/2-1/2)*2^((2*%i+4)/3)*gamma((2*%i+4)/3)/3;
533 * We can verify this by integrate(exp(%i*s*x)/sqrt(x),x,0,inf) and
534 * taking the imaginary part. This satisfies the convergence
535 * criteria, and maxima returns the value
536 * sqrt(%pi)/sqrt(s)*exp(%i*%pi/4). Thus, we get the answer below.
538 /* Tests ztoinf, sconvert, ggr */
541 ratsimp(integrate(sin(s*x)/sqrt(x),x,0,inf));
542 sqrt(%pi)/(sqrt(2)*sqrt(s));
545 /* Tests ztoinf, ssp */
549 integrate(sin(r*x)/x,x,0,inf);
553 /* Tests ztoinf, ssp */
556 integrate(sin(q*x)^2/x^2,x,0,inf);
561 * We can verify this integral by using
562 * integrate(x^k*log(x)^2/(x^2+1),x,0,inf), and the evaluate the
563 * result at k = 0. The integral is a bit messy in terms of a beta
564 * function, the digamma, and trigamma functions. But maxima can
565 * evaluate these at k = 0 and the result is %pi^3/8.
568 /* Tests method-by-limits, zto1, batap-inf */
569 integrate(log(x)^2/(x^2+1),x,0,inf);
576 * log(3)*3^k*beta(k+1,-k) + 3^k*diff(beta(r,-k),r) - diff(beta(k+1,r),r)
578 * where the first derivative is evaluated at r=1+k and the second at r=-k.
580 * Actually, we can have maxima compute it for us, because we want the
581 * derivative of x^k*beta(k+1,-k) which is
583 * log(3)*3^k*beta(k+1,-k)+3^k*(psi[0](k+1)-psi[0](-k))*beta(k+1,-k)
585 * Some simple numerical evaluations for k=-1/2 and k=-1/3 indicates
586 * that this result is probably correct.
588 /* Tests method-by-limits, zto1, batap-inf */
589 integrate(x^kj*log(x)/(x+3),x,0,inf);
590 3^kj*(psi[0](kj+1)-psi[0](-kj))*beta(kj+1,-kj)+log(3)*3^kj*beta(kj+1,-kj);
593 * This is the same integral as above, using the substitution
594 * y=log(x). See also Bug 1451351.
596 /* Tests method-by-limits, zto1, batap-inf */
597 integrate(x*exp((kj+1)*x)/(exp(x)+3),x,minf,inf);
598 3^kj*(psi[0](kj+1)-psi[0](-kj))*beta(kj+1,-kj)+log(3)*3^kj*beta(kj+1,-kj);
602 * subres/red gcd gets a "quotient is not exact" error. spmod works better.
604 * The substitution y=1/x produces the same integral with a negative
605 * sign, so the answer must be zero.
607 /* Tests method-by-limits, dintlog */
609 integrate((atan(x^(1/3)) + atan(x^(-1/3)))*log(x)/(x^2+1),x,0,inf);
614 * Wang gives %pi/sin(5*%pi/7)
616 * Based on his thesis, integration by parts for
617 * integrate(log(1+x^(7/2))/x^2,0,inf) gives
620 * -log(1+x^(7/2))/x| - integrate(-1/x*7/2*x^(5/2)/(1+x^(7/2)),x,0,inf)
623 * = 7/2*integrate(x^(3/2)/(x^(7/2)+1),x,0,inf)
625 * Use the substitution (maxima doesn't do this) x = y^2 to get
627 * = 7*integrate(y^4/(y^7+1),y,0,inf)
631 * gcd:red gives a "quotient is not exact" error, so use
632 * spmod. We need intanalysis false to give the routine a chance.
633 * (If true, we return the integral unevaluated. I think this is
634 * because solve fails to find the roots of x^(7/2)+1=0 correctly.)
636 /* Tests method-by-limits, dintlog, dintbypart, ztoinf, batapp */
637 (intanalysis:false, 0);
640 integrate(log(x^(7/2)+1)/x^2,x,0,inf);
641 /*%pi/sin(5*%pi/7);*/
642 /* The result of the integral is beta(5/7,2/7). This simplifies to
643 %pi/sin(5*%pi/z). Because we have introduced a symmetry rule for
644 the beta function, Maxima first simplifies to beta(2/7,5/7).
645 The equivalent result is %pi/sin(2*%pi/7). 03/2009 (DK) */
648 (intanalysis:true, 0);
652 /* Verified via indefinite integral */
653 /* Tests dintegrate, method-by-limits, method-radical-poly */
654 factor(integrate(1/(exp(x/3)*(5/exp(x/3)+7)),x,0,inf));
655 3*(log(12)-log(7))/5;
658 /* Verified via indefinite integral */
659 integrate(exp(x/4)/(9*exp(x/2)+4),x,minf,inf);
665 * Not sure if this is right or not. Maxima is using rectzto%pi2 to
666 * evaluate this integral.
668 * If we follow Wang's derivation, we need to find q(z) such that
669 * q(z)-q(z+2*%i*%pi) = z. We find that q(z) = %i/(4*%pi)*z^2+z/2.
671 * R(z) = 1/((z-1/z)/2-%i. We need to find the poles of R(z) such
672 * that 0 <= Im(z) < 2*%pi. In this case, the (only) pole is z = %i.
673 * We need to then find the residue of q(z)/(sinh(z)-%i) at z =
674 * glog(%i) = %i*%pi/2. Maxima says the residue is -%i/2. Hence the
675 * value of the integral is 2*%i*%pi*(-%i/2) = %pi.
677 /* Tests mtoinf, rectzto%pi2 */
678 integrate(x/(sinh(x)-%i),x,minf,inf);
683 /* Tests ztoinf, ggr */
684 integrate(exp(-x^2),x,0,inf);
689 * The substitution y=s*t produces 1/sqrt(s)*integrate(y^(-1/2)*exp(-y),y,0,inf),
690 * which is gamma(1/2)/sqrt(s).
692 /* Tests ztoinf, ggr */
693 integrate(1/sqrt(t)/exp(s*t),t,0,inf);
697 * Write this as imagpart(integrate(exp(%i*s*x)/exp(x),x)). Evaluate
698 * the result at x=inf and at x=0. We get the expected answer.
701 integrate(sin(s*x)/exp(x),x,0,inf);
706 * There's a typo in Wang's thesis. He has the integrand as
707 * exp(-s*t)*x^(1/3)*log(x). I changed the x's to t's.
709 * Also, Wang says the answer is
711 * -gamma(1/3)*(log(s)-psi(4/3))/(6*s^(4/3))
713 * Assuming psi(4/3) is maxima's digamma function, psi[0](4/3), this
714 * result is 1/2 of the result maxima produces.
716 * Consider integrate(t^(z+1/3)*exp(-s*t),t,0,inf). Differentiating
717 * this wrt to z gives us the integral we're looking for, when we
718 * evaluate the result at z = 0.
720 * But this integral is equal to
721 * 1/s^(z+4/3)*integrate(y^(z+1/3)*exp(-y),y,0,inf), which is a Gamma
722 * function. Thus, we have
724 * gamma(z+4/3)/s^(z+4/3)
726 * Differentiate wrt to z:
728 * s^(-z-4/3)*(psi[0](z+4/3)-log(s))*gamma(z+4/3)
732 * gamma(1/3)*(psi[0](4/3)-log(s))/(3*s^(4/3))
734 * This is the answer we get below, once we evaluate psi[0](4/3).
735 * Wang's thesis is off by a factor of 2.
737 integrate(exp(-s*t)*t^(1/3)*log(t),t,0,inf);
738 gamma(1/3)*(-3*log(3)/2-%pi/(2*sqrt(3))-%gamma+3)/(3*s^(4/3))
739 -gamma(1/3)*log(s)/(3*s^(4/3));
742 /* Verified via indefinite integral */
743 ratsimp(integrate(1/(x^2-3),x,0,1) - sqrt(3)*log(2-sqrt(3))/6);
747 /* Verified via indefinite integral */
748 integrate(cos(x)^2-sin(x),x,0,2*%pi);
755 * Evaluation of the indefinite integral says 0.
757 integrate(exp(2*%i*x)/(exp(%i*x)+3),x,0,2*%pi);
762 * Wang gives the equivalent 6/5*gamma(2/3)*gamma(3/4)/gamma(5/12)
764 integrate(cos(x)^(1/3)*sin(x)^(1/2),x,0,%pi/2);
769 * Wang gives the equivalent 18/7*sqrt(%pi)*gamma(2/3)/gamma(1/6)
771 integrate(cos(x)^(1/3)*sin(x)^2,x,-%pi/2,%pi/2);
775 integrate(cos(x)^3*sin(x)^2,x,3*%pi/2,3*%pi);
780 * Wang gives -%i/3*plog((3+%i*sqrt(7))/4)
782 * The rectform is -atan(sqrt(7)/3)/3, which is -acos(3/4)/3,
783 * which is -1/3*(%pi/2-asin(3/4))=-%pi/6+asin(3/4)/3.
784 * Maxima gives an answer with the opposite sign.
786 * But we can evaluate the indefinite integral to be
790 * Hence the answer should be %pi/6-asin(3/4)/3.
792 * Wang's thesis is wrong.
794 integrate(1/(x*sqrt(x^2-9)),x,3,4);
799 /* Verified via indefinite integral */
800 logcontract(integrate(1/((x+1)*sqrt(4-x^2)),x,0,2) - sqrt(3)*log(sqrt(3)+2)/3);
805 * Maxima asks if k is an integer, but it doesn't matter,
806 * and I don't know how to tell maxima that k isn't an integer.
809 (assume(k1>0),declare(k1,noninteger),0);
812 * This is not such a good integral to use. log(x) is negative over
813 * the integration limits, so integrand is complex. Let's change the
814 * integrand to be (-log(x))^k1, instead, which is real-valued.
816 * In this case, it's easy to see that the substitution y=-log(x)
817 * gives as a gamma function.
820 integrate(log(x)^k1,x,0,1);
823 integrate((-log(x))^k1,x,0,1);
827 integrate(sqrt(log(x))/x^2,x,1,inf);
832 * Wang says -sqrt(%pi)/sqrt(4/3) = -sqrt(3)*sqrt(%pi)/2.
834 * This is wrong. Clearly, the integrand is positive, so the integral
837 * The issue is that radexpand is true so the Risch integrator is
838 * doing something not quite right and getting the sign wrong. If we
839 * set radexpand to false, we get the correct answer.
844 integrate(x^(1/3)/sqrt(-log(x)),x,0,1);
850 /* [ 1731624 ] asked about sign of yx in integral containing only z */
851 integrate(exp(sqrt(x^3)),x,0,1);
852 2*((-1)^(1/3)*gamma_incomplete(2/3,-1)-(-1)^(1/3)*gamma(2/3))/3;
853 /* with radexpand:true and domain:real we get
854 integrate(exp(sqrt(x^3)),x) -> -2*gamma_incomplete(2/3,-x^(3/2))/3
855 (which is not correct) due to invalid simplification in
856 integrate-exp-special
867 * Wang gives 4*diff(beta(r,3/2),r)
868 * evaluated at r = 1.
870 * Maxima says 4*factor(ratsimp(subst(1,r,diff(makegamma(beta(r,3/2)),r))))
871 * = 16*(3*log(2)-4)/9. Good.
873 factor(integrate(sqrt(1-sqrt(x))*log(x)/sqrt(x),x,0,1));
876 /*------------------------------------------------------------------------------*/
878 /* Problems from Moses' thesis, Appendix D, problems proposed by McIntosh */
882 * Answer = 1/a*asin(a/r/sqrt(2*h))
884 * (This answer seems wrong. The derivative has the wrong sign?)
889 ratsimp(integrate(1/r/sqrt(2*h*r^2-a^2),r) + asin(a/sqrt(2)/sqrt(h)/abs(r))/a);
894 * Answer = -1/sqrt(a^2-eps^2)*asin(sqrt(a^2+eps^2)/sqrt(2*h)/r)
897 integrate(1/sqrt(2*h*r^2-a^2-eps^2),r);
902 * Answer = 1/2/a*asin((h*r^2-a^2)/r^2/sqrt(h^2-2*k*a^2))
906 (assume(h^2>2*a^2*k),0);
908 factor(integrate(1/r/sqrt(2*h*r^2-a^2-2*k*r^4),r));
909 1/2/a*asin((h*r^2-a^2)/r^2/sqrt(h^2-2*k*a^2));
913 * Answer = 1/2/sqrt(a^2+eps^2)*asin((h*r^2-(a^2+eps^2))/r^2/sqrt(h^2-2*k*(a^2+eps^2)))
914 * h^2 > 2*(a^2+eps^2)*k
916 * Maxima doens't get stuck anymore, but I can't figure out the magic
917 * assume expression so that integrate doesn't ask questions anymore.
920 (assume(2*eps^2*k+2*a^2*k-h^2 < 0),0);
922 integrate(1/r/sqrt(2*h*r^2-a^2-eps^2-2*k*r^4),r);
923 1/2/sqrt(a^2+eps^2)*asin((h*r^2-(a^2+eps^2))/r^2/sqrt(h^2-2*k*(a^2+eps^2)));
928 * Answer = 1/a*asin((k*r-a^2)/r/sqrt(k^2+2*h*a^2))
931 * This answer seems wrong. The derivative doesn't match.
933 * Maxima's answer has a derivative that matches.
935 factor(integrate(1/r/sqrt(2*h*r^2-a^2-2*k*r),r));
936 -asin((k*r+a^2)/(sqrt(k^2+2*a^2*h)*r))/a;
940 * Answer = 1/(a^2+eps^2)*asin((k*r-(a^2+eps^2))/r/sqrt(k^2+2*h*(a^2+eps^2)))
943 * Same issue as problem 5.
945 * Maxima's answer has a derivative that matches.
948 factor(integrate(1/r/sqrt(2*h*r^2-a^2-eps^2-2*k*r),r));
949 -asin((k*r+eps^2+a^2)/(sqrt(k^2+(2*eps^2+2*a^2)*h)*r))/sqrt(eps^2+a^2);
952 integrate(x/sqrt(2*e*x^2-a^2),x);
953 sqrt(2*e*x^2-a^2)/(2*e);
956 integrate(x/sqrt(2*e*x^2-a^2-eps^2),x);
957 sqrt(2*e*x^2-eps^2-a^2)/(2*e);
961 * Answer is 1/2/sqrt(2*k)*asin((2*k*r^2-e)/sqrt(e^2-2*k*a^2))
965 (assume(e^2>2*k*a^2,k>0,e>0),0);
967 factor(integrate(r/sqrt(2*e*r^2-a^2-2*k*r^4),r));
968 1/2/sqrt(2*k)*asin((2*k*r^2-e)/sqrt(e^2-2*k*a^2));
972 * Answer is 1/2/sqrt(2*k)*asin((2*k*r^2-e)/sqrt(e^2-2*k*(a^2+eps^2)))
975 * For some reason, maxima returns
976 * -%i*asinh((2*k*r^2-e)/sqrt((2*eps^2+2*a^2)*k-e^2))/(2*sqrt(2)*sqrt(k))
978 * Using the fact that asin(%i*x) = %i*asinh(x), we see that the
979 * answer is identical.
981 (assume(2*eps^2*k+2*a^2*k-e^2>0),0);
983 factor(integrate(r/sqrt(2*e*r^2-a^2-eps^2-2*k*r^4),r));
984 -%i*asinh((2*k*r^2-e)/sqrt((2*eps^2+2*a^2)*k-e^2))/(2*sqrt(2)*sqrt(k));
989 * Answer is sqrt(2*E*r^2-a^2-2*k*r)/2*E
990 * + 1/(2*h*E*sqrt(-2*E))*asin((2*E*r+k)/sqrt(k^2-2*E-a^2)
993 (assume(E<0,k^2+2*E*a^2>0,k>0),0);
995 integrate(r/sqrt(2*E*r^2-a^2-2*k*r),r);
996 sqrt(2*E*r^2-2*k*r-a^2)/(2*E)-k*asin((4*E*r-2*k)/sqrt(4*k^2+8*a^2*E))
997 /(2*sqrt(2)*sqrt(-E)*E);
1000 factor(integrate(1/(sin(x)^2+1),x,0,8));
1001 (atan(sqrt(2)*sin(8)/cos(8))+3*%pi)/sqrt(2);
1003 ratsimp(integrate(1/(sin(x)^2+1),x,-8,0));
1004 (atan(sqrt(2)*sin(8)/cos(8))+3*%pi)/sqrt(2);
1006 ratsimp(integrate(1/(sin(x/3)^2+1),x,0,24));
1007 (3*atan(sqrt(2)*sin(8)/cos(8))+9*%pi)/sqrt(2);
1009 ratsimp(integrate(1/(sin(x-3)^2+1),x,3,11));
1010 (atan(sqrt(2)*sin(8)/cos(8))+3*%pi)/sqrt(2);
1012 /* defint log(sqrt(q^2-1)+1) asks about YX - ID: 924868 */
1013 integrate( log(sqrt(q^2-1)+1),q,0,1);
1014 'integrate( log(sqrt(q^2-1)+1),q,0,1);
1016 * ((4*asinh(1)+(2-sqrt(2))*%i*%pi+(-2^(3/2)))/2^(3/2));
1020 integrate(1/(2+cos(x)),x,-%pi/2,%pi/2);
1024 integrate(cos(x-c),x,c,%pi/2+c);
1027 integrate(cos(x)^3/sin(x)^4,x,1,2);
1028 1/sin(2)-1/(3*sin(2)^3)-1/sin(1)+1/(3*sin(1)^3);
1030 /* [ 1828956 ] Integration yields wrong results */
1031 /* assume & integrate - ID: 3522750 */
1032 (assume(x>0,l>x),0);
1034 integrate(integrate((acos(x/l)+acos(y/l)-%pi/2)/(2*%pi),y,0,sqrt(l^2-x^2)),x,0,l);
1038 (forget(x>0,l>x),0);
1041 /* principal value integral */
1042 /* [ 657382 ] defint/limit infinite loop */
1044 /* Because of changes to timesin this does no longer work
1045 integrate(1/(1-x^5), x, 0, inf);
1046 0-(2*sqrt(2*sqrt(5)+10)*atan((sqrt(5)-3)*sqrt(2*sqrt(5)+10)/(4*sqrt(5)))
1047 +2*sqrt(10-2*sqrt(5))*atan(sqrt(10-2*sqrt(5))*(sqrt(5)+3)/(4*sqrt(5)))
1048 -sqrt(2)*sqrt(sqrt(5)+5)*%pi-sqrt(2)*sqrt(5-sqrt(5))*%pi)
1052 integrate(1/x, x, minf, inf);
1055 /* #2513 wrong principle value integral */
1056 integrate(1/((x-1)*(x-2)),x,0,3);
1059 /* integrate(sin(x)^2/x,x,minf,inf) gives not zero - ID: 3480954 */
1060 integrate(sin(x)^2/x,x,minf,inf);
1063 /* [ 1051437 ] Trig integral error */
1064 integrate(2*cot(x)^2*cos(2*x)/(csc(2*x)+cot(2*x)), x);
1065 log(sin(x)^2+cos(x)^2+2*cos(x)+1) + log(sin(x)^2+cos(x)^2-2*cos(x)+1) + cos(2*x);
1067 /* [ 1960200 ] integrate function raises "too many contexts" error */
1068 float(rectform(integrate(integrate(x^2*y^2*(sin(2.*x)+%i*cos(2.*y))*exp(%i*20.*x)*exp(%i*30.*y),x,-1,-10),y,-5,15)));
1069 6.127592006717518 - 40.62195392101798 * %i;
1071 /* [ 2210087 ] integrate((x+1)^2.0,x) loops endlessly */
1072 integrate((x+1)^2.0,x);
1073 .3333333333333333*(x+1)^3.0;
1075 integrate(x^3/(1 + + 4*x^2 + 6*x^4 + 4*x^6 + x^8 ), x, 0, inf);
1078 /* [ 1668087 ] integrate(1/cosh(x/R)^4,x,-inf,inf) = 0 */
1079 /* already assumed a>0 */
1080 integrate(1/cosh(x/a)^4,x,-inf,inf);
1083 /* [ 1309432 ] integrate(1/cosh(a*x)^2,x,-inf,inf); */
1084 /* already assumed a>0 */
1085 integrate(1/cosh(x/a)^2,x,-inf,inf);
1088 /* [ 1860487 ] MONSTERTRIG endless recursion */
1089 integrate (x*(cos(2*x) + sin(x)), x);
1090 (2*x*sin(2*x)+cos(2*x))/4+sin(x)-x*cos(x);
1092 /* [ 1631094 ] integrate(sin(n*x)*x, x) => linear time when n is an integer */
1093 integrate(sin(1000000000*x)*x, x);
1094 (sin(1000000000*x)-1000000000*x*cos(1000000000*x))/1000000000000000000;
1096 /* [ 1847543 ] Integration problem of a special periodic function */
1097 integrate( 1/(11/10+sin(2*%pi*x)), x);
1098 10*atan((22*sin(2*%pi*x)/(cos(2*%pi*x)+1)+20)/(2*sqrt(21)))
1101 /* [ 1054472 ] defint(log(1+exp(A+B*cos(phi))),phi,0,%pi) wrong */
1103 /* Commenting this example out
1104 * There is a problem: The integral does not return the noun form, but
1105 * gives an error: "sign: argument cannot be imaginary; found %i".
1106 * If we execute this integral within the testsuite,
1107 * this integral seems to loop endlessly
1109 integrate(log(1+exp(cos(phi))),phi,0,%pi);
1110 'integrate(log(1+exp(cos(phi))),phi,0,%pi);
1114 /* atan2 function is a special case in lisp function INTEGRATOR.
1115 There were no regression tests for it. */
1116 integrate(atan2(y,x),x);
1117 y*log(y^2+x^2)/2+x*atan(y/x);
1119 integrate(atan2(y,x),y);
1120 y*atan(y/x)-(x*log(y^2/x^2+1)/2);
1122 /* Bug ID: 3023997 - integrate(x*atan2(x,y),x) -> noun form
1123 * We have generalized the special case for the atan2 function.
1125 integrate(y*atan2(y,x),y);
1126 y^2*atan(y/x)/2-(x^2*y-x^3*atan(y/x))/(2*x);
1128 /* [ 2501765 ] integrate((-14*x^2-32)/(x^4+3*x^2+1)^2,x,0,inf); */
1129 integrate(1/(x^4+3*x^2+1)^2,x,0,inf);
1130 (sqrt(3-sqrt(5))*(3*sqrt(2)*sqrt(5)+15*sqrt(2))*%pi
1131 +sqrt(sqrt(5)+3)*(15*sqrt(2)-3*sqrt(2)*sqrt(5))*%pi)
1134 /* integrate(exp(-x^n),x,0,1) bug for n >2 - ID: 3469184 */
1135 integrate(exp(-t^4),t,0,1);
1136 (gamma(1/4)-gamma_incomplete(1/4,1))/4;
1138 integrate(exp(sqrt(x)),x,1,5);
1139 2*(sqrt(5)*%e^sqrt(5)-%e^sqrt(5));
1141 /* [ 1899352 ] integrate asks about (y-1)(y+1) after assume(y^2>1) */
1144 ratsimp(integrate(log(x^2+y^2),x,0,1));
1145 log(y^2+1)+2*atan(1/y)*y-2;
1149 /* integrate(sqrt(t)*log(t)^(1/2),t,0,1) wrong sign - ID: 2847436 */
1150 integrate(sqrt(t)*log(t)^(1/2),t,0,1);
1151 sqrt(2)*sqrt(%pi)*%i/(3^(3/2));
1153 /* #2732 wrong answer for similar to gaussian integral */
1154 integrate(exp(-x^2-1/x^2),x,-inf,inf);
1157 /* Integrals of the type: c*z^w*log(z)^m*exp(-t^s) for 0 to inf */
1159 integrate(exp(-t),t,0,inf);
1161 integrate(exp(-t^2),t,0,inf);
1163 integrate(exp(-t^3),t,0,inf);
1165 integrate(exp(-t^4),t,0,inf);
1168 integrate(t*exp(-t),t,0,inf);
1170 integrate(t^2*exp(-t),t,0,inf);
1172 integrate(t^3*exp(-t),t,0,inf);
1174 integrate(t^4*exp(-t),t,0,inf);
1177 integrate(t*exp(-t^2),t,0,inf);
1179 integrate(t^2*exp(-t^2),t,0,inf);
1181 integrate(t^3*exp(-t^2),t,0,inf);
1183 integrate(t^4*exp(-t^2),t,0,inf);
1186 integrate(t^-2*exp(-t^-2),t,0,inf);
1188 integrate(t^-3*exp(-t^-2),t,0,inf);
1190 integrate(t^-4*exp(-t^-2),t,0,inf);
1193 integrate(t^(1/2)*exp(-t^2),t,0,inf);
1195 integrate(t^(1/3)*exp(-t^2),t,0,inf);
1197 integrate(t^(2/3)*exp(-t^2),t,0,inf);
1200 integrate(exp(-t)*log(t),t,0,inf);
1202 integrate(t*exp(-t)*log(t),t,0,inf);
1204 integrate(t^2*exp(-t)*log(t),t,0,inf);
1207 integrate(t*exp(-t)*log(t)^2,t,0,inf);
1208 (%pi^2+6*%gamma^2-12*%gamma)/6;
1209 integrate(t*exp(-t^(1/2))*log(t)^2,t,0,inf);
1210 8*%pi^2+48*%gamma^2-176*%gamma+96;
1211 integrate(t*exp(-t^2)*log(t),t,0,inf);
1215 /* Integrals of the type: c*z^w*log(z)^m*exp(-t^s) for x to inf */
1220 /* Expand Gamma and Incomplete Gamma functions */
1224 integrate(exp(-t),t,x,inf);
1226 integrate(exp(-t^2),t,x,inf);
1227 sqrt(%pi)*erfc(abs(x))/2;
1228 integrate(exp(-t^3),t,x,inf);
1229 gamma_incomplete(1/3,x^3)/3;
1230 integrate(exp(-t^4),t,x,inf);
1231 gamma_incomplete(1/4,x^4)/4;
1233 integrate(t*exp(-t),t,x,inf);
1235 integrate(t^2*exp(-t),t,x,inf);
1237 integrate(t^3*exp(-t),t,x,inf);
1238 (x^3+3*x^2+6*x+6)*%e^-x;
1239 integrate(t^4*exp(-t),t,x,inf);
1240 (x^4+4*x^3+12*x^2+24*x+24)*%e^-x;
1242 integrate(t*exp(-t^2),t,x,inf);
1244 integrate(t^2*exp(-t^2),t,x,inf);
1245 %e^-x^2*(sqrt(%pi)*%e^x^2*erfc(x)+2*x)/4;
1246 integrate(t^3*exp(-t^2),t,x,inf);
1248 integrate(t^4*exp(-t^2),t,x,inf);
1249 %e^-x^2*(3*sqrt(%pi)*%e^x^2*erfc(x)+4*x^3+6*x)/8;
1251 integrate(t^-2*exp(-t^-2),t,x,inf);
1252 -sqrt(%pi)*(erfc(1/x)-1)/2;
1253 integrate(t^-3*exp(-t^-2),t,x,inf);
1254 %e^-(1/x^2)*(%e^(1/x^2)-1)/2;
1255 integrate(t^-4*exp(-t^-2),t,x,inf);
1256 -%e^-(1/x^2)*(sqrt(%pi)*(erfc(1/x)-1)*x*%e^(1/x^2)+2)/(4*x);
1258 integrate(t^(1/2)*exp(-t^2),t,x,inf);
1259 gamma_incomplete(3/4,x^2)/2;
1260 integrate(t^(1/3)*exp(-t^2),t,x,inf);
1261 gamma_incomplete(2/3,x^2)/2;
1262 integrate(t^(2/3)*exp(-t^2),t,x,inf);
1263 gamma_incomplete(5/6,x^2)/2;
1265 integrate(exp(-t)*log(t),t,x,inf);
1266 -%e^-x*((%e^x-1)*log(x)+(%gamma-hypergeometric_regularized([1,1],[2,2],-x)*x)
1268 integrate(t*exp(-t)*log(t),t,x,inf);
1269 -%e^-x*((%e^x-x-1)*log(x)+(-hypergeometric_regularized([2,2],[3,3],-x)*x^2
1272 integrate(t^2*exp(-t)*log(t),t,x,inf);
1273 -%e^-x*((2*%e^x-x^2-2*x-2)*log(x)+(-4*hypergeometric_regularized(
1278 integrate(t*exp(-t)*log(t),t,x,inf);
1279 -%e^-x*((%e^x-x-1)*log(x)+(-hypergeometric_regularized([2,2],[3,3],-x)*x^2
1282 integrate(t*exp(-t^(1/2))*log(t),t,x,inf);
1283 %e^-sqrt(x)*((-12*%e^sqrt(x)+6*x+12)*log(x)+sqrt(x)*(2*x+12)*log(x)
1285 *hypergeometric_regularized(
1286 [4,4],[5,5],-sqrt(x))*x^2
1290 /* Integrals of the type: c*z^r*log(z)^n*(1-z)^s*log(1-z)^m */
1292 integrate(t*log(t)*(1-t)*log(1-t),t,0,1);
1294 integrate(t^2*log(t)*(1-t)*log(1-t),t,0,1);
1296 integrate(t^2*log(t)^2*(1-t)*log(1-t),t,0,1);
1297 (576*zeta(3)+56*%pi^2-1317)/3456;
1298 integrate(t^2*log(t)^2*(1-t)^2*log(1-t),t,0,1);
1299 (72000*zeta(3)+9400*%pi^2-191243)/1080000;
1300 integrate(t^2*log(t)^2*(1-t)^2*log(1-t)^2,t,0,1);
1301 (3384000*zeta(3)+6000*%pi^4+747800*%pi^2-12135541)/-16200000;
1303 /* integrate -> too many contexts - ID: 2838268 */
1304 integrate(t*cos(1.0*t),t);
1307 /* definite integral - bad answer - ID: 2880886 */
1308 integrate(cos(x)^2 * (1 + sin(x)^2)^-3,x,0,%pi/2);
1311 (forget(x>0),gamma_expand:false,done);
1314 /* BUG ID: 2906049 - integration failure with option integrate_use_rootsof
1315 * This example is more simple than the example in the bug report.
1319 integrate((a*x^2+b*x+c)/(d*x^3+a*x^2+b),x),integrate_use_rootsof:true;
1320 'lsum((c+%r1*b+%r1^2*a)*log(x-%r1)/(3*%r1^2*d+2*%r1*a),%r1,
1321 rootsof(d*x^3+a*x^2+b));
1323 /* fourier integral incorrect - ID: 2875784 */
1324 integrate(cos(x)*sin(x)/x, x, minf, inf);
1327 integrate(exp(%i*x)*sin(x)/x, x, minf, inf);
1330 integrate(exp(-%i*x)*sin(x)/x, x, minf, inf);
1333 /* Bug ID: 655270 - Incomplete integration
1335 integrate(sin(3*asin(x)),x);
1337 integrate(sin(4*asin(x)),x);
1338 (15*((1-x^2)^(3/2)/5-x^2*(1-x^2)^(3/2)/5)
1339 +sqrt(1-x)*sqrt(x+1)*(93*x^4-106*x^2+13))/-60;
1341 /* Bug ID: 3029610 - integrate and %e_to_numlog
1343 integrate((exp(3/2*log(x))+1)/sqrt(x),x);
1346 integrate(3*sqrt(x)*exp(3/2*log(x)),x);
1349 /* someday this should return 2*%pi */
1350 /* that would require handling the discontinuity in
1351 gamma_incomplete(0, exp(%i*x)) */
1352 integrate(exp(cos(x))*cos(sin(x)),x,0,2*%pi);
1353 'integrate(exp(cos(x))*cos(sin(x)),x,0,2*%pi);
1355 /* Bug ID: 3039452 - integrate(sqrt(t^c)/(t*(b*t^c+a)),t) hangs
1357 /* These assumptions are already present. Consider to delete it more early.
1360 integrate(sqrt(t^c)/(t*(b*t^c+a)),t);
1361 2*atan(sqrt(b)*%e^(c*log(t)/2)/sqrt(a))/(sqrt(a)*sqrt(b)*c);
1365 /* Bug ID: 3045559 integrate(exp(-u^2), u, minf, x) => incorrect gamma_incomple
1367 integrate(exp(-u^2),u,minf,x);
1368 sqrt(%pi)*erf(x)/2+sqrt(%pi)/2;
1370 /* integration error - ID: 3085498 */
1371 integrate(sqrt(1-cos(t)),t,0,2*%pi);
1374 /* incorrect integration - ID: 3153533 */
1377 integrate(1/(x-z),z,1,x-1);
1382 /* integrate(x^2*exp(x)/(1+exp(x))^2, x, minf, inf); - ID: 3158526 */
1383 integrate(x^2*exp(x)/(1+exp(x))^2, x, minf, inf);
1386 /* integrate(abs(sin(x)),x,0,2*%pi) wrong result - ID: 3165872 */
1387 integrate(abs(sin(x)),x,0,2*%pi);
1388 'integrate(abs(sin(x)),x,0,2*%pi);
1390 /* integrate(sin(2x)atan(sin(x)),x) - ID: 3199708 */
1391 integrate(sin(2*x)*atan(sin(x)),x,0,%pi/2);
1394 /* wrong integration answer - ID: 2989983 */
1395 integrate(cos(w+T)/(1+1/2*cos(T))^2,T,0,2*%pi);
1396 -8*%pi*cos(w)/3^(3/2);
1398 /* wrong sign for integral of e^(-1/x^2) - ID: 3211937 */
1399 integrate(%e^(-1/x^2),x,0,1);
1400 %e^-1*(sqrt(%pi)*%e*erf(1)+1)-sqrt(%pi);
1402 /* definite integration introduces xy variable - ID: 3292707 */
1403 integrate((log((2-x)/2)+log(2))/(1-x), x, 0, 1);
1404 li[2](2)-(6*log(2)^2-6*log(-2)*log(2)+%pi^2)/6;
1406 /* Incorrect integral of log(1+a/(x*t)^2) - ID: 3291160 */
1407 integrate(log(1+7/(x^2)),x,1,inf);
1408 (14*atan(sqrt(7))-sqrt(7)*log(8))/sqrt(7);
1410 /* Wrong sign in exponential integral - ID: 3517785 */
1411 integrate(1/(%e^(2*t)*sqrt(1-1/%e^(2*t))), t, 0, inf);
1414 /* integral from minf to inf of an absolute value combo fails - ID: 3313531 */
1415 integrate(abs(x - 1) + abs(x + 1) - 2*abs(x),x,minf,inf);
1418 /* definite integration - ID: 3315476 */
1419 integrate(1/2^x, x, 0, 1);
1422 /* discontinuities in integral */
1423 /* error in integrating exp(-x)*sinh(sqrt(x)) - ID: 3292033 */
1424 integrate(exp(sqrt(x)-x), x, 0, inf);
1425 %e^(1/4)*gamma_incomplete(1,1/4)-%e^(1/4)*gamma_incomplete(1/2,1/4)/2
1426 +%e^(1/4)*(sqrt(%pi)+2)/2
1427 +%e^(1/4)*sqrt(%pi)/2-%e^(1/4);
1429 %e^(1/4)*gamma_incomplete(1,1/4)-%e^(1/4)*gamma_incomplete(1/2,1/4)/2
1430 +%e^(1/4)*sqrt(%pi);
1433 /* integrate(log(t)*log(t+1),t,0,1) gives Lisp error - ID: 3381012 */
1434 integrate(log(t)*log(t+1),t,0,1);
1435 -2*log(2)-%pi^2/12+2;
1437 /* integrate(log(2*sin(t/2)),t,0,%pi) contains false - ID: 3381037 */
1438 integrate(log(2*sin(t/2)),t,0,%pi);
1439 2*((8*%i*li[2](%i)+8*%i*li[2](-%i)-4*%pi*log(2)+%i*%pi^2)/8
1440 +%pi*log(2)/2-%i*%pi^2/12);
1441 /* above result is really zero */
1443 /* integrate error - ID: 3388801 */
1444 integrate( sqrt((x-474)^2/(107669-(x-474)^2)+1), x, 181, 474);
1445 sqrt(107669)*%i*log(2*sqrt(107669)*%i)
1446 - sqrt(107669)*%i*log(4*sqrt(5455)*%i-586);
1448 /* integrate erf fails - ID: 3454370 */
1449 integrate( erf(x+a)-erf(x-a), x, minf, inf);
1452 /* Wrong result for definite integral - ID: 3538167 */
1453 integrate(cos(3*x)/(5-4*cos(x)),x,0,2*%pi);
1456 /* #2575 Integration error: integrate(sqrt(k-k*cos(2*x)), x) */
1457 integrate(sqrt(cos(x)+1), x, -%pi, %pi);
1460 /* #2776 Error when integrate sqrt */
1461 integrate ((1+exp(t))/sqrt(t+exp(t)), t, 0, 1);
1464 /* #2862 Incorrect result for integrate(u/(u+1)^2,u,0,inf); */
1465 errcatch(integrate(u/(u+1)^2,u,0,inf));
1469 ["defint: integral is divergent."];
1472 /* SF # 2633: ev(integrate,numer) gives strange result */
1473 (foo : ev(integrate(sin(2*%pi*x),x,0,1),numer), 0);
1476 freeof (false, foo);