2 These tests are translated to Maxima from the SymPy tests. The orginal source is
\r
3 https://github.com/sympy/sympy/blob/master/sympy/series/tests/test_gruntz.py
\r
5 Translation errors are, of course, possible, and all such errors are mine.
\r
6 I thank the SymPy developers for making this resource available.
\r
8 Copyright (c) 2006-2023 SymPy Development Team
\r
10 All rights reserved.
\r
12 Redistribution and use in source and binary forms, with or without
\r
13 modification, are permitted provided that the following conditions are met:
\r
15 a. Redistributions of source code must retain the above copyright notice,
\r
16 this list of conditions and the following disclaimer.
\r
17 b. Redistributions in binary form must reproduce the above copyright
\r
18 notice, this list of conditions and the following disclaimer in the
\r
19 documentation and/or other materials provided with the distribution.
\r
20 c. Neither the name of SymPy nor the names of its contributors
\r
21 may be used to endorse or promote products derived from this software
\r
22 without specific prior written permission.
\r
25 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
\r
26 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
27 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
\r
28 ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
\r
29 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
30 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
\r
31 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
\r
32 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
\r
33 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
\r
34 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
\r
38 /* Let's tidy our workspace. If you want to run this testsuite with a nondefault
\r
39 value for an option variable, say algebraic, you'll need to remove the reset command*/
\r
40 (map('remvalue, values), map('forget, facts()), map('killcontext, contexts), reset(),0);
\r
43 /* The notorious Bug #3054--running this test multiple times gives an error.
\r
44 Let's try it five times */
\r
46 block([xxx : exp(exp(2*log(x^5 + x)*log(log(x)))) / exp(exp(10*log(x)*log(log(x))))],
\r
47 [limit(xxx,x,inf), limit(xxx,x,inf), limit(xxx,x,inf), limit(xxx,x,inf),limit(xxx,x,inf)]);
\r
48 [inf,inf,inf,inf,inf]$
\r
51 limit(exp(x)*(exp(1/x - exp(-x)) - exp(1/x)), x, inf);
\r
54 limit(exp(x)*(exp(1/x + exp(-x) + exp(-x^2))- exp(1/x - exp(-exp(x)))), x, inf);
\r
57 limit(exp(exp(x - exp(-x))/(1 - 1/x)) - exp(exp(x)), x, inf);
\r
60 limit(exp(exp(exp(x + exp(-x)))) / exp(exp(exp(x))), x, inf);
\r
63 limit(exp(exp(exp(x))) / exp(exp(exp(x - exp(-exp(x))))), x, inf);
\r
66 limit(exp(exp(exp(x))) / exp(exp(exp(x - exp(-exp(exp(x)))))), x, inf);
\r
69 limit(exp(exp(x)) / exp(exp(x - exp(-exp(exp(x))))), x, inf);
\r
72 limit(log(x)^2*exp(sqrt(log(x))*(log(log(x)))^2
\r
73 *exp(sqrt(log(log(x)))*(log(log(log(x))))^3))/sqrt(x),x, inf);
\r
76 limit((x*log(x)*(log(x*exp(x) - x^2))^2)/(log(log(x^2 + 2*exp(exp(3*x^3*log(x)))))), x, inf);
\r
79 limit((exp(x*exp(-x)/(exp(-x) + exp(-2*x^2/(x + 1)))) - exp(x))/x,x, inf);
\r
82 limit((3^x + 5^x)^(1/x), x, inf);
\r
85 limit(x/log(x^(log(x^(log(2)/log(x))))), x, inf);
\r
88 limit(exp(exp(2*log(x^5 + x)*log(log(x)))) / exp(exp(10*log(x)*log(log(x)))), x, inf);
\r
91 block([factor_max_degree : 64000],
\r
92 limit(%e^(8*%e^((54*x^(49/45))/17+(21*x^(6/11))/8+5/(2*x^(5/7))+2/x^8))/log(log(-log(4/(3*x^(5/14)))))^(7/6),x,inf));
\r
95 limit((exp(4*x*exp(-x)/(1/exp(x) + 1/exp(2*x^2/(x + 1)))) - exp(x))/ exp(x)^4, x, inf);
\r
98 limit(exp(x*exp(-x)/(exp(-x) + exp(-2*x^2/(x + 1))))/exp(x), x, inf);
\r
101 limit(log(x)*(log(log(x) + log(log(x))) - log(log(x))) / (log(log(x) + log(log(log(x))))), x, inf);
\r
105 limit(exp((log(log(x + exp(log(x)*log(log(x))))))/(log(log(log(exp(x) + x + log(x)))))), x, inf);
\r
108 limit(exp(exp(exp(x + exp(-x))))/exp(exp(x)), x, inf);
\r
111 limit(exp(exp(exp(x)/(1 - 1/x))) - exp(exp(exp(x)/(1 - 1/x - log(x)^(-log(x))))), x, inf);
\r
114 limit((exp(exp(-x/(1 + exp(-x))))*exp(-x/(1 + exp(-x/(1 + exp(-x)))))*exp(exp(-x + exp(-x/(1 + exp(-x))))))
\r
115 /(exp(-x/(1 + exp(-x))))^2 - exp(x) + x, x, inf);
\r
118 limit(exp(x)*(sin(1/x + exp(-x)) - sin(1/x + exp(-x^2))), x, inf);
\r
121 limit((erf(x - exp(-exp(x))) - erf(x)) * exp(exp(x)) * exp(x^2), x, inf);
\r
124 limit(exp(exp(x)) * (exp(sin(1/x + exp(-exp(x)))) - exp(sin(1/x))),x, inf);
\r
127 limit(exp(x)*(gamma(x + exp(-x)) - gamma(x)), x, inf);
\r
130 limit(exp(exp(psi[0](psi[0](x))))/x, x, inf);
\r
133 limit(exp(exp(psi[0](log(x))))/x, x, inf);
\r
136 limit(psi[0](psi[0](psi[0](x))), x, inf);
\r
139 limit(log_gamma(log_gamma(x)), x, inf);
\r
142 limit(((gamma(x + 1/gamma(x)) - gamma(x))/log(x) - cos(1/x))* x*log(x), x, inf);
\r
145 limit(x * (gamma(x - 1/gamma(x)) - gamma(x) + log(x)), x, inf);
\r
148 limit((gamma(x + 1/gamma(x)) - gamma(x)) / log(x), x, inf);
\r
151 limit(gamma(x + 1)/sqrt(2*%pi)- exp(-x)*(x^(x + 1/2) + x^(x - 1/2/12)), x, inf);
\r
154 limit(exp(exp(exp(psi[0](psi[0](psi[0](x))))))/x, x, inf);
\r
157 limit(exp(gamma(x - exp(-x))*exp(1/x)) - exp(gamma(x)), x, inf);
\r
160 limit((expintegral_ei(x - exp(-exp(x))) - expintegral_ei(x)) *exp(-x)*exp(exp(x))*x, x, inf);
\r
163 limit(exp((log(2) + 1)*x) * (zeta(x + exp(-x)) - zeta(x)), x, inf);
\r
166 limit(cosh(x), x, inf);
\r
169 limit(cosh(x), x, minf);
\r
172 limit(sinh(x), x, inf);
\r
175 limit(sinh(x), x, minf);
\r
178 limit(2*cosh(x)*exp(x), x, inf);
\r
181 limit(2*cosh(x)*exp(x), x, minf);
\r
184 limit(2*sinh(x)*exp(x), x, inf);
\r
187 limit(2*sinh(x)*exp(x), x, minf);
\r
190 limit(tanh(x), x, inf);
\r
193 limit(tanh(x), x, minf);
\r
196 limit(coth(x), x, inf);
\r
199 limit(coth(x), x, minf);
\r
211 limit(x^2, x, minf);
\r
214 limit(-x^2, x, inf);
\r
217 limit(x*log(x), x, 0, plus);
\r
220 limit(1/x, x, inf);
\r
223 limit(exp(x), x, inf);
\r
226 limit(-exp(x), x, inf);
\r
229 limit(exp(x)/x, x, inf);
\r
232 limit(1/x - exp(-x), x, inf);
\r
235 limit(x + 1/x, x, inf);
\r
238 limit(x^x, x, 0, 'plus);
\r
241 limit((exp(x) - 1)/x, x, 0,'plus);
\r
244 limit(1 + 1/x, x, inf);
\r
247 limit(-exp(1/x), x, inf);
\r
250 limit(x + exp(-x), x, inf);
\r
253 limit(x + exp(-x^2), x, inf);
\r
256 limit(x + exp(-exp(x)), x, inf);
\r
259 limit(13 + 1/x - exp(-x), x, inf);
\r
262 limit(x - log(1 + exp(x)), x, inf);
\r
265 limit(x - log(a + exp(x)), x, inf);
\r
268 limit(exp(x)/(1 + exp(x)), x, inf);
\r
271 limit(exp(x)/(a + exp(x)), x, inf);
\r
274 limit((3^x + 5^x)^(1/x), x, inf);
\r
277 limit((3^(1/x) + 5^(1/x))^x, x, 0, 'plus);
\r
280 limit((x + 1)^(1/log(x + 1)), x, inf);
\r
283 limit(1/gamma(x), x, inf);
\r
286 limit(1/log_gamma(x), x, inf);
\r
289 limit(gamma(x)/log_gamma(x), x, inf);
\r
292 limit(exp(gamma(x))/gamma(x), x, inf);
\r
295 limit(gamma(x), x, 3,'plus);
\r
298 limit(gamma(1/7 + 1/x), x, inf);
\r
301 limit(log(x^x)/log(gamma(x)), x, inf);
\r
304 limit(log(gamma(gamma(x)))/exp(x), x, inf);
\r
307 limit(1/log(atan(x)), x, inf);
\r
310 limit(1/acot(x), x, minf);
\r
313 limit(x/log(log(x*exp(x))), x, inf);
\r
316 limit(((x^7 + x + 1)/(2^x + x^2))^(-1/x), x, inf);
\r
320 declare(n,integer),
\r
322 ans : limit((n + 1)*x^(n + 1)/(x^(n + 1) - 1) - x/(x - 1),x,1,'plus),
\r
328 limit(x - gamma(1/x), x, inf);
\r
331 block([ans1,ans2,expr],
\r
332 assume(r>0, p>0, m<-1),
\r
333 declare(m,noninteger),
\r
334 declare(p,noninteger),
\r
335 expr : ((2*n*(n - r + 1)/(n + r*(n - r + 1)))^c + (r - 1)*(n*(n - r + 2)/(n + r*(n - r + 1)))^c - n)/(n^c - n),
\r
336 expr : subst(c+1,c,expr),
\r
337 ans1 : limit(subst(m,c,expr),n,inf),
\r
338 ans2 : limit(subst(p,c,expr),n,inf),
\r
339 forget(r>0, p>0, m<-1),
\r
340 remove(m,noninteger),
\r
341 remove(p,noninteger),
\r
342 [ans1,ans2,factor(ans2)]);
\r
343 [1,r*(r+1)^(-p-1)+2^(p+1)*(r+1)^(-p-1)-(r+1)^(-p-1), (r+1)^(-p-1)*(r+2^(p+1)-1)]$
\r
345 limit(1/gamma(x), x, 0,plus);
\r
348 limit(x*gamma(x), x, 0,plus);
\r
351 limit(exp(2*expintegral_ei(-x))/x^2, x, 0,plus);
\r
354 limit(x^(-%pi), x, 0, 'minus);
\r
357 limit(exp(x)/(1+1/x)^x^2,x,inf);
\r
360 limit(1/(exp(x)/(1+1/x)^x^2),x,inf);
\r
363 /* Any leftover facts, contexts, or values? */
\r