2 A collection of tests to stress $limit and friends
8 Tests to check how limit deals with weird combinations of
9 infinitesimals and infinities. See bug 2563
18 /* Tests from Bug 1036900 */
19 /* These bugs were fixed in limit.lisp rev 1.7, 2004/10/04 */
22 limit(7^(n^2)/8^n,n,inf);
24 limit((10^n+9^n+8^n)^(1/n),n,inf);
26 limit(4^n/2^(2*n),n,inf);
29 /* Test from Bug 1052308 */
30 /* Fixed in limit.lisp rev 1.11 */
33 limit(erf(nn*zz), nn, inf);
35 limit(tanh(nn*zz), nn, inf);
40 /* Bug 1281737, fixed in limit.lisp rev 1.15 */
41 limit(atan(x)/(1/exp(1)-exp(-(1+x)^2)),x,inf,plus);
45 limit(atan2(y,x),y,minf);
49 limit(abs(sqrt(1-1/x)-1),x,0);
53 limit(x*atan(x)/(x+1),x,inf);
55 limit(x*atan(x)-log(x),x,inf);
63 limit(sin(x)/x,x,0,plus);
65 limit(sin(x)/x,x,0,minus);
70 /* #2504 wrong answer for simple limit, limit(sin(x)+1/x, x, inf)=0 */
71 limit(1/x + sin(x), x, inf);
79 limit(t^2*exp(-4*t/3-8*exp(-t)),t,inf);
83 * From bug 535363, but this isn't really fixed. The fix for 1469411
84 * broke this test, so we're adding it to make sure we don't break it.
88 limit(exp(-1/x)/x^4,x,0,'plus);
92 limit(x*(atan(x)-%pi/2),x,inf);
95 limit((atan(x)-(%pi/2))/(sin(10/x)),x,inf);
98 /* [ 1498047 ] limit(a/n,n,inf); */
103 * [ 1646761 ] limit atanh @ -1 / 1 all wrong...
105 /* Limit at 1 is (complex) infinity). But one-sided limit can be inf (real infinity). */
108 limit(atanh(x),x,1,'minus);
110 limit(atanh(x),x,-1);
112 limit(atanh(x),x,-1,'plus);
115 /* There shouldn't be an error message printed out here. Need to look at output to see. */
116 limit(2*atanh(x),x,1);
118 limit(2*atanh(x),x,1,'minus);
121 limit(atanh(a-1)-log(a)/2,a,0,'plus),logarc:true;
124 /* [ 1606731 ] limit of algebraic when algebraic : true */
125 limit(x*(sqrt(1+x^2)-x),x,inf), algebraic : true, gcd : subres;
128 /* [ 1097982 ] limit(x/(x^(log(x)))); returns wrong answer */
129 limit(x/(x^log(x)), x, inf);
132 /* [ 1039965 ] limit(4^n/2^(2*n),n,inf) is wrong */
133 limit(4^n/2^(2*n),n,inf);
136 /* [ 1731127 ] limit((1 + 1/x)*(sqrt(x + 1) + 1), x, inf) => 0 (not inf) */
137 limit((1 + 1/x)*(sqrt(x + 1) + 1), x, inf);
140 /* [ 1593083 ] tlimit(t^2*exp(-4*t/3-8*exp(-t)),t,inf) gives error */
141 tlimit(t^2*exp(-4*t/3-8*exp(-t)),t,inf);
144 /* [ 1786774 ] tlimit((5^x + 3^x)^(1/x), x, inf) => Error */
145 tlimit((5^x + 3^x)^(1/x), x, inf);
148 /* [ 1603900 ] taylor/tlimit (4^n+1)/2^(2*n) internal error */
149 tlimit((4^n+1)/2^(2*n),n,inf);
152 /* [ 1281736 ] limit((x/log(x))*(x^(1/x)-1),x,inf) - wrong result */
153 limit((x/log(x))*(x^(1/x)-1),x,inf);
156 /* [ 1036901 ] tlimit(7^(n^2)/8^n,n,inf); wrong result */
157 tlimit(7^(n^2)/8^n, n, inf);
160 /* [ 1665657 ] limit fails to find easy limit */
161 limit(x/(x-1)-1/log(x),x,1,plus);
164 /* [ 611411 ] limit asks sign of IND */
165 limit(abs(sin(x)),x,inf);
168 /* [ 1629723 ] bug in limit, asks sign of IND, encountered in integrator */
169 limit(abs(sin(x))/x, x, inf);
172 /* [ 782099 ] limit returns expression in IND */
173 limit(sinh(exp(%i*x)),x,inf);
176 /* #3866 limit(log(sinh(x)),x,0,'plus) --> infinity */
177 limit(log(sinh(x)),x,0,'plus);
180 /* [ 1528607 ] limit(a^x,x,inf) can't solve for a : abs(a) < 1 */
181 limit((-2/3)^x,x,inf);
184 limit(signum(x), x, 0, plus);
187 limit(signum(x), x, 0, minus);
190 limit((-1/%pi)^x,x,inf);
193 tlimit(exp(%i*t), t, inf);
196 tlimit(exp(-t+%i*t),t,inf);
199 /* [ 1811503 ] computing a wrong result */
200 limit((((1+1/x)^(x^2))+1)^(1/x),x,inf);
203 /* [ 1760232 ] limit(1/n * n!^(1/n), n, inf); */
204 limit(1/n * n!^(1/n), n, inf);
207 /* #3681 limit(n^n/(n^n+(n-1)^n),n,inf) wrong */
208 limit(n^n/(n^n+(n-1)^n), n, inf);
211 /* #3682 limit(n^(n-1)/(n^n+(n-1)^n),n,inf) gives Lisp error */
212 limit(n^(n-1)/(n^n+(n-1)^n),n,inf);
215 /* Apparently wrong limit with factorial - ID: 3198530 */
216 limit(1/(2+1/factorial(n)),n,inf);
219 limit(t*(erf((t))-1),t,inf);
222 /* #3153 Limits of erfc */
223 limit(erfc(x*(1 + %i)), x, inf);
226 limit(erfc(x*(1 + %i)), x, minf);
229 limit(exp(x)*(sin(1/x+exp(-x))-sin(1/x+exp(-x^2))), x, inf);
232 /* it would be nice to handle this someday
233 limit(n - exp(psi[0](n)), n, inf);
237 limit(x*gamma(x), x, 0);
240 /* [ 744679 ] limit overflows memory? */
241 (assume(a>1), limit((a^(1/n)+1)^n/2^n, n, inf));
244 /* [ 702512 ] limit(1/(1/a*2^(%i*a)+1),a,inf) => UND */
245 limit(1/(1/a*2^(%i*a)+1),a,inf);
248 /* [ 923407 ] limit(atan(sqrt(x))/sqrt(x),x,0) wrong */
249 limit(atan(sqrt(x))/sqrt(x),x,0);
252 /* [ 1102908 ] limit/atan/exp returns complex expr with wrong principal val */
253 limit(atan(x)/(1/exp(1)-exp(-(1+x)^2)),x,inf,plus);
256 limit( (3^(1/x) + 5^(1/x))^x, x, 0, minus);
259 limit( (3^(1/x) + 5^(1/x))^x, x, 0, plus);
262 limit( (3^(1/x) + 5^(1/x))^x, x, 0);
265 /* [ 1852415 ] limit(sqrt(1-%e^(-x^2)), x, inf) = 0 */
266 limit(sqrt(1-%e^(-x^2)), x, inf);
269 /* [ 1515712 ] tlimit (x*atan(x)/(x+1),x,inf) => 3 %pi/2, etc */
270 tlimit(x*atan(x)/(x+1),x,inf);
273 tlimit(x*(atan(x)-%pi/2),x,inf);
276 tlimit(atan(x^-1), x, 0, minus);
279 /* [ 1973399 ] F(x) := 1/%pi*(atan(x) + %pi/2) */
280 (assume(c>0), limit(((1/%pi)*(atan(n/%pi) + %pi/2))^n, n, inf));
283 /* [ 1103515 ] limit(atan2(x,-1),x,0) wrong */
284 limit(atan2(x,-1), x, 0, minus);
287 limit(atan2(x,-1), x, 0, plus);
290 limit(atan2(x,-1), x, 0);
292 /* ideally should be ind */
294 /* limit of atan2 - ID: 3539699 */
295 limit(atan2(x^2-2,x^3-3*x), x, sqrt(2), minus);
298 limit(atan2(x^2-2,x^3-3*x), x, sqrt(2), plus);
301 limit(atan2((x^2-2), x^3-2*x), x, sqrt(2), minus);
304 limit(atan2((x^2-2), x^3-2*x), x, sqrt(2), plus);
307 limit(atan2(-(x^2-2), x^3-2*x), x, sqrt(2), minus);
310 limit(atan2(-(x^2-2), x^3-2*x), x, sqrt(2), plus);
313 /* #3864 limit of atan2 expression */
314 limit(atan2(0,1-3^x),x,0);
317 limit(floor(x), x, 5, minus);
320 limit(floor(x), x, 5, plus);
323 limit(ceiling(x), x, 5, minus);
326 limit(ceiling(x), x, 5, plus);
329 limit(round(x), x, 5/2, minus);
332 limit(round(x), x, 5/2, plus);
335 limit(floor(sin(x)), x, 0, minus);
338 /* #3616 limit with floor problems */
339 limit(floor(atan(x)),x,1);
342 limit(ceiling(cos(x)),x,0);
345 limit(floor(cos(x)),x,0);
348 limit(ceiling(cos(x)^2),x,0);
351 /* [ 2914296 ] Limit gets Maxima stuck */
352 /* caused blow-up in behavior-by-diff with loop up to 5th derivative */
353 limit( (log(1+x^2)-2+2*cos(x))/((sin(x))^2+2*sqrt(1-x^2)-2),x,0);
356 /* [ 1587235 ] limit(floor(x),x,1) wrong */
360 /* [ 1885377 ] wrong limit evaluation in 5.14.0 */
361 limit((3/4)^(5*n+1), n, inf);
364 limit(-%e^x/x, x, inf);
367 /* [ 2083561 ] Limit of the Wallis product */
368 limit((%pi*4^N*N!^2)/(2*2^(2*N)*gamma(N+1/2)*gamma(N+3/2)), N, inf);
371 /* wrong limit(log(gamma(x+1))/x,x,0) - ID: 2727078 */
372 limit(log(gamma(x+1))/x, x, 0);
375 /* log has a branch cut on negative real axis */
376 limit(log(-1+x*%i), x, 0, plus);
379 limit(log(-1+x*%i), x, 0, minus);
382 limit((log(y+h)-log(y))/h,h,0,plus);
386 limit(log(3-sqrt(x)),x,9,minus);
390 limit((sqrt(x)-2)*log(1-sqrt(x)/2),x,4,minus);
394 limit(log((sqrt(x^2+1))/2),x,1);
397 /* limit of incomplete gamma */
398 /* function simplim%gamma_incomplete in gamma.lisp */
400 /* sin(x^2)/(x^2) improper integral incorrect? - ID: 3397562 */
401 limit( gamma_incomplete(-1/2, -%i*x^2), x, inf);
404 /* should be complex infinity */
405 limit( gamma_incomplete(2, -%i*x), x, inf);
406 'limit(gamma_incomplete(2,-%i*x),x,inf);
408 /* Error integrating exp(-x)*sinh(sqrt(x)) with domain: complex - ID: 3529144 */
409 /* need taylor expansion of gamma_incomplete(1/2, x) at x=0 */
410 limit(gamma_incomplete(1/2,(1-2*sqrt(x))^2/4)*(1-2*sqrt(x))
411 /(sqrt((1-2*sqrt(x))^2)), x, 1/4, minus),domain:complex;
414 limit(gamma_incomplete(1/2,(1-2*sqrt(x))^2/4)*(1-2*sqrt(x))
415 /(sqrt((1-2*sqrt(x))^2)), x, 1/4, plus),domain:complex;
418 /* [ 635606 ] limit(abs(log(x))) internal error, UND */
419 limit(abs(log(x)), x, 0);
422 limit(exp(-x)*(x*sin(x)+cos(x)), x, inf);
425 /* tex(t[1]) shouldn't change t to true */
428 "; /* tex output contains embedded newline */
430 /* tex(x[1]^2) shouldn't get confused by debug info in expression CAR */
431 (foo : x[1]^2, tex (foo, false));
433 "; /* tex output contains embedded newline */
435 /* [ 2084910 ] limit bugs */
436 limit((%pi*N^(2*N+1)*2^(2*N))/((2*N-1)^(2*N)*(2*%e*N+%e)), N, inf);
439 /* [ 1977992 ] no limit calculation */
440 limit(abs(sin(x))/sqrt(1-cos(x)), x, 0);
443 /* [ 1973399 ] F(x) := 1/%pi*(atan(x) + %pi/2) */
444 /* only works with taylor_logexpand:true */
445 limit( ((1/%pi)*(atan(n/%pi) + %pi/2))^n, n, inf);
448 /* limit(x*expintegral_ei(x),x,0) --> Error - ID: 2801821 */
449 limit(x*expintegral_ei(x), x, 0);
452 /* #3865 crash from taking limit of factorial(x) + 1 */
453 limit(factorial(x) + 1, x, 0);
456 limit(1/(1-factorial(x)), x, 0, minus);
459 limit(1/(1-factorial(x)), x, 0, plus);
462 /* Limit of the factorial function - 4 problems - ID: 2841504 */
463 limit(factorial(x),x,-2,plus);
466 /* Calculus mistake: wrong answer: limit - ID: 3534858 */
467 limit((sin(x)-tan(x))/(x*(cos(x)-1)),x,0);
470 /* #2639 limit asks about internal variable */
471 limit(tan(x)/sqrt(tan(x)^2+1),x,%pi/2,plus);
474 limit(1/psi[1](x), x, inf);
477 /* limit of psi[i] - ID: 2843705 */
478 limit(psi[i](x),x,inf);
479 'limit(psi[i](x),x,inf);
481 /* tests for gruntz limit algorithm */
482 gruntz(exp(x), x, inf);
485 gruntz(exp(-x), x, inf);
488 gruntz( (x + 2^x) / 3^x, x, inf);
491 gruntz( x^2/(x + 2*x^2), x, inf);
494 gruntz( x/x^log(x), x, inf);
497 gruntz( (2^x)/(x + exp(x)) , x, 0, plus);
500 gruntz( (erf(x))/sqrt(1-cos(x)) , x, 0, minus);
501 -2*sqrt(2)/sqrt(%pi);
503 gruntz( (erf(x))/sqrt(1-cos(x)) , x, 0, plus);
506 gruntz( x*(x^(1/x)-1)/log(x), x, inf);
509 gruntz( (x*x^(1/x)-x)/log(x), x, inf);
512 gruntz(exp(-1/x)/x^6,x,0,plus);
515 /* limit gives the wrong answer - ID: 3410704 */
516 limit(sqrt(t^2+4)*(((t+2/t^2)^2+4)^(3/2)-(t+2/t^2)^3-4*(t+2/t^2))
517 /(sqrt((t+2/t^2)^2+4)*((t^2+4)^(3/2)-t^3-4*t)), t, inf);
520 /* Inaccurate Limit Evaluation - ID: 3276461 */
521 radcan(limit((-4*x^2-10*x+24)/((4*x+8)^(1/3)+2), x, -4));
524 limit(-(3*n^2 + 1)*(-1)^n/sqrt(n^5 + 8*n^3 + 8),n,inf);
528 * Bug ID: 1315837 limit(?foo)
529 * Bug ID: 1119228 limit(1/zeraoa)
544 * Bug ID: 1797296 - Crazy results when doing limit of 'diff
546 limit('diff(x+1,x),x,2);
549 limit('integrate(x+1,x),x,2);
552 /* #3767 incorrect limit (radius of convergence) */
553 limit(diff(exp(n * x), x,n)/n,n,inf);
554 'limit(diff(exp(n * x), x,n)/n,n,inf);
556 limit(integrate(f(t),t,0,x),x,0,plus);
559 limit(integrate(t,t,0,x)/x,x,inf);
562 (assume(a>2), limit(integrate(t/log(t),t,2,a)/a,a,inf));
565 /* limit(1/inf-1/minf) => 0+0 - ID: 903074 */
570 1-arg limit: limit(a*inf-inf) => minf - ID: 1385306
572 The original fix for this bug sent it to inf, assuming that the two
573 different "inf" occurrences were the same. I disagree: inf - inf
574 probably shouldn't ever be simplified to zero, but we can avoid it
580 /* limit(1 - (-1/2)^inf) --> inf - ID: 2853506 */
581 limit(1 - (-1/2)^inf);
583 /* ideally should be 1 */
585 /* definition of derivative in terms of limit */
586 limit((sin(3*(x+h)) - sin(3*(x)))/h, h, 0, plus);
589 /* limit incorrect for -x/sqrt(1-x^2) - ID: 2869955 */
590 limit(-x/sqrt(1-x^2), x, 1, minus);
593 /* limit(%i*log(a),a,0) nounform (%i*und problem) - ID: 816797 */
594 limit(%i*log(x),x,0);
597 /* limit(sqrt(x),x,minf) not fully evaluated - ID: 2901855 */
598 limit(sqrt(x), x, minf);
601 /* #2847 limits of powers of constants */
602 limit((5+%i)^n,n,inf);
605 /* limit bug - ID: 3101075 */
606 limit((2+cos(x))/(x^3*sin(x))-3/x^4,x,0,plus);
609 /* #2527 exponent too big in limit */
610 limit ((cosh(sqrt(x+1))-cosh(sqrt(x)))^(1/sqrt(x)),x,inf );
613 /* #2561 limit(log(x^2),x,-20) gives 2*log(-20) */
614 limit(log(x^2),x,-20),logexpand:false;
617 /* #2412 Problems with integral (x/(exp(x)+1),x,0,inf) */
618 limit(-x*log(%e^x+1)-li[2](-%e^x)+x^2/2, x, inf);
621 /* The initial problem which triggers this bug */
624 limit ((sin(n*x) - n*x*cos(n*x))/n^2, x, %pi);
627 /* #2503 Declaring x as an integer changes result of limit from 3 to inf */
628 limit((2^n+3^n)^(1/n), n,inf);
631 /* #2624 Erroneous limit result */
632 (assume(n>2), limit(x-x*(1-1/x)^n, x, inf));
638 /* Bug ID: 593351 - limit/sin(inf)etc. should give 0, not IND
640 limit(cos(1/x)*sin(x)-sin(x),x,inf);
642 limit(cos(1/x)*sin(x)-sin(x)+a,x,inf);
645 /* Bug ID: 1376392 - limit(x/(2+sin(1/x)), x, 0); wrong result
647 limit(x/(2+sin(1/x)),x,0);
650 /* #3680 limit(x/sin(1/x),x,0); wrong */
651 limit(x/sin(1/x), x, 0, plus);
654 /* Bug ID: 1106912 - limit(x/sin(x)^2,x,inf)
655 I think the limit is not defined because the func is not defined
656 for all x > any constant.
658 limit(x/sin(x)^2,x,inf);
661 /* Bug ID: #3459 Wrong limit calculation */
662 limit(x / (x+2^x+cos(x)),x,-inf);
665 /* Bug ID: 811522 - redundant question in limit
666 * b is assumed to be zero. Maxima now can deduce from the database
667 * that b-2 is an even number.
671 limit(r^(b-2)*(x-r)^2,r,0);
672 'limit(r^(b-2)*(x-r)^2,r,0);
676 /* Bug ID: 221642 limit needs %piargs to be true
677 * The implementation of simp-%atan and simpatan2 has been revised.
678 * We get more limits independent of the value of %piargs.
682 limit(atan2(0,y),y,0,plus);
684 limit(atan2(0,y),y,0,minus);
686 limit(atan2(x,0),x,0,plus);
688 limit(atan2(x,0),x,0,minus);
693 /* Bug ID: 3002971 - limit fails where rat+subst works
695 limit(min(x,x+2,sin(x)/x),x,0);
697 limit(max(x,x+2,sin(x)/x),x,0);
700 /* Bug ID: 1969790 - limits and subscripts
702 limit(mu[inf],x,inf);
706 * Bug 3509430: limit of tanh(x) at 0 makes no sense
708 limit(tanh(x), x, 0);
711 /* bug 2535: stack exhausted when computing limit(log(..)) */
713 limit(log(-1/3125*((-1/2*sqrt(5) + 1/2)^n - (1/2*sqrt(5) +
714 1/2)^n)^9*sqrt(5))/log(-1/5*((-1/2*sqrt(5) + 1/2)^(8*n) - (1/2*sqrt(5) +
715 1/2)^(8*n))*((-1/2*sqrt(5) + 1/2)^n - (1/2*sqrt(5) + 1/2)^n) -
716 1/5*((-1/2*sqrt(5) + 1/2)^(9*n) - (1/2*sqrt(5) +
717 1/2)^(9*n))*sqrt(5)),n,inf);
720 /* #2675 maxima will not do the simplest of definite integrals
721 and will not factor otherwise */
722 limit(x^2*exp(-%i*x - x), x, inf);
725 /* bug #2621 gamma limit error */
727 limit(gamma(x+1/2)/(sqrt(x)*gamma(x)), x, inf);
730 /* Triggered by #2849. This result isn't great, but it's better than
731 an error. A more useful result would be und. */
735 limit((a*exp(a*x)*sin(b*x))/(b^2+a^2)-(b*exp(a*x)*cos(b*x))/(b^2+a^2), x, 0, plus);
738 /* Bug #2898: limit of continuous --> und */
740 limit(log(x)^2+2*log(x)+q/2+1,x,1);
743 limit(log(x)^2+2*%gamma*log(x)-%pi^2/6+%gamma^2,x,1);
746 /* #2972 Wrong limits involving logs */
747 limit( 27^(log(n)/log(3))/n^3, n, inf);
750 limit( 27^(log(n)/log(3)+1)/n^3, n, inf);
753 limit( ((27^(log(n)/log(3)+1)-1)/26+n-log(n)/log(3)-1)/n^3,n,inf);
756 /* examples from mailing list 2014-10-10: "Re: bug in limit code" */
759 kill (beta, hbar, omega, delta, n),
760 assume (beta > 0, hbar > 0, omega > 0, delta > 0, 2*n - 1 > 0),
764 limit (%e^(beta*hbar*omega-beta*(hbar*(2*n+1)*omega+delta))
765 /(1/(1-%e^-(beta*hbar*omega))^2
766 +(%e^-(beta*delta)-1)/(1-%e^-(2*beta*hbar*omega))), beta, inf);
770 assume (h > 0, d > 0, z > 0, 2*h*z > d),
774 limit ((%e^-(b*d)-1)/(1-%e^-(2*b*h*z)), b, inf);
777 (kill (a), assume (a < 0), 0);
780 limit (exp (b*a), b, inf);
783 limit((exp(a*x)-1)/(exp(a*x)+1),x,inf) ;
786 (forget (a < 0), assume (a > 0), 0);
789 limit((exp(a*x)-1)/(exp(a*x)+1),x,inf) ;
792 (forget (a > 0), assume (equal (a, 0)), 0);
795 limit((exp(a*x)-1)/(exp(a*x)+1),x,inf) ;
798 (forget (equal (a, 0)), assume (a > 0), 0);
801 integrate(%e^(-a*r)*sin(k*r),r,0,inf);
807 (forget (a > 0), assume (a < 0), limit (a*x, x, inf));
810 (forget (a < 0), assume (equal (a, 0)), limit (a*x, x, inf));
813 killcontext (context);
816 /* SF bug #3104: "limit(log(1 - exp(x)), x, 0, plus), numer => stack overflow" */
818 limit(log(1 - exp(x)), x, 0, plus);
821 limit(log(1 - exp(x)), x, 0, plus), numer;
824 limit(log(1 + exp(x)), x, 0, plus);
827 limit(log(1 + exp(x)), x, 0, plus), numer;
830 /* inspired by this example from #3103; for the present purpose,
831 * it's not too important to get these specific results,
832 * only that numer doesn't cause an error here.
835 integrate(x^3/(exp(x)-1),x,0,inf);
836 'limit(6*li[4](%e^x)-6*x*li[3](%e^x)+3*x^2*li[2](%e^x)+x^3*log(1-%e^x)-x^4/4,
837 x,inf,minus) -%pi^4/15$
839 integrate(x^3/(exp(x)-1),x,0,inf), numer;
840 'limit(6.0*li[4](%e^x)-6.0*x*li[3](%e^x)+3.0*x^2*li[2](%e^x)
841 +1.0*x^3*log(1-%e^x)-0.25*x^4,x,inf,minus)
844 /* #3142 limit((x^(1/x) - 1)*sqrt(x), x, inf) => inf */
845 limit((x^(1/x) - 1)*sqrt(x), x, inf);
848 /* #3143 limit((x^(1/x) - 1)*sqrt(x), x, 0, minus) => inf */
849 /* should really be '$infinity */
850 limit((x^(1/x) - 1)*sqrt(x), x, 0, minus);
851 'limit((x^(1/x) - 1)*sqrt(x), x, 0, minus);
853 /* SF bug #3185: "Error in sum with non-false modulus" */
855 block([modulus:7], sum(i^-2,i,1,inf));
858 block([modulus:7], limit(inf));
861 /* SF bug #3235: "ECL lisp arithmetic error in definite integration with large limits"
862 * the bug is actually in ECL (https://gitlab.com/embeddable-common-lisp/ecl/issues/299);
863 * here we'll test a work around.
866 block ([actual, expected],
867 actual : limit(x*exp(x)*log(exp(x)+1),x,-1000,plus),
868 expected : -1000*%e^-1000*log(%e^-1000*(%e^1000+1)),
869 if ev (equal (actual, expected), logexpand='super) then true else [actual, expected]);
872 /* accommodate different equivalent forms via 'equal' */
873 block ([actual, expected],
874 actual : integrate((x^2)*exp(x) / (1 + exp(x))^2,x,-1000,1000),
875 expected : (-(2000*%e^1000*log(%e^-1000*(%e^1000+1)))/(%e^1000+1))
876 -(2000*log(%e^-1000*(%e^1000+1)))/(%e^1000+1)
877 -((2000*%e^1000+2000)*log(%e^1000+1)
878 +(2*%e^1000+2)*li[2](-%e^1000)-1000000*%e^1000)
879 /(%e^1000+1)+(2*%e^1000*li[2](-%e^-1000))/(%e^1000+1)
880 +(2*li[2](-%e^-1000))/(%e^1000+1)-1000000/(%e^1000+1),
881 if ev (equal (actual, expected), logexpand='super) then true else [actual, expected]);
884 /* SF bug #3244: "error trying to promote float infinity to bigfloat in sign comparison"
885 * same as test under #3235 but ensure that bigfloat assume is present to trigger bug
888 block ([actual, expected, ctxt:newcontext()],
889 assume (xfoo > 200b0),
890 actual : limit(xfoo*exp(xfoo)*log(exp(xfoo)+1),xfoo,-1000,plus),
891 expected : -1000*%e^-1000*log(%e^-1000*(%e^1000+1)),
893 if ev (equal (actual, expected), logexpand='super) then true else [actual, expected]);
896 /* SF bug #3826: "limit returns temp variable expression" */
901 limit(x^q/(a*x^q- 1),x,inf));
902 'limit(x^q/(a*x^q- 1),x,inf);
904 tlimit(x^q/(a*x^q- 1),x,inf);
905 'limit(x^q/(a*x^q- 1),x,inf);
908 declare (q, integer),
909 limit(x^q/(a*x^q- 1),x,inf));
912 (remove (q, integer),
913 declare (q, noninteger),
914 limit(x^q/(a*x^q- 1),x,inf));
917 (remove (q, noninteger),