1 /* limits of log expressions */
9 limit(log(x),x,0,'minus);
12 limit(log(x),x,0,'plus);
18 limit(log(-2+%i*x),x,0);
21 limit(46*log(-2+%i*x),x,0);
24 limit(107+log(-2+%i*x),x,0);
27 limit(log(-2+%i*x),x,0,'minus);
30 limit(46*log(-2+%i*x),x,0,'minus);
33 limit(107+log(-2+%i*x),x,0,'minus);
34 107 + log(2) - %i*%pi$
36 limit(log(-2+%i*x),x,0,'plus);
39 limit(46*log(-2+%i*x),x,0,'plus);
42 limit(107+log(-2+%i*x),x,0,'plus);
43 107 + log(2) + %i*%pi$
45 /* #3831 limit(log((sqrt(x^2+1))/2),x,1) hangs related bugs */
46 limit(log((sqrt(x^2+1))/2),x,1,'minus);
49 limit(log((sqrt(x^2+1))/2),x,1,'plus);
52 limit(log((sqrt(x^2+1))/2),x,1);
55 limit(log((sqrt(x^4+1))/2),x,1,'minus);
58 limit(log((sqrt(x^4+1))/2),x,1,'plus);
61 limit(log((sqrt(x^4+1))/2),x,1);
64 block([logarc : true], integrate(1/sqrt(9+x^2),x,0,3));
67 block([logarc : false], integrate(1/sqrt(9+x^2),x,0,3));
70 limit(log((sqrt(x^2+9)+x)/3),x,1,'minus);
73 limit(log((sqrt(x^2+9)+x)/3),x,1,'plus);
76 limit(log((sqrt(x^2+9)+x)/3),x,1);
79 /* Tests associated with the fix to bug 3831 limit(log((sqrt(x^2+1))/2),x,1) hangs */
80 limit(log(x),x,1,'minus);
83 limit(log(x),x,1,'plus);
95 limit(log(x),x,0,'minus);
98 limit(log(x),x,0,'plus);
101 limit(log(signum(x)),x,0);
104 limit(log(107+sin(x)),x,inf);
107 /* far too complex result, but it's not the fault of simplimln */
108 limit(log((x-%i)/(x+%i)),x,2);
109 log((5*%i+10)/(11*%i+2))$
111 limit(log(-46 + %i*x),x,0,'minus);
114 limit(log(-46 + %i*x),x,0,'plus);
117 limit(log(-46 + %i*exp(x)),x,0);
120 limit(log(-46 + %i*(exp(x)-1)),x,0,'plus);
123 limit(log(-46 + %i*(exp(x)-1)),x,0,'minus);
126 limit(log(-46 + %i*(exp(x)-1)),x,0);
129 limit(log(-1 + %i*x*sin(1/x)),x,0,'minus);
132 limit(log(-1 + %i*signum(x)),x,0,'minus);
135 limit(log(-1 + %i*signum(x)),x,0,'plus);
138 limit(log(-1 + %i*signum(x)),x,0);
141 limit(log(-51 + %i* sin(x)), x, 0, 'plus);
144 limit(log(-51 + %i* sin(x)), x, 0, 'minus);
147 /* End of tests associated with the fix to bug 3831 */
149 /* #3844 Wrong limit involving gamma function */
150 limit(gamma(1/x) - x, x, 'inf);
153 limit(x*(gamma(1/x) - (x - %gamma)),x,inf);
154 (%pi^2+6*%gamma^2)/12$
156 limit(x^(3/2)*(gamma(1/x) - (x - %gamma)),x,inf);
159 limit(x^2*(gamma(1/x) - (x - %gamma + (6*%gamma^2+%pi^2)/(12*x))),x,inf);
160 -((4*zeta(3)+%gamma*%pi^2+2*%gamma^3)/12)$
162 /* #3846 limit gives quotient by zero error */
163 limit(gamma(1/x)/gamma(x),x,0,plus);
166 limit(gamma(x)/gamma(1/x),x,0,plus);
169 /* #3842 limit(atan(x),x,%i) --> error. That was determined to be a non-bug, but
170 here are two related limit problems. */
171 limit(atan(%i + x),x,0);
174 limit(atan(%i - x),x,0);
177 /* #3839 limits of asin expressions */
178 limit(asin(3+%i*x),x,0,plus);
181 limit(asin(3+%i*x),x,0,minus);
184 /* With the default value of lhospitallim, the calculation takes about 7 seconds.
185 Arguably, it's so slow, it's a bug. So we'll locally set lhospitallim to 1.*/
186 block([lhospitallim : 1], limit(rectform(asin(3+%i*x)),x,0,'plus));
187 %pi/2-(%i*log(17-3*2^(5/2)))/2$
189 block([lhospitallim : 1], limit(rectform(asin(3+%i*x)),x,0,'minus));
190 %pi/2-%i*log(2^(3/2)+3)$
192 /* #3838 limit(atan(sin(x)),x,inf,plus) --> atan(ind) */
193 limit(atan(sin(x)),x,inf,plus);
196 /* #3836 limit of a log expression with essential singularity */
197 limit(log(-2 + %i*x * sin(1/x)),x,0,plus);
200 /* #3824 limit of an antiderivative */
201 (xxx : integrate((x-%i)/((x-2*%i)*(x^2+1)),x),0);
204 limit(rectform(xxx),x,minf);
207 rectform(limit(xxx,x,minf));
210 /* #3816 limit of difference of logs */
211 (xxx : (%i*log(x^2+1))/6-(%i*log(x-2*%i))/3,0);
214 limit(rectform(xxx),x,minf,'plus);
217 rectform(limit(xxx,x,minf,'plus));
223 /* #3592 Wrong limit */
224 (declare(n,integer),assume(n > 0), 0);
227 limit((z^(2*n)-1)/(z^2-1),z,-1);
230 (remove(n,integer),forget(n > 0),0);
233 /* #3589 Stack overflow for a limit evaluation */
234 limit((sqrt(x)-2)*log(1-sqrt(x)/2),x,4,minus);
237 /* #3587 Wrong limit for logarithmic function */
238 limit(log(3-sqrt(x)),x,9,minus);
241 /* #3562 integrate(1/(1+tan(x)), x, 0, %pi/2) gives complex result, should be %pi/4 */
242 integrate(1/(1+tan(x)),x,0,%pi/2);
245 /* #3535 limit doesn't account for certain singularities in mexpt, log, gamma_incomplete, ... */
246 limit(log(%i*x - 1),x,0,minus);
249 limit(log(%i*x - 1),x,0,plus);
252 limit(rectform(log(%i*x - 1)),x,0,minus);
255 limit(rectform(log(%i*x - 1)),x,0,plus);
258 limit(sqrt((%i-x)^2),x,0,'minus);
261 limit(sqrt((%i-x)^2),x,0,'plus);
264 /* need tests for gamma_incomplete(1/2, %i*x - 1) */
266 /* #3534 integrate(x*exp(-x^2)*sin(x),x,minf,inf) gives zero */
267 integrate(x*exp(-x^2)*sin(x),x,minf,inf);
268 sqrt(%pi)/(2 * (%e)^(1/4))$
270 /* #3509 limits involving multiple non-finites sometimes give errors */
271 limit(1/(zeroa+zerob));
274 limit(1/(1/inf+1/minf));
277 limit(signum(zeroa+zerob));
280 /* #3483 limit apparently causes infinite loop
281 (X : log((sqrt(t)*sqrt(t+1)+t)/t)/(t+1)-(t*(log((t-sqrt(t)*sqrt(t+1))/t)-log((sqrt(t)*sqrt(t+1)+t)/t)))/(t+1)-log((t-sqrt(t)*sqrt(t+1))/t)/(t+1)-(2*sqrt(t))/sqrt(t+1),0);
284 limit(ratsimp(X),t,1);
285 log(sqrt(2)+1)-log(1-sqrt(2))-sqrt(2)$
289 log(sqrt(2)+1)-log(1-sqrt(2))-sqrt(2)$
296 /* #3459 Wrong limit calculation */
297 limit(x / (x+2^x+cos(x)),x,-inf);
300 /* #3415 limit doesn't check for zero coefficients in limit((a*x+1)/(a*x+2),x,inf) */
302 (assume(equal(a,0)),0);
305 limit((a*x+1)/(a*x+2),x,inf);
308 (forget(equal(a,0)),0);
311 /* #3393 limit/tlimit give wrong result */
312 limit(log(log(x + exp(log(x) * log(log(x))))) / log(log(log(exp(x) + x))), x, inf);
315 /* #3345 bug in limit -- hard to test--works OK with an assume on y*/
317 /* #3313 limit fails with domain complex --bad failure; commented out for now:
318 block([domain : 'complex], limit((x*(4/log(x))^(2*log(x)/log(log(x)))),x,inf));
321 /* #3279 limit incorrect with domain:complex */
322 block([domain : 'real], limit((2^(2*x+1)+(2^x*x^100)^(3/2))/(4^x-100*2^x),x,inf));
325 block([domain : 'complex], limit((2^(2*x+1)+(2^x*x^100)^(3/2))/(4^x-100*2^x),x,inf));
328 /* #3203 limit(floor(n*x),x,0) for n > 10^8 */
329 limit(floor((10^8 +1)*x),x,0,minus);
332 /* #3153 Limits of erfc
333 integrate(exp(-%i*ω^2*ρ^2-(%i*t^2)/(4*ρ^2)),ρ,0,inf);
334 1/sqrt(%i/%pi)*1/(2*ω)*exp(-%i*ω*abs(t))$ */
336 limit(erfc(x*(1 + %i)), x, inf);
339 /* #3143 limit((x^(1/x) - 1)*sqrt(x), x, 0, minus) => inf */
340 limit((x^(1/x) - 1)*sqrt(x), x, 0, minus);
343 /* #3142 limit((x^(1/x) - 1)*sqrt(x), x, inf) => inf */
344 limit((x^(1/x) - 1)*sqrt(x), x, inf);
347 /* #3140 limit((x^(1/x) - 1)*sqrt(x), x, 0, minus) + domain:complex => stack overflow */
348 block([domain : 'real], limit((x^(1/x) - 1)*sqrt(x), x, 0, minus));
352 block([domain : 'complex], limit((x^(1/x) - 1)*sqrt(x), x, 0, minus));
355 /* #3137 gruntz(abs(sin(x))/sqrt(1-cos(x)), x, 0, plus) => stack overflow */
356 limit(abs(sin(x))/sqrt(1-cos(x)), x, 0, plus);
359 gruntz(abs(sin(x))/sqrt(1-cos(x)), x, 0, plus);
362 /* #3136 gruntz(atan2(x^2 - 2, x^3 - 2*x), x, sqrt(2), minus) => atan2(0,0) undefined */
363 limit(atan2(x^2 - 2, x^3 - 2*x), x, sqrt(2), minus);
366 gruntz(atan2(x^2 - 2, x^3 - 2*x), x, sqrt(2), minus);
369 /* #3135 gruntz(atan2(x^2 - 2, x^3 - 3*x), x, sqrt(2), minus) incorrect */
370 limit(atan2(x^2 - 2, x^3 - 3*x), x, sqrt(2), minus);
373 gruntz(atan2(x^2 - 2, x^3 - 3*x), x, sqrt(2), minus);
376 /* #3280 gruntz incorrect limit */
377 gruntz((2^(2*x+1)+(2^x*x^100)^(3/2))/(4^x-100*2^x),x,inf);
380 /* #3055 limit(exp((log(log(x + exp(log(x)*log(log(x)))))) / (log(log(log(exp(x) + x + log(x)))))), x, inf) */
381 limit(exp((log(log(x + exp(log(x)*log(log(x)))))) / (log(log(log(exp(x) + x + log(x)))))), x, inf);
384 /* #3054 limit(exp(exp(2*log(x**5 + x)*log(log(x)))) / exp(exp(10*log(x)*log(log(x)))), x, inf) */
386 limit(exp(exp(2*log(x**5 + x)*log(log(x)))) / exp(exp(10*log(x)*log(log(x)))), x, inf)$
390 /* #3053 limit with branch cuts */
391 block([domain : 'real], limit(sqrt(-1 + %i*x), x, 0,minus));
394 block([domain : 'real], limit(sqrt(-1 - %i*x), x, 0,plus));
397 block([domain : 'complex], limit(sqrt(-1 + %i*x), x, 0,minus));
400 block([domain : 'complex], limit(sqrt(-1 - %i*x), x, 0,plus));
403 /*#3051 limit(2/5*((3/4)^m - 1)*(a - 10) + 1/5*(3*(3/4)^m + 2)*a, m, inf) with domain: complex */
404 block([domain : 'real],limit(2/5*((3/4)^m - 1)*(a - 10) + 1/5*(3*(3/4)^m + 2)*a, m, inf));
407 block([domain : 'complex],limit(2/5*((3/4)^m - 1)*(a - 10) + 1/5*(3*(3/4)^m + 2)*a, m, inf));
410 /* #3041 limit(inf*(zeroa+inf)) => und, should be inf */
411 limit(inf*(zeroa+inf));
414 /* #2972 Wrong limits involving logs */
415 limit( 27^(log(n)/log(3))/n^3, n, inf);
418 limit( 27^(log(n)/log(3)+1)/n^3, n, inf);
421 limit( ((27^(log(n)/log(3)+1)-1)/26+n-log(n)/log(3)-1)/n^3,n,inf);
424 /* #2953 limit loops endlessly */
425 limit((a/x^b + (1-a)/y^b)^(-1/b),b,0);
426 %e^(a*log(x)-(a-1)*log(y))$
428 /* #2899 Limit that once worked is broken */
429 limit((1+sqrt(n+1))^(-n-1)/(1+sqrt(n))^(-n),n,inf);
432 /* #2898 limit of continuous --> und */
433 (e : log(x)^2+2*%gamma*log(x)-%pi^2/6+%gamma^2,0);
437 -((%pi^2-6*%gamma^2)/6)$
442 /* #2877 Limits behave incorrectly when applied to derivatives */
443 (dg: diff(g(x), x),0);
446 (lim: limit(dg, x, 0),0);
449 (limit(lim, x, 0),0);
453 limit('diff(g(x),x,1),x,0)$
455 /* #2849 limit(ind*XXX) and limit(ind/XXX) gives errors rather than results */
456 map('limit, [ind*inf, inf/ind,ind*minf,minf/ind,ind*inf,ind/inf,ind*minf,ind/minf]);
457 [und,und,und,und,und,und,und,und]$
468 /* #2847 limits of powers of constants */
469 limit((1+%i)^n,n,inf);
472 limit((5+%i)^n,n,inf);
475 /*#2653 Bug for limit */
476 limit((atan(x)/x)^(1/(x^2)), x, 0);
479 /* #2388 wrong limit */
480 limit(((9*x)^(1/3)-3)/(sqrt(3+x)-sqrt(2*x)),x,3);
483 /* #2366 limit of gamma_incomplete */
484 limit(gamma_incomplete(sin(x),cos(x)),x,inf);
487 /* #2187 Inaccurate limit evaluation */
488 is(0 # limit(sin(x)/(x-a),x,0));
491 /* #1822 limit(inf+minf) should give und */
501 /* #1804 limit of x*floor(1/x) as x goes to 0 */
502 limit(x*floor(1/x),x,0);
505 /* #1743 limit of trig expression */
506 (e : (2*sin(x)*z+cos(x)*sin(2*x)-2*cos(x)^2*sin(x))/(z^2+(-sin(2*x)^2-4*sin(x)^2-cos(x)^2-1)*z+sin(2*x)^2-4*cos(x)*sin(x)*sin(2*x)+4*cos(x)^2*sin(x)^2),0);
510 (4*sin(x))/(cos(4*x)+3*cos(2*x)-8)$
512 (remvalue(e,dg,lim),0);
515 limit(atan2(sin(x),cos(x)),x,0);
518 limit(atan2(cos(x),sin(x)),x,0);
521 limit(atan2(cos(x),cos(x)),x,0);
524 limit(atan2(1/x^2,sin(1/x)),x,0);
527 limit(atan2(sin(x) + x, cos(x) + x),x,inf);
530 limit(atan2(sin(x) - x, cos(x) + x),x,inf);
533 limit(atan2(sin(x) - x, cos(x) - x),x,inf);
536 limit(atan2(sin(x) - x, cos(x) + x),x,inf);
539 limit(atan2(cos(x),x),x,inf);
542 limit(atan2(sin(x),x),x,minf);
545 limit(atan2(sin(x)/x,x),x,minf);
548 limit(atan2(exp(x),x),x,minf);
551 limit(atan2(-exp(x),x),x,minf);
554 /* #3794 assuming zerob < 0 & zeroa > 0 gives bugs for some limits */
555 limit(atan2(x^2-2,x^3-2*x),x,sqrt(2),minus);
558 (assume(zeroa > 0, zerob < 0),0);
561 limit(atan2(x^2-2,x^3-2*x),x,sqrt(2),minus);
564 (forget(zeroa > 0, zerob < 0),0);
567 /* #3866 limit(log(sinh(x)),x,0,'plus) --> infinity */
569 limit(log(sinh(x)),x,0,'plus);
572 limit(log(sinh(x)),x,0,'minus);
575 limit(log(sinh(x)),x,0);
578 /* unit_step expressions */
580 limit(unit_step(x),x,minf);
583 limit(unit_step(x),x,-%pi);
586 limit(unit_step(x),x,%pi);
589 limit(unit_step(x),x,0,'minus);
592 limit(unit_step(x),x,0,'plus);
595 limit(23*unit_step(x),x,0,'minus);
598 limit(23*unit_step(x),x,0,'plus);
601 limit(23*unit_step(x) + 107,x,0,'minus);
604 limit(23*unit_step(x) + 107,x,0,'plus);
607 limit(unit_step(sin(x)),x,0);
610 /* limits of conjugate expressions */
611 limit(conjugate(sqrt(-1+%i*sin(x))),x,0,'minus);
614 limit(conjugate(sqrt(-1+%i*sin(x))),x,0,'plus);
617 limit(conjugate(sqrt(-1+%i*sin(x))),x,0);
620 (assume(a > 0), limit(conjugate(sqrt(a+%i*sin(x))),x,0));
623 limit(conjugate(sqrt(-a+%i*sin(x))),x,0,'minus);
626 limit(conjugate(sqrt(-a+%i*sin(x))),x,0,'plus);
629 limit(107+93*conjugate(sqrt(-a+%i*sin(x))),x,0,'minus);
630 107 + 93*conjugate(sqrt(-a))$
632 limit(107+93*conjugate(sqrt(-a+%i*sin(x))),x,0,'plus);
633 107 + 93*conjugate(sqrt(-a))$
637 /* #3865 crash from taking limit of factorial(x) + 1 */
638 limit(factorial(x) + 1, x, 0);
641 limit(atan2(0,1-3^x),x,0,'plus);
644 limit(atan2(0,1-3^x),x,0);
647 /* additional atan tests */
651 limit(atan(x),x,0,minus);
654 limit(atan(x),x,0,plus);
657 limit(atan(x),x,-2.0);
660 block([fpprec : 32], float_approx_equal(limit(atan(x),x,bfloat(sqrt(2))), atan(bfloat(sqrt(2)))));
663 is(limit(atan(x),x,float(sqrt(2))) = atan(float(sqrt(2))));
666 limit(atan(sin(x)),x,inf);
669 limit(atan(x),x,minf);
672 limit(atan(x),x,inf);
675 limit(atan(x^2),x,inf);
678 limit(atan(1/x),x,0);
681 /* #3864 limit of atan2 expression */
682 limit(atan2(0,1-3^x),x,0,'minus);
686 limit((x^x-a^a)/(x-a), x, a);
689 limit((x^x-2^2)/(x-2), x, 2);
692 tlimit((x^x-a^a)/(x-a), x, a);
695 /* #3844 Wrong limit involving gamma function */
696 limit(gamma(1/x) - x, x, inf);
699 /* #3838 limit(atan(sin(x)),x,inf,plus) --> atan(ind) */
700 limit(atan(sin(x)),x,inf,plus);
703 /* #3483 limit apparently causes infinite loop */
704 (X : log((sqrt(t)*sqrt(t+1)+t)/t)/(t+1)-(t*(log((t-sqrt(t)*sqrt(t+1))/t)-log((sqrt(t)*sqrt(t+1)+t)/t)))/(t+1)-log((t-sqrt(t)*sqrt(t+1))/t)/(t+1)-(2*sqrt(t))/sqrt(t+1),0);
708 log(sqrt(2)+1)-log(1-sqrt(2))-sqrt(2)$
711 log(sqrt(2)+1)-log(1-sqrt(2))-sqrt(2)$
714 log(sqrt(2)+1)-log(1-sqrt(2))-sqrt(2)$
717 log(sqrt(2)+1)-log(1-sqrt(2))-sqrt(2)$
719 block([algebraic : true], limit(ratsimp(X),t,1));
720 log(sqrt(2)+1)-log(1-sqrt(2))-sqrt(2)$
725 /* #2953 limit loops endlessly */
726 limit((a/x^b + (1-a)/y^b)^(-1/b),b,0);
727 %e^(a*log(x)-(a-1)*log(y))$
729 /* #2706 Limit runs forever, never returning (simplified bug) */
730 block([ans1,ans2, ans3],
732 ans1 : limit((%e^(-sqrt(-zzz))*(w3*sqrt(-zzz)*%e^(2*sqrt(-zzz))-w3*sqrt(-zzz)))/(2*zzz),zzz,0),
735 ans2 : limit((%e^(-sqrt(-zzz))*(w3*sqrt(-zzz)*%e^(2*sqrt(-zzz))-w3*sqrt(-zzz)))/(2*zzz),zzz,0),
738 ans3 : limit((%e^(-sqrt(-zzz))*(w3*sqrt(-zzz)*%e^(2*sqrt(-zzz))-w3*sqrt(-zzz)))/(2*zzz),zzz,0),
743 /* #2388 wrong limit */
744 X : limit(((9*x)^(1/3)-3)/(sqrt(3+x)-sqrt(2*x)),x,3);
749 /* #3861 function simplimsubst problems */
750 limit(log(-1+%i*x) * ceiling(a),x,0,minus);
753 limit(log(-1+%i*x) * a,x,0,minus);
756 /* #484 limit(x=0,x,0) wrong */
757 is(equal(0=0, limit(x=0,x,0)));
760 is(equal(0<0, limit(x<0,x,0)));
763 is(equal(0#0, limit(x#0,x,0)));
769 block([ans],declare(z,complex), ans : limit(atan(x),x,z), remove(z,complex),ans);
772 limit(fib(x+1)/fib(x),x,inf);
775 limit(fib(x+2)/fib(x),x,inf);
778 /* #4029 limit(cos(1/x)^2 + sin(1/x)^2 + cos(x),x,0) --> ind */
779 limit(cos(1/x)^2 + sin(1/x)^2,x,0);
782 limit(cos(1/x)^2 + sin(1/x)^2 + cos(x),x,0);
785 block([ans], assume(a > 0),ans : limit(sin(x)^(a),x,inf),forget(a > 0), ans);
788 block([ans], assume(a > 0),ans : limit(sin(x)^(-a),x,inf),forget(a > 0), ans);
791 limit((2+sin(x))^(-9),x,inf);
794 limit((2+sin(x))^(9),x,inf);
797 /* #4099 gruntz called on algebraic */
798 gruntz(((9*x)^(1/3)-3)/(sqrt(3+x)-sqrt(2*x)),x,3,plus);
801 /* This bug is mentioned in the tlimit source code, but I don't think it's reported.*/
802 tlimit(2^n/n^5,n,inf);
805 /* #3927 tlimit(exp(x)/x^5,x,inf) = 0 */
806 tlimit(exp(x)/x^5,x,inf);
809 block([lhospitallim : 8], tlimit(exp(x)/x^5,x,inf));
812 block([lhospitallim : 1], tlimit(exp(x)/x^5,x,inf));
815 block([lhospitallim : 1], tlimit(exp(x)/x^46,x,inf));
818 block([lhospitallim : 1], tlimit(exp(x)/x^107,x,inf));
821 /* See #3932 inconsistent limit results with trig */
822 (QQ: (-rr*csc(rr)^2)+%pi*csc(rr)^2+cot(rr)-%pi/rr^2,0);
828 limit(trigsimp(QQ),rr,0);
831 limit(map('trigsimp,QQ),rr,0);
837 /* #3903 A limit toward infinity gives a nounform */
838 limit((sin(x)+x)/sqrt(x*(2*sin(x)+2*cos(x))+2*x^2+1),x,inf);
841 tlimit((sin(x)+x)/sqrt(x*(2*sin(x)+2*cos(x))+2*x^2+1),x,inf);
844 gruntz((sin(x)+x)/sqrt(x*(2*sin(x)+2*cos(x))+2*x^2+1),x,inf);
847 /* #3826 limit returns temp variable expression */
849 block([ans], assume(q > 0), ans : limit(x^q/(a*x^q- 1),x,inf), forget(q > 0),ans);
852 block([ans], assume(q > 0), ans : tlimit(x^q/(a*x^q- 1),x,inf), forget(q > 0),ans);
855 block([ans], assume(q > 0), ans : gruntz(x^q/(a*x^q- 1),x,inf), forget(q > 0),ans);
858 /* #3393 limit/tlimit give wrong result */
859 limit(log(log(x + exp(log(x) * log(log(x))))) / log(log(log(exp(x) + x))), x, inf);
862 tlimit(log(log(x + exp(log(x) * log(log(x))))) / log(log(log(exp(x) + x))), x, inf);
865 gruntz(log(log(x + exp(log(x) * log(log(x))))) / log(log(log(exp(x) + x))), x, inf);
868 /* #2561 limit(log(x^2),x,-20) gives 2*log(-20) */
869 block([logexpand : false], limit(log(x^2),x,-20));
872 block([logexpand : false], tlimit(log(x^2),x,-20));
875 block([logexpand : false], gruntz(log(x^2),x,-20,minus));
878 /* #2389 incorect limit
879 Commented out for now becuase it calls asksign when it should not
883 ans : limit(((t+1)^k-t^k-k*t^(k-1)-(k*(k-1)/2)*t^(k-2))/t^(k-3),t,inf),
889 /* #2273 limit gives the wrong answer
890 (This bug was fixed long ago, but I'm not sure there was a rtest for it.) */
891 limit((sqrt(t^2+4)*(((t+2/t^2)^2+4)^(3/2)-(t+2/t^2)^3-4*(t+2/t^2)))/
892 (sqrt((t+2/t^2)^2+4)*((t^2+4)^(3/2)-t^3-4*t)),t,inf);
895 tlimit((sqrt(t^2+4)*(((t+2/t^2)^2+4)^(3/2)-(t+2/t^2)^3-4*(t+2/t^2)))/
896 (sqrt((t+2/t^2)^2+4)*((t^2+4)^(3/2)-t^3-4*t)),t,inf);
899 gruntz((sqrt(t^2+4)*(((t+2/t^2)^2+4)^(3/2)-(t+2/t^2)^3-4*(t+2/t^2)))/
900 (sqrt((t+2/t^2)^2+4)*((t^2+4)^(3/2)-t^3-4*t)),t,inf);
903 /* #4109 Limits of polylogarithms */
904 limit(li[2](x)/log(-x)^2,x,inf);
907 limit(li[3](x)/log(-x)^3,x,inf);
910 limit(li[2](x),x,%e/2);
913 /* #4108 limit code & nondefault value of taylor_logexpand */
914 block([taylor_logexpand : false], limit((1/%pi*(atan(n/%pi)+%pi/2))^n,n,inf));
917 block([taylor_logexpand : true], limit((1/%pi*(atan(n/%pi)+%pi/2))^n,n,inf));
920 /* #4103 limit(acot(x),x,0) should be IND (not UND) */
924 /* #4087 limit((%i+1)^a/(2^(a/2)),a,inf) => 0 (wrong) */
925 limit((%i+1)^a*2^(-a/2),a,inf);
928 limit((%i+1)^(2*a)*2^-a,a,inf);
931 /* #4085 limit((2-%i)^a/a!,a,inf) */
932 errcatch(limit((2-%i)^a/a!,a,inf));
935 /* #4081 limit((2+sin(x))^(-2),x,inf) --> und */
936 limit((2+sin(x))^(-2),x,inf);
939 /* #4073 limit(log(sin(x)+9),x,inf) --> und could be ind */
940 limit(log(sin(x)+9),x,inf);
943 /*#4029 limit(cos(1/x)^2 + sin(1/x)^2 + cos(x),x,0) --> ind */
944 limit(cos(1/x)^2 + sin(1/x)^2,x,0);
947 limit(cos(1/x)^2 + sin(1/x)^2 + cos(x),x,0);
950 /* #4024 integrate(x*sin(x)*exp(-x^2),x,0, inf) */
951 integrate(x*sin(x)*exp(-x^2),x,minf, inf);
952 (%e^(-1/4)*sqrt(%pi))/2$
954 /* #4021 limit(inf^(2+1/inf)) should be inf */
955 limit(inf^(2+1/inf));
958 /* #4020 various limit bugs with exp(%i*x) */
959 limit(x*exp(%i*x),x,inf);
962 limit(x+x*exp(%i*x),x,inf);
965 limit(1+x*exp(%i*x),x,inf);
968 limit(sin(x) + x*cos(x),x,inf);
971 /* #4004 a cosine of arcsin limit that is evaluated incorrectly */
974 assume(equal(cos((4 * %pi * m + %pi)/2), 0)),
975 ans : limit(cos((4*m + 1) * asin(1/sqrt(x^2 + 1)))/abs(x), x, 0),
977 forget(equal(cos((4 * %pi * m + %pi)/2), 0)),
981 /* Also mentioned in #4004 */
984 ans : limit(a/x + 1, x, 0),
991 ans : limit(a*x + 1, x, inf),
998 ans : limit((2*x + a)/(x + a), x, 0),
1003 /* #4003 limit bug with on-default values for ratsimpexpons and ratfac */
1004 block([ratsimpexpons : true, ratfac : true],
1005 limit(2/5*((3/4)^m - 1)*(a - 10) + 1/5*(3*(3/4)^m + 2)*a, m, inf));
1008 /* #4001 limit(sin(x)/x + sin(x) + cos(x),x,inf) = 0 */
1009 limit(sin(x)/x + sin(x) + cos(x),x,inf);
1012 /* #4151 limit bug as x tend to inf for trigonometric expressions */
1013 limit((4*x^3+2*x^2*sin(x)+1)/(x+1)^2 - 4*x,x,inf);
1016 limit(expand((4*x^3+2*x^2*sin(x)+1)/(x+1)^2 - 4*x),x,inf);
1019 /* #4137 simplimplus bugs */
1020 limit(3^x * cos(x) + sin(x),x,inf);
1023 limit(3^x * cos(x) + 2^x,x,inf);
1026 errcatch(limit(3^x + (9+%i)^x,x,inf));
1029 /* See mailing list https://sourceforge.net/p/maxima/mailman/message/37868153/ */
1030 integrate(tan(x)^(1/3)/(cos(x)+sin(x))^2,x,0,%pi/2);
1031 %pi/(2*sqrt(3))+%pi/(2*3^(3/2))$
1033 /* #4147 integrate(log(sin(x))/cos(x),x,0,%pi/2) */
1034 integrate(log(sin(x))/cos(x),x,0,%pi/2);
1037 /* #4138 limit((1+1/x)^x,x,6/5) is "und" in complex domain */
1038 block([domain : 'complex], limit((1+1/x)^x,x,6/5));
1041 /* #4133 limit(abs(cos(a*x)),x,inf) */
1042 (assume(a < 0), ans : limit(abs(cos(a*x)),x,inf), forget(a < 0), ans);
1045 (assume(equal(a,0)), ans : limit(abs(cos(a*x)),x,inf), forget(equal(a,0)), ans);
1048 (assume(a > 0), ans : limit(abs(cos(a*x)),x,inf), forget(a > 0), ans);
1051 /* #4103 limit(acot(x),x,0) should be IND (not UND) */
1055 /* Did any facts, values, or contexts leak?*/