# [Maxima] Bessel function with imaginary argument

Dieter Kaiser drdieterkaiser at web.de
Thu Jan 29 17:06:34 CST 2009

```Am Donnerstag, den 29.01.2009, 09:21 +0100 schrieb Schirmacher, Rolf:

A second attempt. I have tried to do it more complete:

(%i2) f(n,x):=[realpart(bessel_j(n,x)),imagpart(bessel_j(n,x))]\$

We start with n an integer and the argument is real and positive:

(%i3) declare(n,integer)\$
(%i4) assume(x > 0)\$

(%i5) f(n,x)
(%o5) [bessel_j(n,x),0]  /* list is [realpart,imagpart] */
(%i6) f(n,-x)
(%o6) [bessel_j(n,-x),0]

Half integral values work symbolically:

(%i7) f(1/2+n,x)
(%o7) [bessel_j(n+1/2,x),0]
(%i8) f(1/2+n,-x)
(%o8) [0,bessel_j(n+1/2,-x)]

Argument is imaginary and order an even or odd integer:

(%i9) declare(n_even,even)\$
(%i10) declare(n_odd,odd)\$

(%i11) f(n_even,%i)
(%o11) [bessel_j(n_even,%i),0]
(%i12) f(n_odd,%i)
(%o12) [0,bessel_j(n_odd,%i)]

This works for more general imaginary arguments too:

(%i25) f(n_even,x*%i)
(%o25) [bessel_j(n_even,%i*x),0]
(%i26) f(n_odd,x*%i)
(%o26) [0,bessel_j(n_odd,%i*x)]
(%i27) f(n_even,(1+x)^2*%i)
(%o27) [bessel_j(n_even,%i*(x+1)^2),0]
(%i28) f(n_odd,(1+x)^2*%i)
(%o28) [0,bessel_j(n_odd,%i*(x+1)^2)]

And for symbols declared to be imaginary:

(%i29) declare(j,imaginary)\$

(%i30) f(n_even,(1+x)^2*j)
(%o30) [bessel_j(n_even,j*(x+1)^2),0]
(%i31) f(n_odd,(1+x)^2*j)
(%o31) [0,bessel_j(n_odd,j*(x+1)^2)]

This the new routine risplit-bessel-j:

(defun risplit-bessel-j (args)
(let ((order (car  args))
(arg   (cadr args))
(sign-order (\$csign (car args)))
(sign-arg   (\$csign (cadr args))))
(cond
((or (member sign-order '(\$complex \$imaginary))
(eq sign-arg '\$complex))
(risplit-noun (list '(%bessel_j) order arg)))
((eq sign-arg '\$imaginary)
(cond
((or (\$oddp  order)
(\$featurep order '\$odd)) /* oddp don't check facts */
(cons 0 (list '(%bessel_j) order arg)))
((or (\$evenp order)
(\$featurep order '\$even)) /* evenp don't check facts */
(cons (list '(%bessel_j) order arg) 0))
(t (risplit-noun (list '(%bessel_j) order arg)))))
;; At this point order and arg are real valued.
;; We have to look for some special cases involving a negative arg
((or (maxima-integerp order)
(member sign-arg '(\$pos \$pz)))
;; arg is positive or order an integer, real valued.
(cons (list '(%bessel_j) order arg) 0))
;; The sign of arg is negative or not known
((zerop1 (sub (\$truncate (\$multthru 2 order))
(\$multthru 2 order)))
;; order is half integral
(cond
((eq sign-arg '\$neg)
(cons 0 (list '(%bessel_j) order arg)))
(t
;; the sign of arg is not known
(risplit-noun (list '(%bessel_j) order arg)))))
(t
;; the sign of arg is not known
(risplit-noun (list '(%bessel_j) order arg))))))

If it is of general interest to have more support for the realpart and
imagpart of a function like bessel_j I could commit the extension.

Dieter Kaiser

```

More information about the Maxima mailing list