@@ -2,7 +2,11 @@ using SymbolicIntegration, SymbolicUtils
2
2
using Symbolics # fopr derivative
3
3
SI = SymbolicIntegration
4
4
5
- @syms x a b c n t y Pi
5
+ @syms x t y Pi p q r
6
+ n = 7
7
+ a = 2 // 3
8
+ b = - 1 // 5
9
+ c = 5 // 4
6
10
7
11
# Integration Test Problems from
8
12
# https:////rulebasedintegration.org//testProblems.html
@@ -13,10 +17,10 @@ SI = SymbolicIntegration
13
17
problems = [
14
18
15
19
# Section 7.1 - Integration by Parts
16
- [x^ n, x, 1 , x^ (1 + n)/ (1 + n), SI . NotImplementedError], # n
20
+ [x^ n, x, 1 , x^ (1 + n)/ (1 + n)],
17
21
[exp (x), x, 1 , exp (x)],
18
22
[1 / x, x, 1 , log (x)],
19
- [a^ x, x, 1 , a^ x/ log (a), SI . NotImplementedError ], # a
23
+ [a^ x, x, 1 , a^ x/ log (a)],
20
24
[sin (x), x, 1 , - cos (x)],
21
25
[cos (x), x, 1 , sin (x)],
22
26
[sec (x)^ 2 , x, 2 , tan (x)],
@@ -47,7 +51,7 @@ problems = [
47
51
[exp (2 * t)* sin (3 * t), t, 1 , - 3 // 13 * exp (2 * t)* cos (3 * t)+ 2 // 13 * exp (2 * t)* sin (3 * t)],
48
52
[cos (3 * t)/ exp (t), t, 1 , - 1 // 10 * cos (3 * t)/ exp (t)+ 3 // 10 * sin (3 * t)/ exp (t)],
49
53
[y* sinh (y), y, 2 , y* cosh (y)- sinh (y)],
50
- [y* cosh (a* y), y, 2 , - cosh (a* y)/ a^ 2 + y* sinh (a* y)/ a, SI . NotImplementedError ], # a
54
+ [y* cosh (a* y), y, 2 , - cosh (a* y)/ a^ 2 + y* sinh (a* y)/ a],
51
55
[t/ exp (t), t, 2 , (- 1 )/ exp (t)- t/ exp (t)],
52
56
[log (t)* sqrt (t), t, 1 , - 4 // 9 * t^ (3 // 2 )+ 2 // 3 * t^ (3 // 2 )* log (t), SI. NotImplementedError],
53
57
[x* cos (2 * x), x, 2 , 1 // 4 * cos (2 * x)+ 1 // 2 * x* sin (2 * x)],
@@ -199,7 +203,7 @@ problems = [
199
203
[(- 1 + 4 * x)// ((- 1 + x)* (2 + x)), x, 2 , log (1 - x)+ 3 * log (2 + x)],
200
204
[1 // ((1 + x)* (2 + x)), x, 3 , log (1 + x)- log (2 + x)],
201
205
[(- 5 + 6 * x)// (3 + 2 * x), x, 2 , 3 * x- 7 * log (3 + 2 * x)],
202
- [1 // ((a+ x)* (b+ x)), x, 3 , - log (a+ x)// (a- b)+ log (b+ x)// (a- b), SI . NotImplementedError ], # a, b
206
+ [1 // ((a+ x)* (b+ x)), x, 3 , - log (a+ x)/ (a- b)+ log (b+ x)/ (a- b)],
203
207
[(1 + x^ 2 )// (- x+ x^ 2 ), x, 3 , x+ 2 * log (1 - x)- log (x)],
204
208
[(1 - 12 * x+ x^ 2 + x^ 3 )// (- 12 + x+ x^ 2 ), x, 5 , 1 // 2 * x^ 2 + 1 // 7 * log (3 - x)- 1 // 7 * log (4 + x)],
205
209
[(3 + 2 * x)// (1 + x)^ 2 , x, 2 , (- 1 )// (1 + x)+ 2 * log (1 + x)],
@@ -270,8 +274,8 @@ problems = [
270
274
[1 // (sin (x)+ tan (x)), x, 6 , - 1 // 2 * atanh (cos (x))+ 1 // 2 * cot (x)* csc (x)- 1 // 2 * csc (x)^ 2 ],
271
275
[1 // (2 * sin (x)+ sin (2 * x)), x, 4 , 1 // 4 * log (tan (1 // 2 * x))+ 1 // 8 * tan (1 // 2 * x)^ 2 ],
272
276
[sec (x)// (1 + sin (x)), x, 4 , 1 // 2 * atanh (sin (x))+ (- 1 // 2 )// (1 + sin (x))],
273
- [1 // (b* cos (x)+ a* sin (x)), x, 2 , - atanh ((a* cos (x)- b* sin (x))// sqrt (a^ 2 + b^ 2 ))// sqrt (a^ 2 + b^ 2 ), SI . NotImplementedError ], # a, b
274
- [1 // (b^ 2 * cos (x)^ 2 + a^ 2 * sin (x)^ 2 ), x, 2 , atan (a* tan (x)// b)// (a* b), SI . NotImplementedError ], # a, b
277
+ [1 // (b* cos (x)+ a* sin (x)), x, 2 , - atanh ((a* cos (x)- b* sin (x))/ sqrt (a^ 2 + b^ 2 ))/ sqrt (a^ 2 + b^ 2 )],
278
+ [1 // (b^ 2 * cos (x)^ 2 + a^ 2 * sin (x)^ 2 ), x, 2 , atan (a* tan (x)/ b)/ (a* b)],
275
279
276
280
# Section 7.6 - Strategy for Integration
277
281
[x// (- 1 + x^ 2 ), x, 1 , 1 // 2 * log (1 - x^ 2 )],
@@ -347,12 +351,12 @@ problems = [
347
351
[log (1 // 2 * x), x, 1 , - x+ x* log (1 // 2 * x)],
348
352
[sqrt ((1 + x)// (1 - x)), x, 3 , 2 * atan (sqrt ((1 + x)// (1 - x)))- (1 - x)* sqrt ((1 + x)// (1 - x)), SI. NotImplementedError],
349
353
[x* log (x)// sqrt (- 1 + x^ 2 ), x, 5 , atan (sqrt (- 1 + x^ 2 ))- sqrt (- 1 + x^ 2 )+ log (x)* sqrt (- 1 + x^ 2 ), SI. NotImplementedError],
350
- [(a+ x)// (a^ 2 + x^ 2 ), x, 3 , atan (x// a)+ 1 // 2 * log (a^ 2 + x^ 2 ), SI . NotImplementedError ], # a
354
+ [(a+ x)// (a^ 2 + x^ 2 ), x, 3 , atan (x// a)+ 1 // 2 * log (a^ 2 + x^ 2 )],
351
355
[sqrt (1 + x- x^ 2 ), x, 3 , - 5 // 8 * asin ((1 - 2 * x)/ sqrt (5 ))- 1 // 4 * (1 - 2 * x)* sqrt (1 + x- x^ 2 ), SI. NotImplementedError],
352
356
[x^ 4 // (16 + x^ 10 ), x, 2 , 1 // 20 * atan (1 // 4 * x^ 5 )],
353
357
[(2 + x)// (2 + x+ x^ 2 ), x, 4 , 1 // 2 * log (2 + x+ x^ 2 )+ 3 * atan ((1 + 2 * x)/ sqrt (7 ))/ sqrt (7 )],
354
358
[x* sec (x)* tan (x), x, 2 , - atanh (sin (x))+ x* sec (x)],
355
- [x// (- a^ 4 + x^ 4 ), x, 2 , - 1 // 2 * atanh (x^ 2 // a^ 2 )// a^ 2 , SI . NotImplementedError ], # a
359
+ [x// (- a^ 4 + x^ 4 ), x, 2 , - 1 // 2 * atanh (x^ 2 // a^ 2 )// a^ 2 ],
356
360
[1 // (sqrt (x)+ sqrt (1 + x)), x, 3 , - 2 // 3 * x^ (3 // 2 )+ 2 // 3 * (1 + x)^ (3 // 2 ), SI. NotImplementedError],
357
361
[1 // (1 + (- 1 )// exp (x)+ 2 * exp (x)), x, 4 , 1 // 3 * log (1 - 2 * exp (x))- 1 // 3 * log (1 + exp (x))],
358
362
[atan (sqrt (x))// sqrt (x), x, 2 , - log (1 + x)+ 2 * atan (sqrt (x))* sqrt (x), SI. NotImplementedError],
@@ -401,9 +405,47 @@ problems = [
401
405
[x* sqrt (1 + 2 * x), x, 2 , - 1 // 6 * (1 + 2 * x)^ (3 // 2 )+ 1 // 10 * (1 + 2 * x)^ (5 // 2 ), SI. NotImplementedError],
402
406
[sin (x)^ 4 , x, 3 , 3 // 8 * x- 3 // 8 * cos (x)* sin (x)- 1 // 4 * cos (x)* sin (x)^ 3 ],
403
407
[tan (x)^ 3 , x, 2 , log (cos (x))+ 1 // 2 * tan (x)^ 2 ],
404
- [x^ 5 * sqrt (1 + x^ 2 ), x, 3 , 1 // 3 * (1 + x^ 2 )^ (3 // 2 )- 2 // 5 * (1 + x^ 2 )^ (5 // 2 )+ 1 // 7 * (1 + x^ 2 )^ (7 // 2 ), SI. NotImplementedError]
408
+ [x^ 5 * sqrt (1 + x^ 2 ), x, 3 , 1 // 3 * (1 + x^ 2 )^ (3 // 2 )- 2 // 5 * (1 + x^ 2 )^ (5 // 2 )+ 1 // 7 * (1 + x^ 2 )^ (7 // 2 ), SI. NotImplementedError],
409
+
410
+ #=
411
+ # David Jeffrey - Rectifying Transformations for Trig Integration (1997)
412
+ # Problem (1.2)
413
+ [3/(5-4*cos(x)), x, 2, x+2*atan(sin(x)/(2-cos(x)))],
414
+ # Problem (1.4)
415
+ [(1+cos(x)+2*sin(x))/(3+cos(x)^2+2*sin(x)-2*cos(x)*sin(x)), x, -43, -atan((2*cos(x)-sin(x))/(2+sin(x)))],
416
+ # Problem (1.5)
417
+ [(2+cos(x)+5*sin(x))/(4*cos(x)-2*sin(x)+cos(x)*sin(x)-2*sin(x)^2), x, -25, -log(1-3*cos(x)+sin(x))+log(3+cos(x)+sin(x))],
418
+ # Problem (3.3)
419
+ [(3+7*cos(x)+2*sin(x))/(1+4*cos(x)+3*cos(x)^2-5*sin(x)-cos(x)*sin(x)), x , -32, -log(1+cos(x)-2*sin(x))+log(3+cos(x)+sin(x))],
420
+ # Problem
421
+ [(-1+4*cos(x)+5*cos(x)^2)/(-1-4*cos(x)-3*cos(x)^2+4*cos(x)^3), x, -2, x-2*atan(sin(x)/(3+cos(x)))-2*atan((3*sin(x)+7*cos(x)*sin(x))/(1+2*cos(x)+5*cos(x)^2))],
422
+ # Problem
423
+ [(-5+2*cos(x)+7*cos(x)^2)/(-1+2*cos(x)-9*cos(x)^2+4*cos(x)^3), x, -2, x-2*atan(2*cos(x)*sin(x)/(1-cos(x)+2*cos(x)^2))],
424
+ # Problem (3.4)
425
+ [3/(5+4*sin(x)), x, 2, x+2*atan(cos(x)/(2+sin(x)))],
426
+ # Problem (3.6)
427
+ [2/(1+cos(x)^2), x, 3, x*sqrt(2)-atan(cos(x)*sin(x)/(1+cos(x)^2+sqrt(2)))*sqrt(2)],
428
+ # Problem (3.8)
429
+ [1/(p+q*cos(x)+r*sin(x)), x, 3, 2*atan((r+(p-q)*tan(1/2*x))/sqrt(p^2-q^2-r^2))/sqrt(p^2-q^2-r^2), SI.NotImplementedError],
430
+
431
+ # Waldek Hebisch - email May 2013
432
+
433
+ # Problem #1
434
+ [(1-x^3+x^4-x^5+x^6)*exp(x), x, 25, 871*exp(x)-870*exp(x)*x+435*exp(x)*x^2-145*exp(x)*x^3+36*exp(x)*x^4-7*exp(x)*x^5+exp(x)*x^6],
435
+ # Problem #2
436
+ #[(2-x^2)*exp(x/(2+x^2))/(2*x+x^3), x, -5,Ei(x/(2+x^2))],
437
+ #[(2+2*x+3*x^2-x^3+2*x^4)*exp(x/(2+x^2))/(2*x+x^3), x, -5, exp(x/(2+x^2))*(2+x^2)+Ei(x/(2+x^2))],
438
+ # Problem #3
439
+ #[(1+exp(x))*exp(x+exp(x))/(x+exp(x)), x, 2, Ei(exp(x)+x)],
440
+ # Problem #4
441
+ [(1-3*x-x^2+x^3)*exp(1/(-1+x^2))/(1-x-x^2+x^3), x, -6, exp(1/(-1+x^2))*(1+x)],
442
+ # Problem #5
443
+ [exp(1+1/log(x))*(-1+log(x)^2)/log(x)^2, x, 1, exp(1+1/log(x))*x],
444
+ [exp(x+1/log(x))*(-1+(1+x)*log(x)^2)/log(x)^2, x, -2, exp(x+1/log(x))*x]
445
+ =#
405
446
]
406
447
448
+
407
449
k = 0
408
450
expected_exceptions = 0
409
451
unexpected_exceptions = 0
0 commit comments