I tested a general implementation of a sign-function for the zeta function.
This would be the code which we have to add to the Lisp function sign in
compar.lisp:
((setq func (get (mop x) 'sign-function))
(funcall func (margs x)))
This would be the code of a sign-function for the zeta function (Only the global
variable sign has been used. We pass the arguments as a list.)
;;; Zeta has a sign function
(defprop $zeta sign-zeta sign-function)
;;; The implementation of a sign-function
;;; This function is called by $sign to get the sign of the zeta-function
;; for real x, zeta(x) has
;; trivial negative even roots
;; and a pole at x=1
(defun sign-zeta (x) ; we pass the arguments as a list
(let ((arg (car x)))
(cond
((eq (mgqp arg 1) t) (setq sign '$pos))
((eq (mgqp arg 0) t) (setq sign '$neg))
((eq (mgrp 0 arg) t)
(if (integerp arg)
(let ((m (mod arg 4)))
(cond
((= m 3) (setq sign '$neg))
((= m 1) (setq sign '$pos))
(t (setq sign '$zero))))
(let ((fl (take '($floor) arg)))
(if (integerp fl)
(if (= (mod (if (evenp fl) fl (1- fl)) 4) 0)
(setq sign '$pos)
(setq sign '$neg))
(setq sign '$pnz)))))
(t (setq sign '$pnz)))))
This works generally. More functions could be added with this method.
Now the results for the given examples:
(%i47) sign(zeta(0));
(%o47) neg
(%i48) sign(zeta(23));
(%o48) pos
(%i49) sign(zeta(5/6));
(%o49) neg
(%i50) sign(zeta(-5/2));
(%o50) pos
(%i51) sign(zeta(%pi));
(%o51) pos
(%i52) sign(zeta(23*%i));
(%o52) pnz
(%i53) sign(zeta(x));
(%o53) pnz
Some results with an expression as argument:
(%i54) sign(zeta(2*%pi+10));
(%o54) pos
(%i55) sign(zeta(sqrt(2*%pi+10)));
(%o55) pos
(%i56) sign(zeta(sqrt(2*%pi-10)));
(%o56) pnz
Some results with expressions which involve zeta:
(%i61) sign(sqrt(2*%pi*zeta(-5/2)));
(%o61) pos
The expression is imaginary. $sign can not handle it:
(%i60) sign(sqrt(2*%pi*zeta(5/6)));
`sign' called on an imaginary argument:
%i
-- an error. To debug this try debugmode(true);
With the function csign we get the correct result:
(%i64) csign(sqrt(2*%pi*zeta(5/6)));
(%o64) imaginary
I think it would be nice to have more support for the sign of functions. The
functions sign-zeta should perhaps not be added to the file compar.lisp, but to
the file combin.lisp. In this file $zeta is defined.
Dieter Kaiser