Am Mittwoch, den 28.01.2009, 11:03 +0100 schrieb Schirmacher, Rolf:
> Somehow, I get different results. With a freshly started Maxima session, I
> obtain
>
> (%i1) facts(bessel_j);
> (%o1) []
> (%i2) realpart(bessel_j(1,%i));
> (%o2) bessel_j(1,%i)
> (%i3) imagpart(bessel_j(1,%i));
> (%o3) 0
> (%i4) declare(bessel_j,complex);
> (%o4) done
> (%i5) facts(bessel_j);
> (%o5) [kind(bessel_j,complex)]
> (%i6) realpart(bessel_j(1,%i));
> (%o6) bessel_j(1,%i)
> (%i7) imagpart(bessel_j(1,%i));
> (%o7) 0
In the past I have got a similar problem with a symbol declared to be
complex. I think we have a bug. I got the problem with GCL on windows.
At the moment I am working on a Linux system with CLISP and I have no
problems.
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)
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