2 jn(3,4); /*0.1320341839226408 ;*/
4 j0(1); /*0.7651976865579665 ;*/
8 /* BESSEL is gone. This makes sure it's gone. */
23 diff(bessel_j(0,x),x);
25 diff(bessel_j(1,x),x);
26 (bessel_j(0,x)-bessel_j(2,x))/2;
27 diff(bessel_y(0,x),x);
29 diff(bessel_y(1,x),x);
30 (bessel_y(0,x)-bessel_y(2,x))/2;
31 diff(bessel_i(0,x),x);
33 diff(bessel_i(1,x),x);
34 (bessel_i(2,x)+bessel_i(0,x))/2;
35 diff(bessel_k(0,x),x);
37 diff(bessel_k(1,x),x);
38 -((bessel_k(2,x)+bessel_k(0,x))/2);
44 sqrt(2/%pi)*sin(x)/sqrt(x);
46 sqrt(2/%pi)*cos(x)/sqrt(x);
49 (sqrt(2)*sqrt(x)*(sin(x)/x^2-cos(x)/x))/sqrt(%pi);
52 (sqrt(2)*sqrt(x)*((3/x^3-1/x)*sin(x)-(3*cos(x))/x^2))/sqrt(%pi)$
54 ratsimp(bessel_j(-3/2,x) - (2*(-1/2)/x*bessel_j(-1/2,x)-bessel_j(1/2,x)));
57 ratsimp(bessel_j(-5/2,x) - (2*(-3/2)/x*bessel_j(-3/2,x)-bessel_j(-1/2,x)));
60 ratsimp(bessel_y(1/2,x) + sqrt(2/%pi)*cos(x)/sqrt(x));
63 ratsimp(bessel_y(-1/2,x) - sqrt(2/%pi)*sin(x)/sqrt(x));
66 ratsimp(bessel_y(3/2,x) - (2*(1/2)/x*bessel_y(1/2,x)-bessel_y(-1/2,x)));
69 ratsimp(bessel_y(5/2,x) - (2*(3/2)/x*bessel_y(3/2,x)-bessel_y(1/2,x)));
72 ratsimp(bessel_y(-3/2,x) - (2*(-1/2)/x*bessel_y(-1/2,x)-bessel_y(1/2,x)));
75 ratsimp(bessel_y(-5/2,x) - (2*(-3/2)/x*bessel_y(-3/2,x)-bessel_y(-1/2,x)));
79 sqrt(2*x/%pi)*sinh(x)/x;
82 sqrt(2*x/%pi)*cosh(x)/x;
84 ratsimp(bessel_i(3/2,x) - (-2*(1/2)/x*bessel_i(1/2,x)+bessel_i(-1/2,x)));
87 ratsimp(bessel_i(5/2,x) -(-2*(3/2)/x*bessel_i(3/2,x)+bessel_i(1/2,x)));
90 ratsimp(bessel_i(-3/2,x) -(2*(-1/2)/x*bessel_i(-1/2,x)+bessel_i(1/2,x)));
93 ratsimp(bessel_i(-5/2,x) - (2*(-3/2)/x*bessel_i(-3/2,x)+bessel_i(-1/2,x)));
96 ratsimp(bessel_k(1/2,x) - sqrt(%pi/2)*%e^(-x)/sqrt(x));
99 ratsimp(bessel_k(-1/2,x)- sqrt(%pi/2)*%e^(-x)/sqrt(x));
102 ratsimp(bessel_k(3/2,x) - (2*(1/2)/x*bessel_k(1/2,x)+bessel_k(-1/2,x)));
105 ratsimp(bessel_k(5/2,x) -(2*(3/2)/x*bessel_k(3/2,x)+bessel_k(1/2,x)));
108 ratsimp(bessel_k(-3/2,x) -(-2*(-1/2)/x*bessel_k(-1/2,x)+bessel_k(1/2,x)));
111 ratsimp(bessel_k(-5/2,x) -(-2*(-3/2)/x*bessel_k(-3/2,x)+bessel_k(-1/2,x)));
116 (assume(4*p+a>0),true);
121 specint(t^(1/2)*%e^(-a*t/4)*%e^(-p*t),t);
122 sqrt(%pi)/(2*(p+a/4)^(3/2));
124 prefer_whittaker:true;
128 * Reference: Table of Integral Transforms.
134 * t^(v-1)*exp(-t^2/(8*a))
135 * -> gamma(v)*2^v*a^(v/2)*exp(a*p^2)*D[-v](2*p*sqrt(a))
137 * We have v = 7/4, a = b/4 so the result should be
139 * gamma(7/4)*2^(7/4)*(b/4)^(7/8)*exp(b*p^2/4)*D[-7/4](p*sqrt(b))
140 * = 3/4*gamma(3/4)*b^(7/8)*exp(b*p^2/4)*D[-7/4](p*sqrt(b))
144 * D[v](z) = 2^(v/2+1/4)*z^(-1/2)*%w[v/2+1/4,1/4](z^2/2)
148 * %w[k,u](z) = gamma(-2*u)/gamma(1/2-u-k)*%m[k,u](z)
149 * + gamma(2*u)/gamma(1/2+u-k)*%m[k,-u](z)
153 * D[-7/4](p*sqrt(b)) = %w[-5/8,1/4](b*p^2/2)/(2^(5/8)*b^(1/4)*sqrt(p))
157 * %w[-5/8,1/4](b*p^2)
158 * = 8/3/gamma(3/8)*%m[-5/8,-1/4](b*p^2/2)
159 * - 2*sqrt(%pi)/gamma(7/8)*%m[-5/8,1/4](b*p^2/2)
161 * And finally the transform is
163 * 3*gamma(3/4)*b^(5/8)*exp(b*p^2/4)/(4*2^(5/8)*sqrt(p))
164 * *(8*sqrt(%pi)/3/gamma(3/8)*%m[-5/8,-1/4](b*p^2/2)
165 * - 2*sqrt(%pi)/gamma(7/8)*%m[-5/8,1/4](b*p^2/2))
170 specint(t^(3/4)*%e^(-t^2/2/b)*%e^(-p*t),t);
174 *(3*gamma(3/8)*gamma(3/4)*%e^(b*p^2/4)*%m[-5/8,1/4](b*p^2/2)
175 -4*gamma(3/4)*gamma(7/8)*%e^(b*p^2/4)
176 *%m[-5/8,-1/4](b*p^2/2))
177 /(2*2^(5/8)*gamma(3/8)*gamma(7/8)*sqrt(p))$
182 *(2^(19/8)*sqrt(%pi)*%m[-5/8,-1/4](b*p^2/2)/(3*gamma(3/8)*b^(1/4)*sqrt(p))
183 -2^(3/8)*sqrt(%pi)*%m[-5/8,1/4](b*p^2/2)/(gamma(7/8)*b^(1/4)*sqrt(p)))
187 * Sec. 4.5, formula (33):
189 * t^(-1/2)*exp(-2*sqrt(a)*sqrt(t)) ->
190 * sqrt(%pi)/sqrt(p)*exp(a/p)*erfc(sqrt(a)/sqrt(p))
192 ratsimp(specint(t^(-1/2)*%e^(-2*a^(1/2)*t^(1/2))*%e^(-p*t),t));
193 -sqrt(%pi)*(erf(sqrt(a)/sqrt(p))-1)*%e^(a/p)/sqrt(p)$
196 * The Laplace transform of sin(a*t)*cosh(b*t^2) can be derived by
197 * expressing sin and cosh in terms of exponential functions. We end
198 * up with terms of the form:
200 * exp(+/-%i*a*t)*exp(+/-b*t^2)
202 * All of these can be computed using formula 24, p. 146 of Tables of
203 * Integral Transforms, which handle functions of the form
204 * t^(v-1)*exp(-t^2/8/a).
206 * But, we have terms of the form exp(b*t^2-p*t+%i*a*t). I don't
207 * think this converges, so the Laplace transform doesn't exist if b >
212 radcan(specint(sin(a*t)*cosh(b*t^2)*%e^(-p*t),t));
213 -%e^-((p^2+2*%i*a*p+a^2)/(4*b))*(sqrt(%pi)*%e^((2*%i*a*p+a^2)/(2*b))*erf((%i
214 *p+a)/(2*sqrt(b)))-sqrt(%pi)*%e^(a^2/(2*b))*erf((%i*p-a)/(2*sqrt(b)))+sqrt
215 (%pi)*%i*%e^((p^2+2*%i*a*p)/(2*b))*erf((p+%i*a)/(2*sqrt(b)))-sqrt(%pi)*%i*%e
216 ^(p^2/(2*b))*erf((p-%i*a)/(2*sqrt(b)))+(sqrt(%pi)*%i-sqrt(%pi)*%i*%e^(%i*a
217 *p/b))*%e^(p^2/(2*b))-sqrt(%pi)*%e^((2*%i*a*p+a^2)/(2*b))+sqrt(%pi)*%e^(a^2/
218 (2*b)))/(8*sqrt(b)) $
222 * Sec 4.14, formula (27):
224 * t^(1/2)*bessel_j(1,2*a^(1/2)*t^(1/2)) ->
225 * sqrt(a)/p^2*exp(-a/p)
228 specint(t^(1/2)*bessel_j(1,2*a^(1/2)*t^(1/2))*%e^(-p*t),t);
229 sqrt(a)*%e^-(a/p)/p^2$
232 * Sec 4.14, formula (3):
234 * t^2*bessel_j(v,a*t) ->
235 * ((v^2-1)/r^3 + 3*p*(p+v*r)/r^5)*(a/R)^v
237 * where r = sqrt(p^2+a^2), R = p + r;
239 * (Maxima can't currently compute this transform for general v due to a bug
241 * This bug is no longer present after correction of legf24 in hyp.lisp.
243 factor(ratsimp(specint(t^2*bessel_j(1,a*t)*%e^(-p*t),t)));
244 3*a*p/(p^2+a^2)^(5/2) $
246 (/* This is the Laplace transform of the Struve H function, see
247 http://dlmf.nist.gov/Draft/ST/about_ST.8.13.html */
248 2/(%pi*p)-2*p*log(p/(sqrt(p^2+1)-1))/(%pi*sqrt(p^2+1)),
249 /* And this should be the same as the specint of the next test below */
251 ev(fullratsimp(%%),logexpand:all));
252 -((sqrt(p^2+1)*(2*p^2*log(sqrt(p^2+1)-1)-2*p^2*log(p))-2*p^2-2) /(%pi*p^6+2*%pi*p^4+%pi*p^2))$
254 (ev(fullratsimp(specint(t*struve_h(1,t)*%e^(-p*t),t)),logexpand:all),
260 * From the comments for hstf in hypgeo.lisp:
262 * struve_h(1,t) = 2/sqrt(%pi)*(t/2)^2/gamma(1+3/2)*%f[1,2]([1],[3/2,5/2],-t^2/4)
266 * struve_h(1,sqrt(t)) = 2/(3*%pi)*t*%f[1,2]([1],[3/2,5/2],-t/4)
268 * and the integrand is
270 * 2/(3*%pi)*t^(5/2)*exp(-p*t)*%f[1,2]([1],[3/2,5/2],-t/4).
272 * From the f19p220, the Laplace transform of this, with s = 7/2,
275 * 2/(3*%pi)*gamma(7/2)/p^(7/2)*%f[2,2]([1,7/2],[3/2,5/2],-1/4/p)
277 * From the derivation of SPLITPFQ, we can simplify this
278 * hypergeometric function.
280 * %f[2,2]([1,7/2],[3/2,5/2],z) =
283 * sum z^k/poch(5/2,k)*binomial(1,k) *diff(%f[2,2]([1,5/2],[3/2,5/2],z,k)
286 * But %f[2,2]([1,5/2],[3/2,5/2],z) = %f[1,1]([1],[3/2],z)
287 * and Maxima knows how to compute this.
289 ratsimp(specint(t^(3/2)*struve_h(1,t^(1/2))*%e^(-p*t),t));
290 -%e^-(1/(4*p))*(sqrt(%pi)*sqrt(p)
291 *(8*%i*erf(%i/(2*sqrt(p)))*p
292 -%i*erf(%i/(2*sqrt(p))))
294 /(8*sqrt(%pi)*p^(9/2)) $
296 /* Trivial result because %ibes is not bessel_i
297 After specializing the pattern match of arbpow1 we get a more
298 correct noun form. The result is adjusted. DK.
300 specint(t*%ibes[0](a*t/2)*%ibes[1](a*t/2)*%e^(-p*t),t);
301 /* %ibes[0](a*t/2)*%ibes[1](a*t/2)/p^2 $ */
302 specint(t*%ibes[0](a*t/2)*%ibes[1](a*t/2)*%e^(-p*t),t);
305 * t^(3/4)*bessel_j(1/2,t)*bessel_j(1/4,t)
309 * bessel_j(u,t)*bessel_j(v,t)
310 * = (z/2)^(u+v)/gamma(u+1)/gamma(v+1)
311 * * %f[2,3]([(u+v+1)/2,(u+v+2)/2],[u+1,v+1,u+v+1],-z^2)
313 * So the integrand is
315 * 8/2^(3/4)/sqrt(%pi)/gamma(1/4)*t^(3/2)*%f[2,3]([7/8,11/8],[3/2,5/4,7/4],-t^2)
319 * t^(3/2)*%f[2,3]([7/8,11/8],[3/2,5/4,7/4],-t^2)
321 * -> gamma(5/2)*p^(-5/2)
322 * *%f[4,3]([7/8,11/8,5/2/2,(5/2+1)/2],[3/2,5/4,7/4],-4/p^2)
323 * = gamma(5/2)*p^(-5/2)
324 * $%f[2,1]([7/8,11/8],[3/2],-4/p^2)
326 * And we know %f[2,1]([7/8,11/8],[3/2],z) is
328 * -2*(1/(sqrt(z)+1)^(3/4)-1/(1-sqrt(z))^(3/4))/(3*sqrt(z))
330 * Applying all of this gives the expected answer below.
333 specint(t^(3/4)*bessel_j(1/2,t)*bessel_j(1/4,t)*%e^(-p*t),t);
334 (2^(1/4)*%i*(1/((2*%i)/p+1)^(3/4)-1/(1-(2*%i)/p)^(3/4)))/(gamma(1/4)*p^(3/2))$
337 * Not sure this is right. We can convert bessel_y to bessel_j,
338 * multiply them together and use the results for products of bessel_j
341 * bessel_y(1/2,sqrt(t)) = -bessel_j(-1/2,sqrt(t))
343 * And maxima should be able to compute the transform of
345 * t^(5/2)*bessel_j(-1/2,sqrt(t))^2
347 * Or note that bessel_y(1/2,sqrt(t)) =
348 * -sqrt(2/%pi)*cos(sqrt(t))/t^(1/4). Then the integrand becomes
350 * 2/%pi*t^2*cos(sqrt(t))^2
352 * And maxima should know how to compute the transform of this.
354 * Unfortunately, the transforms of these two approaches don't agree.
356 * After revision 1.65 of hypgeo.lisp it works as expected.
358 result:factor(ratsimp(specint(t^(5/2)*bessel_y(1/2,t^(1/2))^2*%e^(-p*t),t)));
359 %e^-(1/p)*(16*p^3*%e^(1/p)-18*p^2*%e^(1/p)+4*p*%e^(1/p)
360 +15*sqrt(%pi)*%i*erf(%i/sqrt(p))*p^(5/2)
361 -20*sqrt(%pi)*%i*erf(%i/sqrt(p))*p^(3/2)
362 +4*sqrt(%pi)*%i*erf(%i/sqrt(p))*sqrt(p))
365 /* This is equal to the Laplace transform of 2/%pi*t^2*cos(sqt(t))^2 */
366 expand(result-specint(t^(5/2)*bessel_y(1/2,t^(1/2))^2*%e^(-p*t),t)),
371 * See formula (42), p. 187:
373 * t^(lam-1)*bessel_j(2*u,2*sqrt(a)*sqrt(t))*bessel_j(2*v,2*sqrt(a)*sqrt(t))
375 * -> 2*gamma(lam+u+v)*a^(u+v)/gamma(2*u+1)/gamma(2*v+1)/p^(lam+u+v)
376 * *%f[3,3]([u+v+1/2,u+v+1,lam+u+v],[2*u+1,2*v+1,2*u+2*v+1],-4*a/p)
378 * with Re(lam + u + v) > 0.
380 * So, we have lam = 3/2, u=v=1/4, a = 1/4, we get
382 * 4/%pi/p^2*%f[3,3]([1,3/2,2],[3/2,3/2,2],-1/p)
383 * = 4/%pi/p^2*%f[1,1]([1],[3/2],-1/p)
385 * And %f[1,1]([1],[3/2],-1/p) is
387 * -sqrt(%pi)*%i*erf(%i*sqrt(1/p))*%e^-(1/p)/(2*sqrt(1/p))
389 * So, the final result is:
391 * -2*%i*erf(%i/sqrt(p))*%e^-(1/p)/(sqrt(%pi)*p^(3/2))
395 * bessel_j(u,t)*bessel_j(v,t)
396 * = (z/2)^(u+v)/gamma(u+1)/gamma(v+1)
397 * * %f[2,3]([(u+v+1)/2,(u+v+2)/2],[u+1,v+1,u+v+1],-z^2)
399 * So bessel_j(1/2,sqrt(t))^2 is
401 * 2/%pi*%f[2,3]([1,3/2],[3/2,3/2,2],-t)*sqrt(t)
403 * So the integrand is
405 * 2/%pi*t*%f[2,3]([1,3/2],[3/2,3/2,2],-t)
406 * = 2/%pi*t*%f[1,2]([1],[3/2,2],-t)
408 * f19p220 then gives us the desired transform:
410 * t*%f[1,2]([1],[3/2,2],-t)
411 * -> gamma(2)*p^(-2)*%f[2,2]([1,2],[3/2,2],-1/p)
413 * = p^(-2)*%f[1,1]([1],[3/2],-1/p)
415 * So the final answer is
417 * -%i*erf(%i/sqrt(p))*%e^-(1/p)/(sqrt(%pi)*p^(3/2))
419 * Hmm. This differs from formula 42 above. I think there's a bug in
420 * formula 42, and it should be divided by 2.
422 * If we use the expression for the product of Bessel functions and
423 * f19p220, we can easily derive the result of formula 42, except,
424 * we're missing the factor of 2. So, I think formula 42 is wrong.
427 specint(t^(1/2)*bessel_j(1/2,t^(1/2))^2*%e^(-p*t),t);
428 -%i*erf(%i/sqrt(p))*%e^-(1/p)/(sqrt(%pi)*p^(3/2)) $
431 * See formula (8), section 4.16 of Table of Integral Transforms:
433 * t^u*bessel_i(v,a*t) -> gamma(u+v+1)*s^(-u-1)*assoc_legendre_p(u,-v,p/s)
435 * where s = sqrt(p^2-a^2);
437 factor(ratsimp(specint(t^(1/2)*bessel_i(1,t)*%e^(-p*t),t)));
438 3*sqrt(%pi)*assoc_legendre_p(1/2,-1,p/sqrt(p^2-1))/(4*(p^2-1)^(3/4))$
441 * hankel_1(2/3,sqrt(t)) = bessel_j(2/3,sqrt(t))+%i*bessel_y(2/3,sqrt(t))
443 * Formula (34) below gives:
445 * t^(u-1/2)*bessel_j(2*v,2*sqrt(a)*sqrt(t)) ->
446 * gamma(u+v+1/2)/sqrt(a)/gamma(2*v+1)*p^(-u)*exp(-a/p/2)*%m[u,v](a/p)
450 * t^(u-1/2)*bessel_y(2*v,2*sqrt(a)*sqrt(t)) ->
451 * 1/sqrt(a)*p^(-u)*exp(-a/p/2)*
452 * (tan((u-v)*%pi)*gamma(u+v-1/2)/gamma(2*v+1) * %m[u,v](a/p)
453 * - sec((u-v)*%pi)*%w[u,v](a/p))
455 * But A&S 13.1.34 says
457 * %w[k,u](z) = gamma(-2*u)/gamma(1/2-u-k)*%m[k,u](z)
458 * + gamma(2*u)/gamma(1/2+u-k)*%m[k,-u](z)
462 ratsimp(specint(t*hankel_1(2/3,t^(1/2))*%e^(-p*t),t));
463 /* Because of revision 1.110 of hyp.lisp Maxima knows in addition
464 * hgfred([7/3],[5/3],-1/(4*x)),
465 * the result is in terms of the bessel_i function.
467 -4*%i*gamma(1/3)*%m[-3/2,1/3](-1/(4*p))*%e^-(1/(8*p))/(3*(-1)^(5/6)*sqrt(3)
468 *gamma(2/3)*p^(3/2))+4*gamma(1/3)*%m[-3/2,1/3](-1/(4*p))*%e^-(1/(8*p))/(3*(
469 -1)^(5/6)*gamma(2/3)*p^(3/2))-8*%i*gamma(2/3)*%m[-3/2,-1/3](-1/(4*p))*%e^-
470 (1/(8*p))/(3*(-1)^(1/6)*sqrt(3)*gamma(1/3)*p^(3/2)) $ */
472 (((-1)^(1/6)*2^(2/3)*sqrt(3)*%i-3*(-1)^(1/6)*2^(2/3))
473 *gamma(1/3)^2*gamma(5/6)*bessel_i(11/6,-1/(8*p))
474 +10*(-1)^(5/6)*sqrt(3)*4^(2/3)*%i*gamma(1/6)*gamma(2/3)^2
475 *bessel_i(7/6,-1/(8*p))
476 +(45*(-1)^(1/6)*2^(2/3)-5*(-1)^(1/6)*2^(2/3)*3^(3/2)*%i)
477 *gamma(1/3)^2*gamma(5/6)*bessel_i(5/6,-1/(8*p))
478 +((9*(-1)^(1/6)*2^(5/3)-(-1)^(1/6)*2^(5/3)*3^(3/2)*%i)
479 *bessel_i(-1/6,-1/(8*p))
480 +(5*(-1)^(1/6)*2^(5/3)*sqrt(3)*%i-15*(-1)^(1/6)*2^(5/3))
481 *bessel_i(-7/6,-1/(8*p)))
482 *gamma(1/3)^2*gamma(5/6)
483 +(((-1)^(5/6)*sqrt(3)*4^(2/3)*%i*bessel_i(-11/6,-1/(8*p))
484 -5*(-1)^(5/6)*3^(3/2)*4^(2/3)*%i*bessel_i(-5/6,-1/(8*p)))
486 -2*(-1)^(5/6)*3^(3/2)*4^(2/3)*%i*gamma(1/6)*bessel_i(1/6,-1/(8*p)))
489 /(15*2^(13/3)*4^(1/3)*gamma(1/3)*gamma(2/3)*p^(7/2))/-1;
492 * hankel_2(3/4,t) = bessel_j(3/4,t)-%i*bessel_y(3/4,t)
494 * Sec 4.14, formula (9):
496 * t^u*bessel_j(v,a*t) -> gamma(u+v+1)*r^(-u-1)*assoc_legendre_p(u,-v,p/r)
498 * where r = sqrt(p^2+a^2)
500 * Sec 4.14, formula (48)
502 * t^u*bessel_y(v,a*t)
503 * -> r^(-u-1)*(gamma(u+v+1)*cot(v*%pi)*assoc_legendre_p(u,-v,p/r)
504 * -gamma(u-v+1)*csc(v*%pi)*assoc_legendre_p(u,v,p/r))
508 * t^(1/2)*bessej_j(3/4,t)
509 * -> gamma(9/4)*r^(-3/2)*assoc_legendre_p(1/2,-3/4,p/r)
510 * = 5*gamma(1/4)/16*r^(-3/2)*assoc_legendre_p(1/2,-3/4,p/r)
512 * t^(1/2)*bessel_y(3/4,t)
513 * -> r^(-3/2)*(gamma(9/4)*cot(3/4*%pi)*assoc_legendre_p(1/2,-3/4,p/r)
514 * -gamma(3/4)*csc(3/4*%pi)*assoc_legendre_p(1/2,3/4,p/r))
515 * = r^(-3/2)*(-gamma(9/4)*assoc_legendre_p(1/2,-3/4,p/r)
516 * -gamma(3/4)*sqrt(2)*assoc_legendre_p(1/2,3/4,p/r))
519 ratsimp(specint(t^(1/2)*hankel_2(3/4,t)*%e^(-p*t),t));
520 ''(ratsimp(5*gamma(1/4)/16/(p^2+1)^(3/4)*assoc_legendre_p(1/2,-3/4,p/sqrt(p^2+1))
521 +sqrt(2)*%i*assoc_legendre_p(1/2,3/4,p/sqrt(p^2+1))*gamma(3/4)
523 +5*%i*gamma(1/4)*assoc_legendre_p(1/2,-3/4,p/sqrt(p^2+1))
524 /(16*(p^2+1)^(3/4))))$
527 * hankel_1(1/2,t) = bessel_j(1/2,t)+%i*bessel_y(1/2,t)
531 * t^(3/2)*bessel_j(1/2,t)
532 * -> gamma(3/2+1/2+1)*r^(-5/2)*assoc_legendre_p(3/2,-1/2,p/r)
533 * = 2*r^(-5/2)*assoc_legendre_p(3/2,-1/2,p/r)
534 * t^(3/2)*bessel_y(1/2,t)
535 * -> r^(-5/2)*(gamma(3/2+1/2+1)*cot(%pi/2)*assoc_legendre_p(3/2,-1/2,p/r)
536 * -gamma(3/2-1/2+1)*csc(%pi/2)*assoc_legendre_p(3/2,1/2,p/r))
537 * = -r^(-5/2)*assoc_legendre_p(3/2,1/2,p/r))
539 * assoc_legendre_p(3/2,+/-1/2,z) can be expressed in terms of
540 * hypergeometric functions (A&S 8.1.2).
542 * assoc_legendre_p(3/2,-1/2,z)
543 * = 1/gamma(3/2)*((z+1)/(z-1))^(-1/4)*F(-3/2,5/2;3/2;(1-z)/2)
544 * = sqrt(2)*(z-1)^(1/4)*z*(z+1)^(1/4)/sqrt(%pi)
546 * assoc_legendre_p(3/2,1/2,z)
547 * = 1/gamma(-1/2)*((z+1)/(z-1))^(1/4)*F(-3/2,5/2;-1/2;(1-z)/2)
548 * = sqrt(2)*z*(2*z^2-3)/(sqrt(%pi)*(z-1)^(1/4)*(z+1)^(5/4))
551 * So the result should be
553 * t^(3/2)*bessel_j(1/2,t)
554 * -> 4*p/(sqrt(2)*sqrt(%pi)*(p^2+1)^2)
556 * t^(3/2)*bessel_y(1/2,t)
557 * -> -sqrt(2)*(p-1)*(p+1)/(sqrt(%pi)*(p^2+1)^2)
560 ratsimp(specint(t^(3/2)*hankel_1(1/2,t)*%e^(-p*t),t));
561 -((sqrt(%pi)*(sqrt(2)*%i*p^2-2*sqrt(2)*p-sqrt(2)*%i))/(%pi*p^4+2*%pi*p^2+%pi))$
566 * t^(u-1)*bessel_y(v,a*t)
567 * -> -2/%pi*gamma(u+v)*(a^2+p^2)^(-u/2)
568 * *assoc_legendre_q(u-1,-v,p/sqrt(a^2+p^2))
570 * for a > 0, Re u > |Re v|
572 * We have u = 5/2, v = 1, so the result is
574 * -4/%pi/(p^2+a^2)*assoc_legendre_q(3/2,-1,p/sqrt(p^2+a^2))
576 * The expected result is not correct.
577 * With gamma(1+5/2) = 15*sqrt(%pi)/8 we get:
579 * 15/(4*sqrt(%pi))*(p^2+a^2)^(-5/4)*assoc_legendre_q(3/3,1,p/sqrt(p^2+a^2))
581 * That is the result of Maxima too. The example is correct.
583 factor(specint(t^(5/2-1)*bessel_y(1,a*t)*%e^(-p*t),t));
584 -15*assoc_legendre_q(3/2,-1,p/sqrt(p^2+a^2))/(4*sqrt(%pi)*(p^2+a^2)^(5/4));
589 * %m[k,u](t) = exp(-t/2)*t^(u+1/2)*M(1/2+u-k,1+2*u,t)
593 * %m[1/2,1](t) = exp(-t/2)*t^(3/2)*M(1,3,t)
595 * and the integrand is:
597 * t^(3/2)*%m[1/2,1](t)*exp(-p*t)
598 * = t^3*M(1,3,t)*exp(-(p+1/2)*t)
599 * = t^3*M(1,3,t)*exp(-p'*t)
601 * f19p220 will give us the Laplace transform of t^3*M(1,3,t):
603 * gamma(4)/p'^4*F(1,4;3;1/p')
605 * But p' = p+1/2, so the final result is
607 * 32*(6*p-1)/(2*p-1)^2/(2*p+1)^3
610 ratsimp(specint( t^(3/2)*%m[1/2,1](t)*%e^(-p*t),t));
611 ''(ratsimp(32*(6*p-1)/(2*p-1)^2/(2*p+1)^3));
616 * exp(a*t)*t^2*erf(sqrt(t))*exp(-p*t)
618 * A&S 7.1.21 gives erf(z) = 2/sqrt(%pi)*z*M(1/2,3/2,-z^2) so
619 * erf(sqrt(t)) = 2/sqrt(%pi)*sqrt(t)*M(1/2,3/2,-t)
621 * Therefore, the integrand, with p' = p-a, is
623 * 2/sqrt(%pi)*t^(5/2)*M(1/2,3/2,-t)*exp(-p'*t)
625 * Applying f19p220, the Laplace transform is
627 * 2/sqrt(%pi)*gamma(7/2)/p'^(7/2)*F(1/2,7/2;3/2;-1/p')
629 * Maxima can compute F(1/2,7/2;3/2;-1/p') and substituting p'=p-a
630 * gives us the desired answer.
632 * 15*(1/sqrt(1/(p-a)+1)-2/(3*(p-a)*(1/(p-a)+1)^(3/2))
633 * +1/(5*(p-a)^2*(1/(p-a)+1)^(5/2)))
636 specint(%e^(a*t)*t^2*erf(t^(1/2))*%e^(-p*t),t);
637 15*(1/sqrt(1/(p-a)+1)-2/(3*(p-a)*(1/(p-a)+1)^(3/2))
638 +1/(5*(p-a)^2*(1/(p-a)+1)^(5/2)))
642 * Laplace transforms from Tables of Integral Transforms
648 * bessel_j(v,a*t) -> r^(-1)*(a/R)^v
650 * where r = sqrt(p^2+a^2) and R = p + r
655 radcan(specint(bessel_j(v,a*t)*exp(-p*t),t));
656 a^v/(sqrt(p^2+a^2)*(sqrt(p^2+a^2)+p)^v)$
660 * bessel_j(v,a*t)/t -> v^(-1)*(a/R)^v
662 * (Maxima doesn't recognize that gamma(v)/gamma(v+1) is 1/v.)
664 radcan(specint(bessel_j(v,a*t)/t*exp(-p*t),t));
665 a^v*gamma(v)/((sqrt(p^2+a^2)+p)^v*gamma(v+1))$
669 * t^v*bessel_j(v,a*t) -> 2^v/sqrt(%pi)*gamma(v+1/2)*a^v*r^(-2*v-1)
671 * Maxima doesn't recognize the relationship between gamma(2*v+1) and
674 radcan(specint(t^v*bessel_j(v,a*t)*exp(-p*t),t));
675 a^v*gamma(2*v+1)/((p^2+a^2)^((2*v+1)/2)*2^v*gamma(v+1))$
679 * t^u*bessel_j(v,a*t) -> gamma(u+v+1)*r^(-u-1)*P(u,-v,p/r)
681 (assume(v+u+1>0),true);
686 radcan(specint(t^u*bessel_j(v,a*t)*exp(-p*t),t));
687 /* This is not the correct answer: see the formula above which is correct.
688 We had a bug in the routine legf24 in hyp.lisp.
689 assoc_legendre_p(-u-1,-v,p/sqrt(p^2+a^2))*gamma(v+u+1)
690 /((p^2+a^2)^((u+1)/2))$
693 assoc_legendre_p(u,-v,p/sqrt(p^2+a^2))*gamma(v+u+1)
694 /((p^2+a^2)^((u+1)/2))$
698 * bessel_j(0,2*sqrt(a)*sqrt(t)) -> exp(-a/p)/p
700 specint(bessel_j(0,2*sqrt(a)*sqrt(t))*exp(-p*t),t);
705 * sqrt(t)*bessel_j(1,2*sqrt(a)*sqrt(t)) -> sqrt(a)*p^(-2)*exp(-a/p)
707 specint(sqrt(t)*bessel_j(1,2*sqrt(a)*sqrt(t))*exp(-p*t),t);
708 sqrt(a)*%e^-(a/p)/p^2$
712 * t^(-1/2)*bessel_j(1,2*sqrt(a)*sqrt(t)) ->
713 * sqrt(%pi)/sqrt(p)*exp(-a/2/p)*bessel_i(v/2,a/2/p)
715 specint(t^(-1/2)*bessel_j(1,2*sqrt(a)*sqrt(t))*exp(-p*t),t);
716 sqrt(%pi)*bessel_i(1/2,a/(2*p))*%e^-(a/(2*p))/sqrt(p)$
720 * t^(v/2)*bessel_j(v,2*sqrt(a)*sqrt(t)) ->
721 * a^(v/2)/p^(v+1)*exp(-a/p)
723 specint(t^(v/2)*bessel_j(v,2*sqrt(a)*sqrt(t))*exp(-p*t),t);
724 a^(v/2)*p^(-v-1)*%e^-(a/p)$
728 * t^(-v/2)*bessel_j(v,2*sqrt(a)*sqrt(t)) ->
729 * exp(%i*v*%pi)*p^(v-1)/a^(v/2)/gamma(v)*exp(-a/p)*
730 * gamma_greek(v,a/p*exp(-%i*%pi)
732 * gamma_greek is the incomplete gamma function.
734 specint(t^(-v/2)*bessel_j(v,2*sqrt(a)*sqrt(t))*exp(-p*t),t);
735 p^(v-1)*%e^-(a/p)*v*gamma_greek(v,-a/p)/(a^(v/2)*(-1)^v*gamma(v+1))$
739 * t^(v/2-1)*bessel_j(v,2*sqrt(a)*sqrt(t)) ->
740 * a^(-v/2)*gamma_greek(v,a/p)
742 specint(t^(v/2-1)*bessel_j(v,2*sqrt(a)*sqrt(t))*exp(-p*t),t);
743 v*gamma(v)*gamma_greek(v,a/p)/(a^(v/2)*gamma(v+1))$
747 * t^(u-1/2)*bessel_j(2*v,2*sqrt(a)*sqrt(t)) ->
748 * gamma(u+v+1/2)/sqrt(a)/gamma(2*v+1)*p^(-u)*exp(-a/p/2)*%m[u,v](a/p)
752 * %m[k,u](z) = exp(-z/2)*z^(u+1/2)*M(1/2+u-k,1+2*u,z)
754 * A&S 13.1.27 (Kummer Transformation):
756 * M(a,b,z) = exp(z)*M(b-a,b,-z)
760 * %m[k,u](z) = exp(z/2)*z^(u+1/2)*M(1/2+u+k,1+2*u,-z)
762 * But %m[-k,u](-z) = exp(z/2)*(-z)^(u+1/2)*M(1/2+u+k,1+2*u,-z)
766 * %m[k,u](z) = (-1)^(u+1/2)*%m[-k,u](-z)
768 * So the Laplace transform can also be written as
770 * gamma(u+v+1/2)/sqrt(a)/gamma(2*v+1)*p^(-u)*exp(-a/p/2)
771 * *%m[-u,v](-a/p)*(-1)^(v+1/2)
773 * Which is the answer we produce.
775 prefer_whittaker:true;
777 (assume(2*v+2*u+1>0),true);
780 specint(t^(u-1/2)*bessel_j(2*v,2*sqrt(a)*sqrt(t))*exp(-p*t),t);
781 %m[-u,v](-a/p)*%e^-(a/(2*p))*(-1)^(-v-1/2)*gamma(v+u+1/2)
782 /(sqrt(a)*p^u*gamma(2*v+1))$
786 * t^(u-1)*bessel_j(2*v,2*sqrt(a)*sqrt(t)) ->
787 * gamma(u+v)*a^v/gamma(2*v+1)/p^(u+v)*%f[1,1](u+v,2*v+1,-a/p)
789 prefer_whittaker:false;
791 (assume(v+u>0),true);
794 specint(t^(u-1)*bessel_j(2*v,2*sqrt(a)*sqrt(t))*exp(-p*t),t);
795 a^v*p^(-v-u)*gamma(v+u)*%f[1,1]([v+u],[2*v+1],-a/p)/gamma(2*v+1)$
800 * a^v*cot(v*%pi)/r*R^(-v)-a^(-v)*csc(v*%pi)/r*R^v
804 expand(factor(radcan(specint(exp(-p*t)*bessel_y(1/6,a*t),t))));
805 sqrt(3)*a^(1/6)/(sqrt(p^2+a^2)*(sqrt(p^2+a^2)+p)^(1/6))
806 -2*(sqrt(p^2+a^2)+p)^(1/6)/(a^(1/6)*sqrt(p^2+a^2))$
808 (assume(v1 > 0, v1 < 1), true);
810 expand(factor(radcan(specint(exp(-p*t)*bessel_y(v1,a*t),t))));
811 a^v1*cot(%pi*v1)/(sqrt(p^2+a^2)*(sqrt(p^2+a^2)+p)^v1)
812 -(sqrt(p^2+a^2)+p)^v1/(a^v1*sqrt(p^2+a^2)*sin(%pi*v1)) $
818 * t^(lam-1)*bessel_j(2*u,2*sqrt(a)*sqrt(t))*bessel_j(2*v,2*sqrt(a)*sqrt(t)) ->
819 * gamma(lam+u+v)/gamma(2*u+1)/gamma(2*v+1)*a^(u+v)/p^(lam+u+v)
820 * *%f[3,3]([u+v+1/2,u+v+1,lam+u+v],[2*u+1,2*v+1,2*u+2*v+1],-4*a/p)
823 (assume(u>0,v>0,lam>0),true);
825 specint(t^(lam-1)*bessel_j(2*u,2*sqrt(a)*sqrt(t))*bessel_j(2*v,2*sqrt(a)*sqrt(t))*exp(-p*t),t);
826 a^(v+u)*p^(-v-u-lam)*gamma(v+u+lam)
827 *%f[3,3]([v+u+1/2,v+u+1,v+u+lam],[2*u+1,2*v+1,2*v+2*u+1],-4*a/p)
828 /(gamma(2*u+1)*gamma(2*v+1))$
834 * bessel_y(0,a*t) -> -2/%pi/sqrt(p^2+a^2)*asinh(p/a)
838 * -2/%pi/sqrt(p^2+a^2)*legendre_q(0,p/sqrt(p^2+a^2))
840 * But legendre_q(0,p/r) = log((1+p/r)/(1-p/r))/2, where r = sqrt(p^2+a^2).
841 * This simplifies to log((1+p/r)/a) = log(p/a+sqrt(1+(p/a)^2)) = asinh(p/a).
843 * So we have -2/%pi/sqrt(p^2+a^2)*asinh(p/a).
845 * With revision 1.64 of hypgeo.lisp we simplify the Legendre Q function.
846 * The result is equivalent to the above formula.
848 specint(bessel_y(0,a*t)*exp(-p*t),t);
850 /*-2/%pi/sqrt(p^2+a^2)*legendre_q(0,p/sqrt(p^2+a^2)) $*/
852 -log((sqrt(p^2+a^2)+p)/(sqrt(p^2+a^2)-p))/(%pi*sqrt(p^2+a^2));
858 * -> 2/%pi/(p^2+a^2)*(1-p/sqrt(p^2+a^2)*log((p+sqrt(p^2+a^2))/a))
862 * -2/%pi/(p^2+a^2)*legendre_q(1,p/sqrt(p^2+a^2))
865 * legendre_q(1,p/r) = p/r/2*log((r+p)/(r-p)) - 1
866 * = p/r*log((p+r)/a) - 1
868 * So, the transform is
870 * -2/%pi/(p^2+a^2)*(p/r*log((p+r)/a) - 1)
872 * = 2/%pi/(p^2+a^2)*(1-p/sqrt(p^2+a^2)*log((p+sqrt(p^2+a^2))/a))
874 * The Legendre Q function simplifes accordingly.
876 factor(specint(t*bessel_y(0,a*t)*exp(-p*t),t));
877 /*-2/%pi/(p^2+a^2)*legendre_q(1,p/sqrt(p^2+a^2)) $*/
879 (p*log((sqrt(p^2+a^2)+p)/(sqrt(p^2+a^2)-p))-2*sqrt(p^2+a^2))
880 /(-%pi*(p^2+a^2)^(3/2));
886 * -> -2/%pi/(p^2+a^2)*(p/a+a/sqrt(p^2+a^2)*log((p+sqrt(p^2+a^2))/a)
889 * -4/%pi/(p^2+a^2)*assoc_legendre_q(1,-1,p/r)
893 * assoc_legendre_q(1,-1,z)
894 * = sqrt(1-z^2)/2/(z^2-1)*((z^2-1)*log((1+z)/(1-z)) - 2*z)
898 * assoc_legendre_q(1,-1,p/r)
899 * = (a/r)/2*(-(r/a)^2)*(-(a/r)^2*log((R/a)^2)-2*p/r)
900 * = 1/2*(p/a+a/r*log(R/a))
904 * Finally, the transform is
906 * -2/%pi/(p^2+a^2)*(p/a+a/r*log(R/a))
911 factor(specint(t*bessel_y(1,a*t)*exp(-p*t),t));
912 /*-4/%pi/(p^2+a^2)*assoc_legendre_q(1,-1,p/sqrt(p^2+a^2))$*/
914 (a^2*log((sqrt(p^2+a^2)+p)/(sqrt(p^2+a^2)-p))+2*p*sqrt(p^2+a^2))
915 /(%pi*a*(p^2+a^2)^(3/2));
919 * Some tests for step7
923 * F(s,s+1/2;2*s+1;z) can be transformed to F(s,s+1/2;2*s+2;z) via
924 * A&S 15.2.6. And we know that F(s,s+1/2;2*s+1;z) =
925 * 2^(2*s)/(1+sqrt(1-z))^(2*s).
928 * F(a,b;c+n;z) = poch(c,n)/poch(c-a,n)/poch(c-b,n)*(1-z)^(c+n-a-b)
929 * *diff((1-z)^(a+b-c)*F(a,b;c;z),z,n)
932 * = poch(2*s+1,1)/poch(s+1,1)/poch(s+1/2,1)*(1-z)^(3/2)
933 * *diff((1-z)^(-1/2)*F(s,s+1/2;2*s+1;z),z,1)
938 hgfred([s,s+1/2],[2*s+2],z)
939 -(2*s+1)/(s+1)/(s+1/2)*(1-z)^(3/2)*diff((1-z)^(-1/2)
940 *hgfred([s,s+1/2],[2*s+1],z),z);
944 * F(s,s+1/2;2*s+1;z) can be transformed to F(s+2,s+1/2;2*s+1;z) via
946 * F(a+n,b;c;z) = z^(1-a)/poch(a,n)*diff(z^(a+n-1)*F(a,b;c;z),z,n)
948 * F(s+2,s+1/2;2*s+1,z)
949 * = z^(1-s)/s/(s+1)*diff(z^(s+1)*F(s,s+1/2;2*s+1;z),z,2)
952 hgfred([s+2,s+1/2],[2*s+1],z)
953 - z^(1-s)/s/(s+1)*diff(z^(s+1)*hgfred([s,s+1/2],[2*s+1],z),z,2);
956 /* Tests for Airy functions */
957 closeto(e,tol):=block([numer:true,abse],abse:abs(e),if(abse<tol) then true else abse);
958 closeto(e,tol):=block([numer:true,abse],abse:abs(e),if(abse<tol) then true else abse);
960 /* Derivatives of Airy functions */
970 /* Integrals of Airy functions */
971 integrate(airy_ai(z),z);
972 hypergeometric([1/3],[2/3,4/3],z^3/9)*z/(3^(2/3)*gamma(2/3))
973 -3^(1/6)*gamma(2/3)*hypergeometric([2/3],[4/3,5/3],z^3/9)*z^2/(4*%pi);
974 integrate(airy_dai(z),z);
976 integrate(airy_bi(z),z);
977 3^(2/3)*gamma(2/3)*hypergeometric([2/3],[4/3,5/3],z^3/9)*z^2/(4*%pi)
978 +hypergeometric([1/3],[2/3,4/3],z^3/9)*z/(3^(1/6)*gamma(2/3));
979 integrate(airy_dbi(z),z);
982 /* A&S 10.4.1 Airy functions satisfy the Airy differential equation */
983 diff(airy_ai(x),x,2)-x*airy_ai(x);
985 diff(airy_bi(x),x,2)-x*airy_bi(x);
988 /* A&S 10.4.4 Normalization of Airy Ai function */
989 (c1:3^(-2/3)/gamma(2/3), closeto(airy_ai(0)-c1,1.0e-15));
991 closeto(airy_bi(0)/sqrt(3)-c1,1.0e-15);
994 /* A&S 10.4.5 Normalization of Airy Bi function */
995 (c2:3^(-1/3)/gamma(1/3),closeto(-airy_dai(0)-c2,1.0e-15));
997 closeto(airy_dbi(0)/sqrt(3)-c2,1.0e-14);
1000 /* Exact values A&S 10.4.4 and 10.4.5 */
1002 1/(3^(2/3)*gamma(2/3));
1004 -(1/(3^(1/3)*gamma(1/3)));
1006 1/(3^(1/6)*gamma(2/3));
1010 /* A&S 10.4.10 - Wronskian */
1011 AS_10_4_10(z):=expand(airy_ai(z)*airy_dbi(z)-airy_bi(z)*airy_dai(z)-1/%pi);
1012 AS_10_4_10(z):=expand(airy_ai(z)*airy_dbi(z)-airy_bi(z)*airy_dai(z)-1/%pi);
1013 closeto(AS_10_4_10(1),1.0e-15);
1015 closeto(AS_10_4_10(1+%i),1.0e-15);
1017 closeto(AS_10_4_10(%i),1.0e-15);
1019 closeto(AS_10_4_10(-1+%i),2.0e-15);
1021 closeto(AS_10_4_10(-1),1.0e-15);
1023 closeto(AS_10_4_10(-1-%i),2.0e-15);
1025 closeto(AS_10_4_10(-%i),1.0e-15);
1027 closeto(AS_10_4_10(1-%i),1.0e-15);
1030 /* A&S 10.4.14 - only for z>0 ? */
1031 AS_10_4_14(z):=block([y:(2/3)*(z)^(3/2)],airy_ai(z)-(sqrt(z/3)*bessel_k(1/3,y)/%pi));
1032 AS_10_4_14(z):=block([y:(2/3)*(z)^(3/2)],airy_ai(z)-(sqrt(z/3)*bessel_k(1/3,y)/%pi));
1033 closeto(AS_10_4_14(1),1.0e-15);
1035 closeto(AS_10_4_14(2),1.0e-15);
1037 closeto(AS_10_4_14(5),1.0e-15);
1039 closeto(AS_10_4_14(10),1.0e-15);
1042 /* A&S 10.4.15 - only for z<0 ? */
1043 AS_10_4_15(z):=block([y:(2/3)*(-z)^(3/2)],airy_ai(z)-(1/3)*sqrt(-z)*(bessel_j(1/3,y)+bessel_j(-1/3,y)));
1044 AS_10_4_15(z):=block([y:(2/3)*(-z)^(3/2)],airy_ai(z)-(1/3)*sqrt(-z)*(bessel_j(1/3,y)+bessel_j(-1/3,y)));
1045 closeto(AS_10_4_15(-1),1.0e-15);
1047 closeto(AS_10_4_15(-2),1.0e-15);
1049 closeto(AS_10_4_15(-5),1.0e-14);
1051 closeto(AS_10_4_15(-10),1.0e-15);
1054 /* A&S 10.4.16 - only for z>0 ? */
1055 AS_10_4_16(z):=block([y:(2/3)*(z)^(3/2)],airy_dai(z)+(z/sqrt(3))*bessel_k(2/3,y)/%pi);
1056 AS_10_4_16(z):=block([y:(2/3)*(z)^(3/2)],airy_dai(z)+(z/sqrt(3))*bessel_k(2/3,y)/%pi);
1057 closeto(AS_10_4_16(1),1.0e-15);
1059 closeto(AS_10_4_16(2),1.0e-15);
1061 closeto(AS_10_4_16(5),1.0e-15);
1063 closeto(AS_10_4_16(10),1.0e-15);
1066 /* A&S 10.4.17 - only for z<0 ?, Appears to be a sign error in A&S */
1067 AS_10_4_17(z):=block([y:(2/3)*(-z)^(3/2)],airy_dai(z)-(z/3)*(bessel_j(-2/3,y)-bessel_j(2/3,y)));
1068 AS_10_4_17(z):=block([y:(2/3)*(-z)^(3/2)],airy_dai(z)-(z/3)*(bessel_j(-2/3,y)-bessel_j(2/3,y)));
1069 closeto(AS_10_4_17(-1),1.0e-15);
1071 closeto(AS_10_4_17(-2),1.0e-15);
1073 closeto(AS_10_4_17(-5),1.0e-14);
1075 closeto(AS_10_4_17(-10),1.0e-15);
1078 /* Test that complex float arguments are evaluated */
1081 floatnump(realpart(airy_ai(1.0*%i)));
1084 kill(c1,c2,AS_10_4_10,AS_10_4_14,AS_10_4_15,AS_10_4_16,AS_10_4_17);
1087 /* End of Airy function tests */
1089 /* Numerical tests of gamma function. */
1091 /* A&S Table 1.1, to 15 DP */
1092 closeto(gamma(1/2)-1.772453850905516,2e-15);
1094 closeto(gamma(1/3)-2.678938534707748,3.0e-15);
1096 closeto(gamma(7/4)-0.919062526848883,1e-15);
1099 /* Complex values. Checked against A&S Table 6.7 to 12 DP */
1100 closeto(gamma(1+%i)-(0.49801566811836-0.15494982830181*%i),1e-14);
1102 closeto(gamma(1+5*%i)-(-0.00169966449436-0.00135851941753*%i),1e-14);
1104 closeto(gamma(2+3*%i)-(-0.08239527266561+0.09177428743526*%i),1e-14);
1107 /* Test numerical evaluation of Bessel functions
1108 * When the order is 0, and the arg is a float, we should produce a number.
1110 closeto(bessel_j(0,1.0) - .7651976865579666, 1e-14);
1113 closeto(bessel_y(0,1.0) - .08825696421567691, 1e-14);
1116 closeto(bessel_i(0,1.0) - 1.266065877752009, 1e-14);
1119 closeto(bessel_k(0,1.0) - .4210244382407085, 1e-14);
1123 * Tests for failed cases to see if we're returning the noun forms
1125 /* fail-on-f24p146test */
1126 specint(t^(-3/2)*exp(-t^2/8/a)*exp(-p*t),t);
1127 'specint(t^(-3/2)*exp(-t^2/8/a)*exp(-p*t),t);
1129 /* fail-on-f35p147test
1130 Because we modified the construction of a noun form, we get a sligthly
1131 different noun form as result. DK. */
1132 specint((2*t)^(-3/2)*exp(-2*sqrt(a)*sqrt(t))*exp(-p*t),t);
1133 /*'specint(exp(-p*t -2*sqrt(a)*sqrt(t))/(8*t^(3/2)),t);*/
1134 'specint(%e^(-p*t-2*sqrt(a)*sqrt(t))/(2*sqrt(2)*t^(3/2)),t);
1136 /* fail-on-f29p146test */
1137 specint(t^(v-1)*exp(1/8/t)*exp(-p*t),t);
1138 'specint(t^(v-1)*exp(1/8/t)*exp(-p*t),t);
1140 /* fail-in-arbpow (aka f1p137test) */
1141 specint(t^(-1)*exp(-p*t),t);
1142 'specint(exp(-p*t)/t,t);
1144 /* fail-in-f2p105vcond */
1148 specint(8*t^1*exp(3*t)*bessel_y(3,t)*exp(-p*t),t);
1149 'specint(8*bessel_y(3,t)*t*%e^(3*t-p*t),t)$
1151 /* fail-in-f50cond */
1152 specint(8*t^1*exp(3*t)*bessel_y(8,7*sqrt(t))*exp(-p*t),t);
1153 'specint(8*bessel_y(8,7*sqrt(t))*t*%e^(3*t-p*t),t);
1155 /* fail-in-dionarghyp-y */
1156 specint(8*t^1*exp(3*t)*bessel_y(8,7*t^(3/2))*exp(-p*t),t);
1157 'specint(8*bessel_y(8,7*t^(3/2))*t*%e^(3*t-p*t),t);
1159 /* The additionally phase factor in the calculation vanish, because of
1160 the modificaton of the transformation to Bessel J in the code. DK.
1162 (assume(t>0,v2>1), radcan(specint(bessel_i(-v2,t)*exp(-p*t),t)));
1163 /*'specint((%e^((%i*%pi*v2-2*p*t)/2)*bessel_i(-v2,t))/(-1)^(v2/2),t);*/
1164 '(specint(bessel_i(-v2,t)*exp(-p*t),t));
1166 /* Verify fix for [ 1877522 ] erf(1.0),nouns wrong; causes plot2d(erf) to fail
1177 /* [ 789059 ] simpexpt problem: sign called on imag arg */
1178 (-(-1)^(1/6))^(1/2);
1181 /* Further tests of bessel functions */
1182 /* The following numerical values are evaluated with the evaluation tool
1183 of the website www.functions.wolfram.com with a precision of 16 digits
1184 1998-2014 Wolfram Research, Inc. */
1186 (test_bessel(actual, ref, digits) := closeto(realpart(actual)-realpart(ref), 10^(-digits)) and closeto(imagpart(actual)-imagpart(ref), 10^(-digits)), 0);
1189 /* Numerical values for the bessel function J with negative order */
1191 test_bessel(bessel_j(-1,-2.0),0.5767248077568734, 15);
1194 test_bessel(bessel_j(-1,2.0), -0.5767248077568734, 15);
1197 test_bessel(bessel_j(-1,-1.5), 0.5579365079100996, 15);
1200 test_bessel(bessel_j(-1,1.5), -0.5579365079100996, 15);
1203 test_bessel(bessel_j(-1.5, -2.0), -0.3956232813587035*%i, 15);
1206 test_bessel(bessel_j(-1.5, 2.0), -0.3956232813587035, 15);
1210 (bessel_j(-1.8, -1.5),- 0.2033279902093184 - 0.1477264320209275 * %i,15);
1213 test_bessel(bessel_j(-1.8, 1.5), -0.251327217627129314,15);
1216 test_bessel(bessel_j(-2,-1.5), 0.2320876721442147, 15);
1219 test_bessel(bessel_j(-2,1.5), 0.2320876721442147, 15);
1222 test_bessel(bessel_j(-2.5,-1.5), -1.315037204805194 * %i,15);
1225 test_bessel(bessel_j(-2.5,1.5), 1.315037204805194,15);
1229 (bessel_j(-2.3,-1.5), 0.5949438455752484 - 0.8188699527453657 * %i,14);
1232 test_bessel(bessel_j(-2.3,1.5), 1.012178926325313, 14);
1235 /* Numerical values for the bessel function J with positive order */
1237 test_bessel(bessel_j(1.5,1.0), 0.2402978391234270, 15);
1240 test_bessel(bessel_j(1.5,-1.0), -0.2402978391234270 * %i, 15);
1243 test_bessel(bessel_j(1.8,1.0), 0.1564953153109239, 14);
1247 (bessel_j(1.8,-1.0), 0.1266073696266034 - 0.0919856383926216 * %i, 15);
1250 test_bessel(bessel_j(2.0,1.0), 0.1149034849319005,15);
1253 test_bessel(bessel_j(2.0,-1.0),0.1149034849319005,15);
1256 test_bessel(bessel_j(2.5,1.0),0.04949681022847794,15);
1259 test_bessel(bessel_j(2.5,-1.0),0.04949681022847794 * %i,15);
1262 /* Numerical values for the bessel function J with complex arg
1263 and positive or negative order*/
1266 (bessel_j(0,1.0+%i),0.9376084768060293 - 0.4965299476091221 * %i,15);
1270 (bessel_j(1,1.0+%i),0.6141603349229036 + 0.3650280288270878 * %i,15);
1274 (bessel_j(-1,1.0+%i),-0.6141603349229036 - 0.3650280288270878 * %i,14);
1278 (bessel_j(2,1.0+%i),0.0415798869439621 + 0.2473976415133063 * %i,15);
1282 (bessel_j(-2,1.0+%i),0.0415798869439621 + 0.2473976415133063 * %i,15);
1286 (bessel_j(2.3,1.0+%i),-0.0141615213034667 + 0.1677798241687935 * %i,15);
1290 (bessel_j(-2.3,1.0+%i),0.1920598664138632 - 0.5158676904105332 * %i,14);
1293 /* Numerical values for the bessel function J with complex order */
1296 (bessel_j(%i,1.0),1.641024179495082 - 0.437075010213683*%i,15);
1300 (bessel_j(%i,1.5),1.401883276281807 + 0.473362399311655*%i,15);
1304 (bessel_j(1.0+%i,-1.0),-0.01142279482478010 + 0.02390070064911069*%i,15);
1308 (bessel_j(1.5*%i,-2.0),0.01925195427338360 + 0.01442616961986814*%i,15);
1311 /******************************************************************/
1312 /* Numerical values for the bessel function Y with negative order */
1315 (bessel_y(-1,-2.0),-0.1070324315409375 + 1.1534496155137468 * %i,14);
1318 test_bessel(bessel_y(-1,2.0),0.1070324315409375,15);
1322 (bessel_y(-1,-1.5),-0.4123086269739113 + 1.1158730158201993 * %i,15);
1325 test_bessel(bessel_y(-1,1.5),0.4123086269739113,15);
1328 test_bessel(bessel_y(-1.5, -2.0),0.4912937786871623 * %i,15);
1331 test_bessel(bessel_y(-1.5, 2.0),-0.4912937786871623,15);
1335 (bessel_y(-1.8, -1.5),-0.6777414340388011 + 0.0857519944018923 * %i,14);
1338 test_bessel(bessel_y(-1.8, 1.5),-0.8377344836401481,14);
1342 (bessel_y(-2,-1.5),-0.9321937597629739 + 0.4641753442884295 * %i,15);
1345 test_bessel(bessel_y(-2,1.5),-0.9321937597629739,14);
1348 test_bessel(bessel_y(-2.5,-1.5),0.1244463597983876 * %i,14);
1351 test_bessel(bessel_y(-2.5,1.5),0.1244463597983876,15);
1355 (bessel_y(-2.3,-1.5),-0.3148570865836879 + 0.7565240896444820 * %i,14);
1358 test_bessel(bessel_y(-2.3,1.5),-0.5356668704355646,14);
1361 /* Numerical values for the bessel function Y with positive order */
1363 test_bessel(bessel_y(1.5,1.0),-1.102495575160179,14);
1366 test_bessel(bessel_y(1.5,-1.0),-1.102495575160179 * %i,14);
1369 test_bessel(bessel_y(1.8,1.0),-1.382351995367631,14);
1373 (bessel_y(1.8,-1.0),-1.1183462564605324 - 0.5593113771009602 * %i,14);
1376 test_bessel(bessel_y(2.0,1.0),-1.650682606816254,14);
1380 (bessel_y(2.0,-1.0),-1.650682606816254 + 0.229806969863801 * %i,14);
1383 test_bessel(bessel_y(2.5,1.0),-2.876387857462161,14);
1386 test_bessel(bessel_y(2.5,-1.0),2.876387857462161 * %i,14);
1390 /* Numerical values for the bessel function Y with complex arg
1391 and positive or negative order*/
1394 (bessel_y(0,1.0+%i),0.4454744889360325 + 0.7101585820037345 * %i,15);
1398 (bessel_y(1,1.0+%i),-0.6576945355913452 + 0.6298010039928844 * %i,15);
1402 (bessel_y(-1,1.0+%i),0.6576945355913452 - 0.6298010039928844 * %i,15);
1406 (bessel_y(2,1.0+%i),-0.4733680205344934 + 0.5773369575804951 * %i,14);
1410 (bessel_y(-2,1.0+%i),-0.4733680205344934 + 0.5773369575804951 * %i,14);
1414 (bessel_y(2.3,1.0+%i),-0.2476879981252862 + 0.7595467103431256 * %i,15);
1418 (bessel_y(-2.3,1.0+%i),-0.1570442638685963 + 0.5821870838327466 * %i,14);
1421 /* Numerical values for the bessel function Y with complex order */
1424 (bessel_y(%i,1.0),-0.476556612479964 - 1.505069159110387*%i,14);
1428 (bessel_y(%i,1.5),0.5161218926267688 - 1.2857405211747503*%i,14);
1432 (bessel_y(1.0+%i,-1.0),7.708594946281541 + 1.233384674244926*%i,14);
1436 (bessel_y(1.5*%i,-2.0),3.226466016458932 + 4.267260420563194*%i,13);
1439 /******************************************************************/
1440 /* Numerical values for the bessel function I with negative order */
1442 test_bessel(bessel_i(-1,-2.0),-1.590636854637329,15);
1445 test_bessel(bessel_i(-1,2.0),1.590636854637329,15);
1448 test_bessel(bessel_i(-1,-1.5),-0.9816664285779076,15);
1451 test_bessel(bessel_i(-1,1.5),0.9816664285779076,15);
1454 test_bessel(bessel_i(-1.5, -2.0),0.9849410530002364 * %i,14);
1457 test_bessel(bessel_i(-1.5, 2.0),0.9849410530002364,14);
1461 (bessel_i(-1.8, -1.5),0.2026903980307014 + 0.1472631941876387 * %i,15);
1464 test_bessel(bessel_i(-1.8, 1.5),0.2505391103524365,15);
1467 test_bessel(bessel_i(-2,-1.5),0.3378346183356807,15);
1470 test_bessel(bessel_i(-2,1.5),0.3378346183356807,15);
1473 test_bessel(bessel_i(-2.5,-1.5),-0.8015666610717216*%i,14);
1476 test_bessel(bessel_i(-2.5,1.5),0.8015666610717216,14);
1480 (bessel_i(-2.3,-1.5),0.3733945265830230 - 0.5139334755917659 * %i,15);
1483 test_bessel(bessel_i(-2.3,1.5),0.6352567117441516,15);
1486 /* Numerical values for the bessel function I with positive order */
1488 test_bessel(bessel_i(1.5,1.0),0.2935253263474798,15);
1491 test_bessel(bessel_i(1.5,-1.0),-0.2935253263474798*%i,13);
1494 test_bessel(bessel_i(1.8,1.0),0.1871011888310777,15);
1498 (bessel_i(1.8,-1.0),0.1513680414320980 - 0.1099753194812967 * %i,14);
1501 test_bessel(bessel_i(2.0,1.0),0.1357476697670383,15);
1504 test_bessel(bessel_i(2.0,-1.0),0.1357476697670383,15);
1507 test_bessel(bessel_i(2.5,1.0),0.05709890920304825,15);
1510 test_bessel(bessel_i(2.5,-1.0),0.05709890920304825 * %i,15);
1514 /* Numerical values for the bessel function I with complex arg
1515 and positive or negative order*/
1518 (bessel_i(0,1.0+%i),0.9376084768060293 + 0.4965299476091221 * %i,15);
1522 (bessel_i(1,1.0+%i),0.3650280288270878 + 0.6141603349229036 * %i,15);
1526 (bessel_i(-1,1.0+%i),0.3650280288270878 + 0.6141603349229036 * %i,15);
1530 (bessel_i(2,1.0+%i),-0.0415798869439621 + 0.2473976415133063 * %i,15);
1534 (bessel_i(-2,1.0+%i),-0.0415798869439621 + 0.2473976415133063 * %i,15);
1538 (bessel_i(2.3,1.0+%i),-0.0635524383467825 + 0.1559221140952053 * %i,15);
1542 (bessel_i(-2.3,1.0+%i),-0.4053256245784623 - 0.3724481230406298 * %i,14);
1545 /* Numerical values for the bessel function I with complex order */
1548 (bessel_i(%i,1.0),1.900799675819425 - 1.063960013554441*%i,14);
1552 (bessel_i(%i,1.5),2.495473638417463 - 0.601347501920535*%i,14);
1556 (bessel_i(1.0+%i,-1.0),-0.01096313515009349 + 0.03043920114776303*%i,15);
1560 (bessel_i(1.5*%i,-2.0),0.04238259669782487 - 0.01125055344512197*%i,15);
1563 /******************************************************************/
1564 /* Numerical values for the bessel function K with negative order */
1567 (bessel_k(-1,-2.0),-0.139865881816522-4.997133057057809*%i,14);
1570 test_bessel(bessel_k(-1,2.0),0.139865881816522,14);
1574 (bessel_k(-1,-1.5),-0.277387800456844 - 3.083996040296084*%i,14);
1577 test_bessel(bessel_k(-1,1.5),0.2773878004568438,15);
1580 test_bessel(bessel_k(-1.5, -2.0),-3.2741902342766302*%i,13);
1583 test_bessel(bessel_k(-1.5, 2.0),0.1799066579520922,15);
1587 (bessel_k(-1.8, -1.5),0.3929372194683435 - 1.0725774293000646*%i,15);
1590 test_bessel(bessel_k(-1.8, 1.5),0.4856971141526263,15);
1594 (bessel_k(-2,-1.5),0.5836559632566508 - 1.0613387550916862*%i,14);
1597 test_bessel(bessel_k(-2,1.5),0.5836559632566508,15);
1601 (bessel_k(-2.3,-1.5),0.465598659425186 - 1.354876241730594*%i,14);
1604 test_bessel(bessel_k(-2.3,1.5),0.7921237520153218,15);
1607 /* Numerical values for the bessel function K with positive order */
1609 test_bessel(bessel_k(1.5,1.0),0.9221370088957891,14);
1612 /* kein Wert von function-site !? Ist das eine Nullstelle??? */
1613 test_bessel(bessel_k(1.5,-1.0),0,13);
1616 test_bessel(bessel_k(1.8,1.0),1.275527037541854,15);
1620 (bessel_k(1.8,-1.0),1.0319230501560911 + 0.1619402612577788*%i,14);
1623 test_bessel(bessel_k(2.0,1.0),1.624838898635177,14);
1626 test_bessel(bessel_k(2.0,-1.0),1.624838898635177 - 0.426463882082061*%i,14);
1629 test_bessel(bessel_k(2.5,1.0),3.227479531135262,14);
1632 test_bessel(bessel_k(2.5,-1.0),-3.406861044815549*%i,14);
1635 /* Numerical values for the bessel function K with complex arg
1636 and positive or negative order*/
1639 (bessel_k(0,1.0+%i),0.0801977269465178 - 0.3572774592853303*%i,15);
1643 (bessel_k(1,1.0+%i),0.0245683055237403 - 0.4597194738011894 * %i,15);
1647 (bessel_k(-1,1.0+%i),0.0245683055237403 - 0.4597194738011894 * %i,15);
1651 (bessel_k(2,1.0+%i),-0.3549534413309312 - 0.8415652386102600 * %i,13);
1655 (bessel_k(-2,1.0+%i),-0.3549534413309312 - 0.8415652386102600 * %i,13);
1659 (bessel_k(2.3,1.0+%i),-0.6635905911278042 - 1.0258894849569300 * %i,15);
1663 (bessel_k(-2.3,1.0+%i),-0.6635905911278042 - 1.0258894849569300 * %i,13);
1666 /* Numerical values for the bessel function K with complex order */
1669 (bessel_k(%i,1.0),0.2894280370259921,14);
1673 (bessel_k(%i,1.5),0.1635839926633096,14);
1677 (bessel_k(1.0+%i,-1.0),-9.744252766030894 - 7.494570149760043*%i,14);
1681 (bessel_k(1.5*%i,-2.0),3.93512366711118 - 14.82183468316553*%i,13);
1684 kill(closeto, test_bessel);
1687 /* Numerical tests of the Bessel functions using the Wronskians
1689 The Wronskians combines different types of Bessel functions and
1690 Bessel functions with negative and positve order.
1691 The results are very simple. Therefore the numerical calculation of the
1692 Wronskians is a good test for the different parts of the algorithmen.
1694 Based on code by Dieter Kaiser.
1697 /* Test the Wronskian. wf is the Wronskian function. w_true is simplified Wronskian.
1698 * eps is the max absolute error allowed, and the Wronskian is tested
1699 * for values of the arg between -zlimit and zlimit.
1701 (test_wronskian(wf, w_true, eps, zlimit) :=
1702 block([badpoints : [],
1706 for order:-1 thru 1 step 1/10 do
1708 for z: -zlimit thru zlimit step 1 do
1710 if notequal(z,0.0) then
1712 result : float(rectform(wf(float(order),z))),
1713 answer : float(rectform(w_true(float(order),z))),
1714 abserr : abs(result - answer),
1715 maxerr : max(maxerr, abserr),
1716 if abserr > eps then
1718 badpoints : cons([[order, z], result, answer, abserr], badpoints)
1724 * For debugging, if there are any bad points, return the maximum error
1725 * found as the first element.
1727 if badpoints # [] then
1728 cons(maxerr, badpoints)
1734 /*******************************************************************************
1738 A&S 9.1.15 : J[n+1](z)*J[-n](z)+J[n](z)*J[-(n+1)](z) = -2*sin(n*pi)/(pi*z)
1740 *******************************************************************************/
1742 w_jj(n,z) := bessel_j(n+1,z)*bessel_j(-n,z) + bessel_j(n,z)*bessel_j(-n-1,z);
1743 w_jj(n,z) := bessel_j(n+1,z) *bessel_j(-n,z) + bessel_j(n,z)*bessel_j(-n-1,z);
1745 /* Calculation of w_jj for real argument */
1747 test_wronskian('w_jj, lambda([n,z], -2.0*sin(n*%pi)/(z*%pi)), 1e-14, 10);
1751 /* Calculation of w_jj for complex argument */
1753 test_wronskian(lambda([n,z], expand(w_jj(n,%i*z))),
1754 lambda([n,z],-2.0*sin(n*%pi)/(%i*z*%pi)),
1758 /*******************************************************************************
1762 A&S 9.1.16: J[n+1](z)*Y[n](z)-J[n](z)*Y[n+1,z] = 2/(pi*z)
1764 *******************************************************************************/
1766 w_jy(n,z) := bessel_j(n+1,z)*bessel_y(n,z) - bessel_j(n,z)*bessel_y(n+1,z);
1767 w_jy(n,z) := bessel_j(n+1,z)*bessel_y(n,z) - bessel_j(n,z)*bessel_y(n+1,z);
1769 /* Calculation of w_yj for real argument */
1771 test_wronskian(w_jy, lambda([n,z], 2.0/(z*%pi)), 1e-14, 10);
1775 /* Calculation of w_jy for complex argument */
1777 test_wronskian(lambda([n,z], w_jy(n,z*%i)), lambda([n,z],2.0/(z*%i*%pi)), 1e-8, 10);
1780 /*******************************************************************************
1784 A&S 9.6.14: I[n](z)*I[-(n+1)](z)-I[n+1](z)*I[-n](z) = -2*sin(n*pi)/(pi*z)
1786 *******************************************************************************/
1788 w_ii(n,z) := bessel_i(n,z)*bessel_i(-n-1,z) - bessel_i(n+1,z)*bessel_i(-n,z);
1789 w_ii(n,z) := bessel_i(n,z)*bessel_i(-n-1,z) - bessel_i(n+1,z)*bessel_i(-n,z);
1791 /* Calculation of w_ii for real argument */
1793 test_wronskian(w_ii, lambda([n,z],-2.0*sin(n*%pi)/(z*%pi)), 1e-10, 5);
1796 /* Calculation of w_ii for complex argument */
1798 test_wronskian(lambda([n,z], w_ii(n,z*%i)),
1799 lambda([n,z], -2.0*sin(n*%pi)/(z*%i*%pi)),
1803 /*******************************************************************************
1807 A&S 9.6.15: I[n](z)*K[n+1](z)+I[n+1](z)*K[n](z) = 1/z
1809 *******************************************************************************/
1811 w_ik(n,z) := bessel_i(n,z)*bessel_k(n+1,z) + bessel_i(n+1,z)*bessel_k(n,z);
1812 w_ik(n,z) := bessel_i(n,z)*bessel_k(n+1,z) + bessel_i(n+1,z)*bessel_k(n,z);
1814 /* Calculation of w_ik for real argument */
1816 test_wronskian(w_ik, lambda([n,z], 1/z), 1e-10, 5);
1819 /* Calculation of w_ik for complex argument */
1821 test_wronskian(lambda([n,z], w_ik(n,z*%i)), lambda([n,z], 1/(z*%i)), 1e-12, 5);
1824 /*******************************************************************************
1826 Test Wronskian w_h1h2
1828 A&S 9.1.17: H1[v+1](z)*H2[v](z)-H1[v](z)*H2[v+1](z) = -4*%i/(%pi*z)
1830 *******************************************************************************/
1832 w_h1h2(v,z) := hankel_1(v+1,z)*hankel_2(v,z) - hankel_1(v,z)*hankel_2(v+1,z);
1833 w_h1h2(v,z) := hankel_1(v+1,z)*hankel_2(v,z) - hankel_1(v,z)*hankel_2(v+1,z);
1835 /* Calculation of w_h1h2 for real argument */
1837 test_wronskian(w_h1h2, lambda([v,z], -4*%i/(%pi*z)), 1e-14, 5);
1840 /* Calculation of w_h1h2 for complex argument */
1842 test_wronskian(lambda([v,z], w_h1h2(v,z*%i)),
1843 lambda([v,z], -4/(%pi*z)),
1847 /* Calculation of w_h1h2 for complex order and argument */
1849 test_wronskian(lambda([v,z], w_h1h2(v*%i,z*%i)),
1850 lambda([v,z], -4/(%pi*z)),
1854 /******************************************************************************
1856 Integrals of Bessel functions
1858 *******************************************************************************/
1860 integrate(bessel_j(0,x),x);
1861 x*(bessel_j(0,x)*(2-%pi*struve_h(1,x))+%pi*bessel_j(1,x)*struve_h(0,x))/2;
1863 integrate(bessel_j(1,x),x);
1866 integrate(bessel_j(2,x),x);
1867 hypergeometric([3/2],[5/2,3],-x^2/4)*x^3/24;
1869 integrate(bessel_j(1/2,x),x);
1870 2^(3/2)*hypergeometric([3/4],[3/2,7/4],-x^2/4)*x^(3/2)/(3*sqrt(%pi));
1872 /* http://functions.wolfram.com/Bessel-TypeFunctions/BesselY/21/01/01/ */
1873 integrate(bessel_y(0,x),x);
1874 %pi*x*(bessel_y(1,x)*struve_h(0,x)+bessel_y(0,x)*struve_h(-1,x))/2;
1876 integrate(bessel_y(1,x),x);
1879 integrate(bessel_y(2,x),x);
1880 %pi*x*(bessel_y(1,x)*struve_h(0,x)+bessel_y(0,x)*struve_h(-1,x))/2-2*bessel_y(1,x);
1882 integrate(bessel_y(3,x),x);
1883 -2*bessel_y(2,x)-bessel_y(0,x);
1885 integrate(bessel_y(10,x),x);
1886 %pi*x*(bessel_y(1,x)*struve_h(0,x)+bessel_y(0,x)*struve_h(-1,x))/2
1887 -2*'sum(bessel_y(2*i+1,x),i,0,4);
1889 integrate(bessel_y(11,x),x);
1890 -2*'sum(bessel_y(2*i,x),i,1,5)-bessel_y(0,x);
1892 integrate(bessel_i(0,x),x);
1893 x*(bessel_i(0,x)*(%pi*struve_l(1,x)+2)-%pi*bessel_i(1,x)*struve_l(0,x))/2;
1895 integrate(bessel_i(1,x),x);
1898 integrate(bessel_i(2,x),x);
1899 hypergeometric([3/2],[5/2,3],x^2/4)*x^3/24;
1901 integrate(bessel_i(1/2,x),x);
1902 2^(3/2)*hypergeometric([3/4],[3/2,7/4],x^2/4)*x^(3/2)/(3*sqrt(%pi));
1904 /* http://functions.wolfram.com/Bessel-TypeFunctions/BesselK/21/01/01/ */
1905 integrate(bessel_k(0,x),x);
1906 %pi*x*(bessel_k(1,x)*struve_l(0,x)+bessel_k(0,x)*struve_l(-1,x))/2;
1908 integrate(bessel_k(1,x),x);
1911 integrate(bessel_k(7,x),x);
1912 2*(-bessel_k(6,x)+bessel_k(4,x)-bessel_k(2,x))+bessel_k(0,x);
1914 integrate(bessel_k(8,x),x);
1915 %pi*(struve_l(0,x)*bessel_k(1,x)+struve_l(-1,x)*bessel_k(0,x))*x/2
1916 +2*(-bessel_k(7,x)+bessel_k(5,x)-bessel_k(3,x)+bessel_k(1,x))$
1918 /******************************************************************************
1920 Check the handling of realpart and impagpart for special case
1921 of the order and arg of the Bessel functions.
1923 *******************************************************************************/
1925 /* Check for the Bessel J function */
1927 (f(n,x):=[realpart(bessel_j(n,x)),imagpart(bessel_j(n,x))],done);
1930 (declare(n,integer),assume(x>0),done);
1939 [bessel_j(n+1/2,x),0];
1941 [0,-%i*bessel_j(n+1/2,-x)];
1943 (declare(n_even,even),declare(n_odd,odd),%iargs:false,done);
1947 [bessel_j(n_even,%i),0];
1949 [0,-%i*bessel_j(n_odd,%i)];
1952 [bessel_j(n_even,x*%i),0];
1954 [0,-%i*bessel_j(n_odd,x*%i)];
1956 f(n_even,(x+1)^2*%i);
1957 [bessel_j(n_even,(x+1)^2*%i),0];
1958 f(n_odd,(x+1)^2*%i);
1959 [0,-%i*bessel_j(n_odd,(x+1)^2*%i)];
1961 (declare(j,imaginary),done);
1964 f(n_even,(x+1)^2*j);
1965 [bessel_j(n_even,(x+1)^2*j),0];
1967 [0,-%i*bessel_j(n_odd,(x+1)^2*j)];
1969 /* Check the handling of realpart and imagpart for the Bessel I function */
1971 (f(n,x):=[realpart(bessel_i(n,x)),imagpart(bessel_i(n,x))],done);
1980 [bessel_i(n+1/2,x),0];
1982 [0,-%i*bessel_i(n+1/2,-x)];
1985 [bessel_i(n_even,%i),0];
1987 [0,-%i*bessel_i(n_odd,%i)];
1990 [bessel_i(n_even,x*%i),0];
1992 [0,-%i*bessel_i(n_odd,x*%i)];
1994 f(n_even,(x+1)^2*%i);
1995 [bessel_i(n_even,(x+1)^2*%i),0];
1996 f(n_odd,(x+1)^2*%i);
1997 [0,-%i*bessel_i(n_odd,(x+1)^2*%i)];
1999 f(n_even,(x+1)^2*j);
2000 [bessel_i(n_even,(x+1)^2*j),0];
2002 [0,-%i*bessel_i(n_odd,(x+1)^2*j)];
2004 /* Check the handling of realpart and imagpart for the Bessel K function */
2006 (f(n,x):=[realpart(bessel_k(n,x)),imagpart(bessel_k(n,x))],done);
2012 [realpart(bessel_k(n,-x)),imagpart(bessel_k(n,-x))];
2015 [bessel_k(n+1/2,x),0];
2017 [0,-%i*bessel_k(n+1/2,-x)];
2020 [realpart(bessel_k(n_even,%i)),imagpart(bessel_k(n_even,%i))];
2022 [realpart(bessel_k(n_odd,%i)),imagpart(bessel_k(n_odd,%i))];
2025 /* Check the handling of realpart and imagpart for the Bessel Y function */
2027 (f(n,x):=[realpart(bessel_y(n,x)),imagpart(bessel_y(n,x))],done);
2033 [realpart(bessel_y(n,-x)),imagpart(bessel_y(n,-x))];
2036 [bessel_y(n+1/2,x),0];
2038 [0,-%i*bessel_y(n+1/2,-x)];
2041 [realpart(bessel_y(n_even,%i)),imagpart(bessel_y(n_even,%i))];
2043 [realpart(bessel_y(n_odd,%i)),imagpart(bessel_y(n_odd,%i))];
2045 /* %iargs is false, so transformation disabled */
2052 /* Set %iargs to true to enable transformation */
2053 (%iargs:true, bessel_j(v, %i*x));
2054 (%i*x)^v/x^v*bessel_i(v,x);
2057 (%i*x)^v/(x^v)*bessel_j(v, x);
2059 imagpart(bessel_j(2,%i*3.0));
2061 realpart(bessel_j(3,%i*3.0));
2064 imagpart(bessel_i(2,%i*3.0));
2066 realpart(bessel_i(3,%i*3.0));
2069 /*******************************************************/
2070 /* Check the handling of conjugate on Bessel functions */
2071 /*******************************************************/
2073 declare([w,z],complex,n,integer);
2075 assume(nonneg>=0,notequal(nonzero,0));
2076 [nonneg>=0,notequal(nonzero,0)];
2078 conjugate(bessel_j(w,z));
2079 '(conjugate(bessel_j(w,z)));
2081 conjugate(bessel_y(w,z));
2082 '(conjugate(bessel_y(w,z)));
2084 conjugate(bessel_i(w,z));
2085 '(conjugate(bessel_i(w,z)));
2087 conjugate(bessel_k(w,z));
2088 '(conjugate(bessel_k(w,z)));
2090 conjugate(hankel_1(w,z));
2091 '(conjugate(hankel_1(w,z)));
2093 conjugate(hankel_2(w,z));
2094 '(conjugate(hankel_2(w,z)));
2096 /* Bessel functions with arguments off of the negative real axis
2097 * commute with conjugate
2099 conjugate(bessel_j(z,x+%i*nonzero));
2100 '(bessel_j(conjugate(z),x-%i*nonzero));
2102 conjugate(bessel_j(z,nonneg));
2103 '(bessel_j(conjugate(z),nonneg));
2105 conjugate(bessel_y(z,x+%i*nonzero));
2106 '(bessel_y(conjugate(z),x-%i*nonzero));
2108 conjugate(bessel_y(z,nonneg));
2109 '(bessel_y(conjugate(z),nonneg));
2111 conjugate(bessel_i(z,x+%i*nonzero));
2112 '(bessel_i(conjugate(z),x-%i*nonzero));
2114 conjugate(bessel_i(z,nonneg));
2115 '(bessel_i(conjugate(z),nonneg));
2117 conjugate(bessel_k(z,x+%i*nonzero));
2118 '(bessel_k(conjugate(z),x-%i*nonzero));
2120 conjugate(bessel_k(z,nonneg));
2121 '(bessel_k(conjugate(z),nonneg));
2123 conjugate(hankel_1(z,x+%i*nonzero));
2124 '(hankel_2(conjugate(z),x-%i*nonzero));
2126 conjugate(hankel_1(z,nonneg));
2127 '(hankel_2(conjugate(z),nonneg));
2129 conjugate(hankel_2(z,x+%i*nonzero));
2130 '(hankel_1(conjugate(z),x-%i*nonzero));
2132 conjugate(hankel_2(z,nonneg));
2133 '(hankel_1(conjugate(z),nonneg));
2135 /* Bessel functions J and I of integral order commute with conjugate */
2136 conjugate(bessel_j(n,z));
2137 '(bessel_j(n,conjugate(z)));
2139 conjugate(bessel_i(n,z));
2140 '(bessel_i(n,conjugate(z)));
2142 remove([w,z],complex,n,integer);
2144 forget(nonneg>=0,notequal(nonzero,0));
2145 [nonneg>=0,notequal(nonzero,0)];