1 /******************************************************************************
2 rtest_integrate_special.mac
3 Integrals with special functions
4 ******************************************************************************/
9 (reset(domain), reset(radexpand), done);
12 /* Integrals for the Incomplete Gamma function */
14 integrate(gamma_incomplete(a,z),z);
15 z*gamma_incomplete(a,z)-gamma_incomplete(a+1,z);
17 integrate(z^(v-1)*gamma_incomplete(a,z),z);
18 'integrate(z^(v-1)*gamma_incomplete(a,z),z);
20 /* Correct noun form if first argument is an expression.
21 * See bug report Bug ID: 2968174 - Integration of hypergeometric bug */
22 integrate(gamma_incomplete(2*a,z^2)*z^2,z);
23 'integrate(gamma_incomplete(2*a,z^2)*z^2,z);
25 /* Integrals for Exponential Integral E(v,z) */
27 integrate(expintegral_e(v,a*z),z);
28 -expintegral_e(v+1,a*z)/a;
30 integrate(expintegral_e(v,z),z);
31 -expintegral_e(v+1,z);
33 integrate(z^(p-1)*expintegral_e(v,a*z),z);
34 'integrate(z^(p-1)*expintegral_e(v,a*z),z);
36 /* Integrals for Exponential Integral E1(z) */
38 integrate(expintegral_e1(a*z),z);
39 -expintegral_e(2,a*z)/a;
41 integrate(expintegral_e1(z),z);
44 integrate(z^(p-1)*expintegral_e1(a*z),z);
45 'integrate(z^(p-1)*expintegral_e1(a*z),z);
47 /* Integrals for Exponential Integral Ei(z) */
49 integrate(expintegral_ei(z),z);
50 z*expintegral_ei(z)-%e^z;
52 integrate(expintegral_ei(a*z),z);
53 (a*z*expintegral_ei(a*z)-%e^(a*z))/a;
55 integrate(expintegral_ei(a*z+b),z);
56 ((a*z+b)*expintegral_ei(a*z+b)-%e^(a*z+b))/a;
58 integrate(z^(p-1)*expintegral_ei(a*z),z);
59 'integrate(z^(p-1)*expintegral_ei(a*z),z);
61 integrate(z*expintegral_ei(a*z),z);
62 z^2*expintegral_ei(a*z)/2-(a*z-1)*%e^(a*z)/(2*a^2);
64 integrate(expintegral_ei(a*z)/z,z);
65 'integrate(expintegral_ei(a*z)/z,z);
67 integrate(expintegral_ei(a*z)/z^2,z);
68 gamma_incomplete(-1,-a*z)*a-expintegral_ei(a*z)/z;
70 integrate(expintegral_ei(a*z+b)/z^2,z);
71 'integrate(expintegral_ei(a*z+b)/z^2,z);
73 integrate(z^(p-1)*expintegral_ei(a*z^r),z);
74 'integrate(z^(p-1)*expintegral_ei(a*z^r),z);
76 integrate(z^n*%e^(b*z)*expintegral_ei(a*z),z);
77 'integrate(z^n*%e^(b*z)*expintegral_ei(a*z),z);
79 integrate(z*%e^(b*z)*expintegral_ei(a*z),z);
80 'integrate(z*%e^(b*z)*expintegral_ei(a*z),z);
82 integrate(z^2*%e^(b*z)*expintegral_ei(a*z),z);
83 'integrate(z^2*%e^(b*z)*expintegral_ei(a*z),z);
85 integrate(z^3*%e^(b*z)*expintegral_ei(a*z),z);
86 integrate(z^3*%e^(b*z)*expintegral_ei(a*z),z);
88 integrate(%e^(a*z)*expintegral_ei(a*z)/z,z);
89 1/2*expintegral_ei(a*z)^2;
91 /* More integrals after extending the integrator
92 do look for argument substitution of special functions */
94 integrate(expintegral_ei(x^2),x);
95 x*expintegral_ei(x^2)+sqrt(%pi)*%i*erf(%i*x);
97 integrate(expintegral_ei(x^3),x);
98 x*expintegral_ei(x^3)-gamma_incomplete(1/3,-x^3);
100 integrate(expintegral_ei(x^-2),x);
101 %i*gamma_incomplete(-1/2,-1/x^2)*x/abs(x)+expintegral_ei(1/x^2)*x;
103 integrate(expintegral_ei(x^(1/2)),x);
104 2*(expintegral_ei(sqrt(x))*x/2-(sqrt(x)-1)*%e^sqrt(x)/2);
106 integrate(expintegral_ei(x^(-1/2)),x);
107 2*(expintegral_ei(1/sqrt(x))*x/2+gamma_incomplete(-2,-1/sqrt(x))/2);
109 integrate(expintegral_ei(x^(-3/4)),x);
110 4*(expintegral_ei(1/x^(3/4))*x/4+gamma_incomplete(-4/3,-1/x^(3/4))/4);
112 integrate(expintegral_ei((x+1)^(1/2)),x);
113 2*((x+1)*expintegral_ei(sqrt(x+1))/2-(sqrt(x+1)-1)*%e^sqrt(x+1)/2);
115 /* Integrals for Exponential Integral Li(z) */
117 integrate(expintegral_li(a*z),z);
118 (a*z*expintegral_li(a*z)-expintegral_ei(2*log(a*z)))/a;
120 integrate(expintegral_li(z),z);
121 z*expintegral_li(z)-expintegral_ei(2*log(z));
123 integrate(z*expintegral_li(z),z);
124 z^2*expintegral_li(z)/2+gamma_incomplete(0,-3*log(z))/2;
126 integrate(sqrt(z)*expintegral_li(z),z),logexpand;
127 2*(z^(3/2)*expintegral_li(z)/3+gamma_incomplete(0,-5/2*log(z))/3);
129 /* Integrals for Exponential Integral Si(z) */
131 integrate(expintegral_si(z),z);
132 z*expintegral_si(z)+cos(z);
134 integrate(z*expintegral_si(z),z);
135 z^2*expintegral_si(z)/2 - (sin(z)-z*cos(z)) /2;
137 /* Integrals for Exponential Integral Ci(z) */
139 integrate(expintegral_ci(z),z);
140 z*expintegral_ci(z)-sin(z);
142 integrate(z*expintegral_ci(z),z);
143 z^2*expintegral_ci(z)/2 - (z*sin(z)+cos(z)) /2;
145 /* Integrals for Exponential Integral Shi(z) */
147 integrate(expintegral_shi(z),z);
148 z*expintegral_shi(z)-cosh(z);
150 integrate(z*expintegral_shi(z),z);
151 z^2*expintegral_shi(z)/2 - ((z-1)*%e^z-(-z-1)*%e^(-z))/4;
153 /* Integrals for Exponential Integral Chi(z) */
155 integrate(expintegral_chi(z),z);
156 z*expintegral_chi(z)-sinh(z);
158 integrate(z*expintegral_chi(z),z);
159 z^2*expintegral_chi(z)/2 - ((z-1)*%e^z+(-z-1)*%e^(-z))/4;
161 /* Integrals of Lambert W function. This checks that other parts
162 of the integration routines work with the 'integral property */
164 /* This is tested in rtest_lambert_w.mac */
165 /* integrate(lambert_w(x),x);
166 x*(lambert_w(x)^2-lambert_w(x)+1)/lambert_w(x); */
168 integrate(lambert_w(a*x+b),x);
169 (a*x+b)*(lambert_w(a*x+b)^2-lambert_w(a*x+b)+1)/(a*lambert_w(a*x+b));
171 integrate(sin(x)*lambert_w(cos(x)),x);
172 -(cos(x)*(lambert_w(cos(x))^2-lambert_w(cos(x))+1)/lambert_w(cos(x)));
174 integrate(diff(f(x),x)*lambert_w(f(x)),x);
175 f(x)*(lambert_w(f(x))^2-lambert_w(f(x))+1)/lambert_w(f(x));
177 /* Integrals where the property is a function */
178 integrate(bessel_j(0,x),x);
179 x*(bessel_j(0,x)*(2-%pi*struve_h(1,x))+%pi*bessel_j(1,x)*struve_h(0,x))/2;
181 integrate(bessel_j(1,x),x);
184 integrate(bessel_j(2,x),x);
185 x^3/24*hypergeometric([3/2],[5/2,3],-x^2/4);
187 integrate(bessel_j(n,x),n);
188 'integrate(bessel_j(n,x),n);
190 /* Examples of a subscripted function */
191 integrate(psi[0](x),x);
194 integrate(psi[1](x),x);