bessel_i (2, %i*x) or bessel_i(2, x) with integrate --> noun form



Oops...Maxima simplifies bessel_i(-2,x) --> bessel_i(2,x). So a = -2, isn't a special case
for integrate(bessel_i(a,x),x). The special case

 (%i7) integrate(bessel_i(0,x),x);
 (%o7) ((bessel_i(0,x)*(%pi*struve_l(1,x)+2)-%pi*struve_l(0,x)*bessel_i(1,x))*x)/2

is more complicated than using the hypergeometric representation, I think. Thus let's try

(defun bessel-i-integral (a z)
  "Integral of bessel_i(a,z) wrt z"
  (cond ((eq t (meqp a 1)) ;; integrate(bessel_i(1,z),z) = bessel_i(0,z)
	 (opcons '%bessel_i 0 z))

	;; integrate(bessel_i(a,z),z) = hypergeometric([(a+1)/2],[a+1,(a+3)/2],x^2/4)*x^(a+1))/(2^a*gamma(a+2))
	;; Maxima simplifies bessel_i(-2,z) --> bessel_(2,z), so a = -2 isn't a special case.
	(t
	 (mul
	  (opcons 'mexpt z (add a 1))
	  (opcons '$hypergeometric
		  (opcons 'mlist (div (add a 1) 2))
		  (opcons 'mlist (div (add a 3) 2) (add a 1))
		  (div (mul z z) 4))
	  (div 
	   1
	   (mul 
	    (opcons 'mexpt 2 a)
	    (opcons '%gamma (add a 2))))))))


--Barton