File: intindm

package info (click to toggle)
giac 1.9.0.93%2Bdfsg2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 117,732 kB
  • sloc: cpp: 404,272; ansic: 205,462; python: 30,548; javascript: 28,788; makefile: 17,997; yacc: 2,690; lex: 2,464; sh: 705; perl: 314; lisp: 216; asm: 62; java: 41; xml: 36; sed: 16; csh: 7; pascal: 6
file content (198 lines) | stat: -rw-r--r-- 9,311 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
// Giac integration test file: "0 Independent test suites\Apostol Problems.txt"
// "nock" means we do not check the antiderivative
I:=i;
lst:=[

// Joel Moses - Symbolic Integration Ph.D. Thesis (1967)

// Chapter 2 - How SIN differs from SAINT
[cot(x)^4,x,3,x+cot(x)-1/3*cot(x)^3],
[1/(x^4*(1+x^2)),x,3,(-1/3)/x^3+1/x+arctan(x)],
[(x+x^2)/sqrt(x),x,2,2/3*x^(3/2)+2/5*x^(5/2)],
[cos(x),x,1,sin(x)],
[exp(x^2)*x,x,1,1/2*exp(x^2)],
[sec(x)^2*tan(x),x,2,1/2*sec(x)^2],
[x*sqrt(1+x^2),x,1,1/3*(1+x^2)^(3/2)],
[exp(x)*sin(x),x,1,-1/2*exp(x)*cos(x)+1/2*exp(x)*sin(x)],

// Chapter 3 - SCHATCHEN - A Matching Program for Algebraic Expressions
[cos(x)*csc(x)^2/sin(x)^2,x,2,-1/3*csc(x)^3],

// Chapter 4 - The First Stage of Sin
[sin(exp(x)),x,2,Si(exp(x))],
[sin(y)/y,y,1,Si(y)],
[exp(x)+sin(x),x,3,exp(x)-cos(x)],
[exp(x^2)+2*exp(x^2)*x^2,x,4,exp(x^2)*x],
[(exp(x)+x)^2,x,5,-2*exp(x)+1/2*exp(2*x)+2*exp(x)*x+1/3*x^3],
[2*exp(x)+exp(2*x)+x^2,x,3,2*exp(x)+1/2*exp(2*x)+1/3*x^3],
[cos(x)*sin(x),x,2,1/2*sin(x)^2],
[exp(x^2)*x,x,1,1/2*exp(x^2)],
[x*sqrt(1+x^2),x,1,1/3*(1+x^2)^(3/2)],
[exp(x)/(1+exp(x)),x,2,log(1+exp(x))],
[x^(3/2),x,1,2/5*x^(5/2)],
[cos(3+2*x),x,1,1/2*sin(3+2*x)],
[2*exp(2*x)*y*z,x,2,exp(2*x)*y*z],
[exp(x)*cos(exp(x))^2*sin(exp(x)),x,3,-1/3*cos(exp(x))^3],

// Chapter 4 - The Second Stage of Sin
[x*sqrt(1+x),x,2,-2/3*(1+x)^(3/2)+2/5*(1+x)^(5/2)],
[1/(-1+x^4),x,3,-1/2*arctan(x)-1/2*arctanh(x)],

// Method 1)  Elementary function of exponentials
[exp(x)/(2+3*exp(2*x)),x,2,arctan(exp(x)*sqrt(3/2))/sqrt(6)],
[exp(2*x)/(A+B*exp(4*x)),x,2,1/2*arctan(exp(2*x)*sqrt(B)/sqrt(A))/(sqrt(A)*sqrt(B))],
[exp(1+x)/(1+exp(x)),x,3,E*log(1+exp(x))],
[(10*E)^x,x,1,(10*E)^x/(1+log(10))],

// Method 2)  Substitution for an integral power
[x^3*sin(x^2),x,3,-1/2*x^2*cos(x^2)+1/2*sin(x^2)],
[x^7/(1+x^12),x,7,-1/12*log(1+x^4)+1/24*log(1-x^4+x^8)-1/4*arctan((1-2*x^4)/sqrt(3))/sqrt(3)],
[x^(3*a)*sin(x^(2*a)),x,3,1/4*I*x^(1+3*a)*GAMMA(1/2*(3+1/a),-I*x^(2*a))/(a*(-I*x^(2*a))^(1/2*(1+3*a)/a))-1/4*I*x^(1+3*a)*GAMMA(1/2*(3+1/a),I*x^(2*a))/(a*(I*x^(2*a))^(1/2*(1+3*a)/a))],

// Method 3)  Substitution for a rational root of a linear function of x
[cos(sqrt(x)),x,3,2*cos(sqrt(x))+2*sin(sqrt(x))*sqrt(x)],
[x*sqrt(1+x),x,2,-2/3*(1+x)^(3/2)+2/5*(1+x)^(5/2)],
[1/(x^(1/3)+x^(1/2)),x,4,6*x^(1/6)-3*x^(1/3)-6*log(1+x^(1/6))+2*sqrt(x)],
[sqrt((1+x)/(3+2*x)),x,4,-1/2*arcsinh(sqrt(2)*sqrt(1+x))/sqrt(2)+1/2*sqrt(1+x)*sqrt(3+2*x)],

// Method 4)  Binomial - Chebyschev
[x^4/(1-x^2)^(5/2),x,3,1/3*x^3/(1-x^2)^(3/2)+arcsin(x)-x/sqrt(1-x^2)],
[x^(1/2)*(1+x)^(5/2),x,6,5/24*x^(3/2)*(1+x)^(3/2)+1/4*x^(3/2)*(1+x)^(5/2)-5/64*arcsinh(sqrt(x))+5/32*x^(3/2)*sqrt(1+x)+5/64*sqrt(x)*sqrt(1+x)],

// Method 5)  Arctrigonometric substitutions
[x^4/(1-x^2)^(5/2),x,3,1/3*x^3/(1-x^2)^(3/2)+arcsin(x)-x/sqrt(1-x^2)],
[sqrt(A^2+B^2-B^2*y^2)/(1-y^2),y,5,B*arctan(B*y/sqrt(A^2+B^2-B^2*y^2))+A*arctanh(A*y/sqrt(A^2+B^2-B^2*y^2))],

// Method 6)  Elementary function of trigonometric functions
[sin(x)^2,x,2,1/2*x-1/2*cos(x)*sin(x)],
[sqrt(A^2+B^2*sin(x)^2)/sin(x),x,6,-B*arctan(B*cos(x)/sqrt(A^2+B^2*sin(x)^2))-A*arctanh(A*cos(x)/sqrt(A^2+B^2*sin(x)^2)),-B*arctan(B*cos(x)/sqrt(A^2+B^2-B^2*cos(x)^2))-A*arctanh(A*cos(x)/sqrt(A^2+B^2-B^2*cos(x)^2))],
[1/(1+cos(x)),x,1,sin(x)/(1+cos(x))],

// Method 7)  Rational function times an exponential
[exp(x)*x,x,2,-exp(x)+exp(x)*x],
[exp(x)*x/(1+x)^2,x,1,exp(x)/(1+x)],
[exp(x^2)*(1+2*x^2),x,5,exp(x^2)*x],
[exp(x^2),x,1,1/2*erfi(x)*sqrt(Pi)],
[exp(x)/x,x,1,Ei(x)],

// Method 8)  Rational functions
[x/(1+x^3),x,6,-1/3*log(1+x)+1/6*log(1-x+x^2)-arctan((1-2*x)/sqrt(3))/sqrt(3)],
[1/(-1+x^6),x,10,-1/3*arctanh(x)-1/6*arctanh(x/(1+x^2))-1/2*arctan(x*sqrt(3)/(1-x^2))/sqrt(3),-1/3*arctanh(x)+1/12*log(1-x+x^2)-1/12*log(1+x+x^2)+1/2*arctan((1-2*x)/sqrt(3))/sqrt(3)-1/2*arctan((1+2*x)/sqrt(3))/sqrt(3)],
[1/(A^4-A^2*B^2+(-A^2+B^2)*x^2),x,1,arctanh(x/A)/(A*(A^2-B^2))],

// Method 9)  Rational function times a log or arctrigonometric function
[x*log(x),x,1,-1/4*x^2+1/2*x^2*log(x)],
[x^2*arcsin(x),x,4,-1/9*(1-x^2)^(3/2)+1/3*x^3*arcsin(x)+1/3*sqrt(1-x^2)],
[1/(1+2*x+x^2),x,2,(-1)/(1+x)],

// Method 10)  Rational function times an elementary function of log(a+b x)
[log(x)/(1+log(x))^2,x,7,x/(1+log(x))],
[1/(x*(1+log(x)^2)),x,2,arctan(log(x))],
[1/log(x),x,1,Li(x)],

// Method 11)  Expansion of the integrand
[x*(cos(x)+sin(x)),x,6,cos(x)-x*cos(x)+sin(x)+x*sin(x)],
[(exp(x)+x)/exp(x),x,4,(-1)/exp(x)+x-x/exp(x)],
[(1+exp(x))^2*x,x,6,-2*exp(x)-1/4*exp(2*x)+2*exp(x)*x+1/2*exp(2*x)*x+1/2*x^2],

// Chapter 4 - The Third Stage of Sin
[x*cos(x),x,2,cos(x)+x*sin(x)],
[cos(sqrt(x)),x,3,2*cos(sqrt(x))+2*sin(sqrt(x))*sqrt(x)],

// The Integration-by-Parts Methods
[x*cos(x),x,2,cos(x)+x*sin(x)],
[x*log(x)^2,x,2,1/4*x^2-1/2*x^2*log(x)+1/2*x^2*log(x)^2],

// The Derivative-divides Method
[cos(x)*(1+sin(x)^3),x,2,sin(x)+1/4*sin(x)^4],
[1/(x*(1+log(x)^2)),x,2,arctan(log(x))],
[1/((1+arcsin(x)^2)*sqrt(1-x^2)),x,2,arctan(arcsin(x))],
[sin(x)/(cos(x)+sin(x)),x,2,1/2*x-1/2*log(cos(x)+sin(x))],

// An Example of SIN's Performance
[-sqrt(A^2+B^2*(1-y^2))/(1-y^2),y,6,-B*arctan(B*y/sqrt(A^2+B^2-B^2*y^2))-A*arctanh(A*y/sqrt(A^2+B^2-B^2*y^2))],
[(-A^2-B^2)*cos(z)^2/(B*(1-(A^2+B^2)*sin(z)^2/B^2)),z,5,-B*z-A*arctanh(A*tan(z)/B)],
[(-A^2-B^2)/(B*(1+w^2)^2*(1-(A^2+B^2)*w^2/(B^2*(1+w^2)))),w,6,-B*arctan(w)-A*arctanh(A*w/B)],
[-B*(A^2+B^2)/((1+w^2)*(B^2-A^2*w^2)),w,4,-B*arctan(w)-A*arctanh(A*w/B)],

// SAINT and SIN solutions of the same problem
[x^4/(1-x^2)^(5/2),x,3,1/3*x^3/(1-x^2)^(3/2)+arcsin(x)-x/sqrt(1-x^2)],
[sin(y)^4/cos(y)^4,y,3,y-tan(y)+1/3*tan(y)^3],
[z^4/(1+z^2),z,3,-z+1/3*z^3+arctan(z)],

// Chapter 5 - The Edge Heuristic
[exp(x^2)*(1+2*x^2),x,5,exp(x^2)*x],
[exp(x^2)*(1+4*x^2+x^3+5*x^4+2*x^6)/(1+x^2)^2,x,10,exp(x^2)*x+1/2*exp(x^2)/(1+x^2)],
[exp(-1-x),x,1,-exp(-1-x)],
[(1/x+x)*log(x),x,5,-1/4*x^2+1/2*x^2*log(x)+1/2*log(x)^2],
[x/(1+x^4),x,2,1/2*arctan(x^2)],
[x^5/(1+x^4),x,3,1/2*x^2-1/2*arctan(x^2)],
[1/(1+tan(x)^2),x,3,1/2*x+1/2*cos(x)*sin(x)],
[x^4/(1-x^2)^(5/2),x,3,1/3*x^3/(1-x^2)^(3/2)+arcsin(x)-x/sqrt(1-x^2)],
[-x^2/(1-x^2)^(3/2),x,2,arcsin(x)-x/sqrt(1-x^2)],
[exp(x)*sin(x),x,1,-1/2*exp(x)*cos(x)+1/2*exp(x)*sin(x)],

// Appendix C - Slagle's Thesis Integration Problems
[1/x,x,1,log(x)],
[sec(2*t)/(1+sec(t)^2+3*tan(t)),t,4,-1/12*log(cos(t)-sin(t))-1/4*log(cos(t)+sin(t))+1/3*log(2*cos(t)+sin(t))+(-1/2)/(1+tan(t))],
[1/sec(x)^2,x,2,1/2*x+1/2*cos(x)*sin(x)],
[(1+x^2)/sqrt(x),x,2,2/5*x^(5/2)+2*sqrt(x)],
[x/sqrt(5+2*x+x^2),x,3,-arcsinh(1/2*(1+x))+sqrt(5+2*x+x^2)],
[cos(x)*sin(x)^2,x,2,1/3*sin(x)^3],
[exp(x)/(1+exp(x)),x,2,log(1+exp(x))],
[exp(2*x)/(1+exp(x)),x,3,exp(x)-log(1+exp(x))],
[1/(1-cos(x)),x,1,-sin(x)/(1-cos(x))],
[sec(x)^2*tan(x),x,2,1/2*sec(x)^2],
[x*log(x),x,1,-1/4*x^2+1/2*x^2*log(x)],
[cos(x)*sin(x),x,2,1/2*sin(x)^2],
[(1+x)/sqrt(2*x-x^2),x,3,-2*arcsin(1-x)-sqrt(2*x-x^2)],
[2*exp(x)/(2+3*exp(2*x)),x,3,arctan(exp(x)*sqrt(3/2))*sqrt(2/3)],
[x^4/(1-x^2)^(5/2),x,3,1/3*x^3/(1-x^2)^(3/2)+arcsin(x)-x/sqrt(1-x^2)],
[exp(6*x)/(1+exp(4*x)),x,3,1/2*exp(2*x)-1/2*arctan(exp(2*x))],
[log(2+3*x^2),x,3,-2*x+x*log(2+3*x^2)+2*arctan(x*sqrt(3/2))*sqrt(2/3)],

// Appendix D - MacIntosh Integration Problems
[1/(r*sqrt(-a^2+2*H*r^2)),x,1,x/(r*sqrt(-a^2+2*H*r^2))],
[1/(r*sqrt(-a^2-e^2+2*H*r^2)),x,1,x/(r*sqrt(-a^2-e^2+2*H*r^2))],
[1/(r*sqrt(-a^2+2*H*r^2-2*K*r^4)),x,1,x/(r*sqrt(-a^2+2*H*r^2-2*K*r^4))],
[1/(r*sqrt(-a^2-e^2+2*H*r^2-2*K*r^4)),x,1,x/(r*sqrt(-a^2-e^2+2*H*r^2-2*K*r^4))],
[1/(r*sqrt(-a^2-2*K*r+2*H*r^2)),x,1,x/(r*sqrt(-a^2-2*r*(K-H*r)))],
[1/(r*sqrt(-a^2-e^2-2*K*r+2*H*r^2)),x,1,x/(r*sqrt(-a^2-e^2-2*K*r+2*H*r^2))],
[r/sqrt(-a^2+2*E*r^2),x,1,r*x/sqrt(-a^2+2*E*r^2)],
[r/sqrt(-a^2-e^2+2*E*r^2),x,1,r*x/sqrt(-a^2-e^2+2*E*r^2)],
[r/sqrt(-a^2+2*E*r^2-2*K*r^4),x,1,r*x/sqrt(-a^2+2*E*r^2-2*K*r^4)],
[r/sqrt(-a^2-e^2+2*E*r^2-2*K*r^4),x,1,r*x/sqrt(-a^2-e^2+2*E*r^2-2*K*r^4)],
[r/sqrt(-a^2-e^2-2*K*r+2*H*r^2),x,1,r*x/sqrt(-a^2-e^2-2*K*r+2*H*r^2)]
];

res:=[]:;
S:=182; S:=size(lst);
failint:=[]; failsimp:=[]; nock:=[]; ass:=[];
print("Integration independent test suites, Moses "+S);
file:=fopen("intindm.tst");
T0:=time();
for j from 0 to S-1 do
  l:=eval(lst,1)[j]; 
  f:=l[0]; v:=l[1]; hyp:=l[2]; print(f);
  purge(unquote(v));
  if (type(hyp)==string) expr(hyp); // eval assumption
  print(j+1,f,v,hyp,about(unquote(v)));
  try { g:=integrate(f,unquote(v)); } catch(err){ g:="integrate(err)"; }
  s:=""+eval(g,1);
  h:=false;
  fail:=size(s.find("integrate("))>0 || hyp==x;
  if (fail) failint.append(j+1);
  if (hyp=="nock") nock.append(j+1);
  if (hyp.type==string && size(hyp.find("assume("))>0) ass.append(j+1);
  if (hyp!="nock" && !fail)  h:=simplify(diff(g,unquote(v))-f); else print("nock");
  purge(unquote(assumptions));
  fgh:=""+eval([j+1,f,g,h],1);
  if (eval(h,1)!=0) failsimp.append(j+1);
  print(fgh);
  //res.append([f,g,h]); print(res[size(res)-1]);
  fprint(file,"",fgh);
od:;
fprint(file,"","Time:",time()-T0,", tests: ",S,", integration failures: ",size(failint),failint,", simplification failures: ",size(failsimp),failsimp,", not cheked: ",size(nock),nock,", assumptions: ",size(ass),ass);
fclose(file);
print("Integration independent test suites, Moses ","tests: ",S,", integration failures: ",size(failint),failint,", simplification failures: ",size(failsimp),failsimp,", not cheked: ",size(nock),nock,", assumptions: ",size(ass),ass);
//res;