limit code



Hi all,

I think there is no check for the exponent being an integer in ratlim and/or friends.  If you checked for that you could 
eliminate some infinity's and get a signed inf or minf which would be better.

Rich



--------------------------------------------------------------------
Barton said.


I know little to nothing about the limit code; nevertheless, how about:

(setf (get '%signum 'simplim%function) 'simplim%signum)

(defun simplim%signum (e x pt)
  (let ((sgn))
    (setq e (limit (cadr e) x pt 'think))
    (setq sgn ($csign e))
   (cond ((eq sgn '$zero) '$ind)
          ((memq sgn '($neg $pn $pos))
           (take '(%signum) e)) ;; OK, this does sign(e) twice,...
          (t  (throw 'limit ())))))

Examples:

(%i2) limit(signum(x^2-3),x,5);
(%o2) 1

(%i3) limit(signum(x),x,a);
(%o3) 'limit(signum(x+a),x,0)

(%i4) assume(a > 0);
(%o4) [a > 0]

(%i5) limit(signum(x),x,a);
(%o5) 1

(%i6) limit(signum(x^3-1),x,inf);
(%o6) 1


(%i7) limit(signum(x^3-7),x,minf);
(%o7) -1

(%i8) limit(x * signum(x),x,0);
(%o8) 0

Barton