> -----Original Message-----
> From: drdieterkaiser at web.de [mailto:drdieterkaiser at web.de]
> Sent: Thursday, January 29, 2009 12:25 AM
> To: Schirmacher, Rolf
> Cc: maxima at math.utexas.edu
> Subject: RE: [Maxima] Bessel function with imaginary argument
>
> But even more interesting would be to implement more support for the
> complex characteristic of functions. I have done a implementation for
> the bessel_j function to show how it would work:
>
> (%i15) declare(n, integer, x,real, z,complex, j,imaginary);
> (%o15) done
> (%i16) realpart(bessel_j(n,x));
> (%o16) bessel_j(n, x)
> (%i17) impagpart(bessel_j(n,x));
> (%o17) impagpart(bessel_j(n, x))
> (%i18) realpart(bessel_j(n,z));
> (%o18) realpart(bessel_j(n, z))
> (%i19) imagpart(bessel_j(n,z));
> (%o19) imagpart(bessel_j(n, z))
> (%i20) realpart(bessel_j(n,j));
> (%o20) 0
> (%i21) imagpart(bessel_j(n,j));
> (%o21) bessel_j(n, j)
> (%i22) realpart(bessel_j(n,%i));
> (%o22) 0
> (%i23) imagpart(bessel_j(n,%i));
> (%o23) bessel_j(n, %i)
> (%i24) realpart(bessel_j(n,2*%i));
> (%o24) 0
> (%i25) imagpart(bessel_j(n,2*%i));
> (%o25) bessel_j(n, 2 %i)
>
> These are the results for your last example:
>
> (%i26) realpart(bessel_j(n,x*%i));
> (%o26) 0
> (%i27) imagpart(bessel_j(n,x*%i));
> (%o27) bessel_j(n, %i x)
>
I think the examples are correct for n = 1 (n odd? I did not check
thoroghly), but definitely not for n = 0 (n even?). (%o17) is 0 in this
case.
For n=0 (n even?), bessel_j(0,x) and bessel_j(0,j) are purely real (but
bessel_j(0,z) is not).
> That is the function risplit-bessel-j which is called from the routine
> risplit to give support for the realpart and imagpart of the bessel_j
> function. This can be generalized for every function.
>
> (defprop %bessel_j risplit-bessel-j risplit-function)
>
> (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)
> (cons 0 (list '(%bessel_j) order arg)))
> (t
> (cons (list '(%bessel_j) order arg) 0)))))
>
> This is the implemented call from risplit:
>
> ((setq func (get (mop l) 'risplit-function))
> ;; A risplit-function on the property list
> (funcall func (margs l)))
>
> In addition I have added the feature 'complex for the
> bessel_j function.
>
> Perhaps, this is a first step to support more complex
> characteristics of
> functions which could be easy generalized to much more functions.
>
> Remark: I have used the new function $csign to get the complex
> characteristic of the order and argument. This works fine also for
> expressions as an order or an argument.
>
> Dieter Kaiser
>
That looks really nice and I would strongly support it. Unfortunately, I am
not familiar with lisp neither with the structure of the sources, so I
guess, I will be of little help for an implementation.
Thanks,
Rolf Schirmacher