Bug report ID: 719832 - limit(exp(x*%i)*x, x, inf) should give infinity



We have the open bug report ID: 719832 - limit(exp(x*%i)*x,x,inf) should
give infinity.

Maxima knows the following limits:

(%i5) limit(exp(%i*x),x,inf);
(%o5) ind
(%i6) limit(x*ind,x,inf);
(%o6) infinity

But Maxima does not evaluate the reported example to infinity:

(%i7) limit(x*exp(%i*x),x,inf);
(%o7) und

In the routine simplimtimes we have code to check for an '$ind in a
product. For this case Maxima always returns the result '$und. We might
add code to check for the case '$ind*'$inf -> '$infinity:

...
  ((equal num 1)
   (setq sign ($csign prod))
   (return (cond ((and flag2 
                       (member flag '($inf $minf)))
                  ;; Check in addition the case ind*inf -> infinity.
                  '$infinity)
                 (flag2 '$und)
...

With this extension we will get the desired result for the example of
the bug report:

(%i1) limit(exp(%i*x)*x,x,inf);
(%o1) infinity

We get the same result for the following:

(%i2) limit(exp(-%i*x)*x,x,inf);
(%o2) infinity

And as a consequence:

(%i3) limit(sin(x)*x,x,inf);
(%o3) infinity

(%i4) limit(cos(x)*x,x,inf);
(%o4) infinity

Two integrals in rtestint.mac will get a problem:

********************** Problem 59 ***************
Input:
integrate(cos(9*x^(7/3)),x,0,inf)


Result:
Principal Value
0

This differed from the expected result:
3*gamma(3/7)*cos(3*%pi/14)/(7*9^(3/7))

********************** Problem 60 ***************
Input:
integrate(sin(9*x^(7/3)),x,0,inf)


Result:
'integrate(sin(9*x^(7/3)),x,0,inf)


The reason is, that Maxima no longer will get the limit '$und but
'$infinity in the routine limit-pole for the involved trig expressions,
e.g.

(%i2) limit(x*cos(9*x^2),x,inf);
(%o2) infinity

But the routine limit-pole does not handle the case '$infinity and
returns the default answer '$yes and not the expected result '$und. This
could be corrected in the routine limit-pole by adding the case
'$infinity with a result '$no:

(defun limit-pole (exp var limit direction)
  (let ((ans (cond ((member limit '($minf $inf) :test #'eq)
                    (cond ((eq (special-convergent-formp exp limit)
'$yes)
                           '$no)
                          (t (get-limit (m* exp var) var limit
direction))))
                   (t '$no))))
    (cond ((eq ans '$no)   '$no)
          ((null ans)   nil)
          ((eq ans '$und) '$no)
--->      ((eq ans '$infinity) '$no)
          ((equal ans 0.)   '$no)
          (t '$yes))))

I am not sure about the following two points:

1. Is it correct to return the result '$infinity for the limits of 
   products with the trig functions sin and cos, e.g. for 
   limit(x*cos(x),x,inf) -> infinity?

2. The routine limit-pole seems not to expect a result '$infinity.
   Is it correct in general to return the answer '$no for this case?

Dieter Kaiser