The following limit makes Maxima 5.20 enter an endless loop:
limit( (log(1+x^2)-2+2*cos(x))/((sin(x))^2+2*sqrt(1-x^2)-2),x,0);
In version 5.19.0 the loop ended with a wrong result "minf". The correct result is 5/7.
Dieter Kaiser
2009-12-14
For the record:
lhospital generates the following expression when trying to find the limit of the example of this bug report:
(%o28) 3*x^2/(x^4*(87*sin(x)^2-87*cos(x)^2+48*sqrt(1-x^2))
+x^8*(4*sin(x)^2-4*cos(x)^2)-3*sin(x)^2
+x^2*(-28*sin(x)^2+28*cos(x)^2-44*sqrt(1-x^2))
+x^6*(60*cos(x)^2-60*sin(x)^2)-56*x^7*cos(x)*sin(x)
+152*x^5*cos(x)*sin(x)-110*x^3*cos(x)*sin(x)+14*x*cos(x)*sin(x)
+3*cos(x)^2+4*sqrt(1-x^2))
Then the routine limit is called again, but it returns never. We can do it directly with the above expression:
(%i29) limit(expr,x,0);
^CMaxima encountered a Lisp error:
EXT:GC: User break
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
I have no idea what is the problem.
Dieter Kaiser
Aleksas Domarkas
2009-12-22
(log(1+x^2)-2+2*cos(x))/((sin(x))^2+2*sqrt(1-x^2)-2)$
taylor(%,x,0,5)$
limit(%,x,0);
5/7
Aleksas Domarkas
2009-12-23
updated comment:
(%i1) (log(1+x^2)-2+2*cos(x))/((sin(x))^2+2*sqrt(1-x^2)-2)$
define(f(x),%);
(%o2) f(x):=(log(x^2+1)+2*cos(x)-2)/(sin(x)^2+2*sqrt(1-x^2)-2)
(%i3) /* error */
limit(f(x),x,0);
(%o3) -inf
(%i4) taylor(f(x),x,0,5);
limit(%,x,0);
(%o4) 5/7-(163*x^2)/245+(86603*x^4)/205800+...
(%o5) 5/7
(%i6) limit(f(1/n),n,inf);
(%o6) 5/7
(%i7) limit(f(sqrt(x)),x,0);
(%o7) 5/7
(%i12) wxplot2d([f(x)], [x,-1.5,1.5],
[gnuplot_preamble, "set grid;"],
[ylabel, "f(x)"]),wxplot_size=[300,300]$
plot2d: expression evaluates to non-numeric value somewhere in plotting range.
(%t12) << Graphics >>
(%i9) build_info()$
Maxima version: 5.19.2
Maxima build date: 8:55 8/31/2009
host type: i686-pc-mingw32
lisp-implementation-type: GNU Common Lisp (GCL)
lisp-implementation-version: GCL 2.6.8
aleksas.domarkas@mif.vu.lt
Dan Gildea
2009-12-23
Dan Gildea
2009-12-23
Fixed in limit.lisp rev 1.89 - though still very slow.
(%i4) limit( (log(1+x^2)-2+2*cos(x))/((sin(x))^2+2*sqrt(1-x^2)-2),x,0);
(%o4) 5/7
(%i5) time(%);
(%o5) [33.41]