This happens for
limit ( (cos(1/x)-1) * sin(x), x, inf)
because $limit is somehow refactoring before it gets around to calling limit. Tracing shows:
(LIMIT
((MPLUS SIMP) ((MTIMES SIMP) -1 ((%SIN SIMP) $X))
((MTIMES SIMP) ((%COS SIMP) ((MEXPT SIMP) $X -1)) ((%SIN SIMP) $X)))
$X $INF THINK)
which then gets evaluated for each term in the plus, giving $ind - $ind = $ind.
The following call works:
(let ((lhp?))
(declare (special lhp?))
(limit #$(cos(1/x)-1) * sin(x)$ '$X '$INF 'THINK))
giving '$zerob.
I'm not sure if there's a canonical way to expand the right things in general though.
Rupert
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=588346
Strangely enough, limit even gets this wrong if you feed it the
factored form:
limit ( (cos(1/x)-1) * sin(x), x, inf)
even though it correctly gets
limit(cos(1/x)-1,x,inf) => 0
and
limit(sin(x),x,inf) => ind
and 0*ind is always 0.
On the other hand, it does get it right if you factor the
exponentialized form:
limit(factor(ev(...,exponentialize)),x,inf) => 0
This happens for
limit ( (cos(1/x)-1) * sin(x), x, inf)
because $limit is somehow refactoring before it gets around to calling limit. Tracing shows:
(LIMIT
((MPLUS SIMP) ((MTIMES SIMP) -1 ((%SIN SIMP) $X))
((MTIMES SIMP) ((%COS SIMP) ((MEXPT SIMP) $X -1)) ((%SIN SIMP) $X)))
$X $INF THINK)
which then gets evaluated for each term in the plus, giving $ind - $ind = $ind.
The following call works:
(let ((lhp?))
(declare (special lhp?))
(limit #$(cos(1/x)-1) * sin(x)$ '$X '$INF 'THINK))
giving '$zerob.
I'm not sure if there's a canonical way to expand the right things in general though.
Rupert
Fixed in limit.lisp revision 1.88.
Closing this bug report as fixed.
Dieter Kaiser