This is a modification of a post I made to the usenet newsgroup sci.math in autumn 1995. I have extended it to include examples of what one textbook calls "Lies my calculator told me". Nowadays the distinction between calculator and computer is fuzzy so computer errors related to calculus material and below are included too. Please send suggestions for further modifications to rusin@math.niu.edu. This file currently resides at: http://www.math-atlas.org/99/calc_errors Last modification 2006/07/16. I had originally written to sci.math: >What I _do_ want is a collection of examples which _appear_ appropriate for >calculator use but in which the calculator will err. I received a number of helpful replies, and found an old post on the subject. I will summarize the examples below. They're sorted according to the error or trap rather than the application, since the mathematicians in this group are likely to be able to think of novel ways of re-using or re-presenting them. The examples are all pretty obvious once you think to look for them, but it's not me who thought to look for them. For the most part they're adapted from examples mailed, posted, or published in calc books already (including those of Stewart, Finney/Thomas, and Hughes-Hallett/Gleason) Thanks to those who contributed. Have fun, dave DEFICIENCIES OF CALCULATORS ESPECIALLY AS USED IN CALCULUS COURSES I. Limitations to reasonable, numerical data and common functions A. Machines can't graph y = A x^2 for symbolic A (not even y=(A^2+1) x^2, whose graph is arguably "the same" for all real A.) B. Simple machines can't find e.g. extrema of y=A x^2 + B x + C expressed symbolically in terms of literal variables A, B, C. Warning: computers with symbolic algebra programs _can_ do this, and calculators with such capabilities are now on the market. C. I am not aware of any hand-held machine which can handle numbers larger than 10^100, so of course any problem in which 70! can be made to appear will defy calculator users. (It's not a calculus problem, but several of us instructors have wept in abstract algebra classes when students compute, say, 5^16 mod 17 by first computing 5^16, ...) D. Some machines cannot graph or compute functions defined in parts (e.g. f(x)=f1(x) for x< 0, =f2(x) for x > 0.) In particular, some cannot handle the greatest integer function. E. As far as I am aware the handhelds now available cannot graph functions defined implicitly, unless the curves can be rewritten explicitly or parametrically. I have had PC programs purport to graph these functions but miss multiple branches. (e.g., x^3+5x^2+6xy^2+y^3=1) Of course, there is no difficulty creating more conceptual questions which will forever be just beyond the machine's reach, e.g. "Suppose f is a function whose graph is sketched below..." II. Loss-of-precision errors. I used to call this "overflow" or "underflow" but really the problem is that two or more quantities of wildly different magnitudes are being combined, resulting in loss of (sometimes important) precision. For example, I have asked students for the value of exp(u)-1 when u = ln(1+h) for, say, h=10^(-20) (so that according to a machine, 1+h = h !) Here are some other examples. 1) Find lim (x->0) of (1-cos(x^6))/x^12; do this by examining the graph. (As soon as x^6 is less than 10^-6, cos(x^6) will be reported as 1 on a 12-digit calculator.) 2) Find lim (x->0) 1/(1-cos (x^4)) - 2/x^8 graphically (the x^(-8) terms quickly swamp the O(1) terms which you really need). 3) Calculate the derivative of sqrt(x) at x=10^6 numerically from the definition. If you try to push (sqrt(10^6+h)-1000)/h for h around 10^-6 the h's get lost; of course this can better be computed as 1/(sqrt(10^6+h)+1000). 4) Find lim (x->0+) x/(x^x-1). The correct limit is zero, but after a couple of zooms the student is still looking at the point (0.00625, -.2). 5) Sketch the graph of (x-50)^3*exp(-x) on [0,60] (Here the problem is that the scales on the x- and y- axes are very different.) 6) A standard for calculus classes is the computation of (1+1/n)^n for large n. Try taking for n the first few powers of 1000; the limit appears to be 1 ! 7) Numerical limit experiments can be deceiving. For example, lim(h->0) [sqrt(1000000+h)-1000]/h quickly strains the accuracy of the calculator. The same difficulty can be more creatively masked using identities with gross cancellation, such as 8721 * 3^(1/2) - 10681 * 2^(1/2) = 1 / (8721 * 3^(1/2) + 10681 * 2^(1/2)) There is a lesson to be learned about Taylor series, too, if the students try to evaluate lim(x->0) 1/(sin x)^2 - 1/x^2 by substituting x=10^(-n) for n>3 or 4 say. (The limit is 1/3). Consider these limits as x->0: x/(x^(sin x) -1) and |sin(1/x)|^(1/x^2); both numerically and graphically these are nightmares; the first approaces 0 and the second does not. 8) How many roots has f:=(x-1)^7 ? Clearly precisely 1, although when f is presented as x^7-7*x^6+21*x^5-35*x^4+35*x^3-21*x^2+7*x-1 this is less clear. A graph of f on [0,2] suggests there is at least one root, and the same holds when zooming to [0.9, 1.1]. But when the displayed interval is short enough (e.g. the interval [0.99, 1.01] in Maple) the round-off errors in the eight numbers greatly exceed the true sum (nearly zero) and the graph appears highly oscillatory with hundreds of zeros! (This is visible on my TI-82 as well, if I set the window to show x in [0.9, 1.1] and y in [-10^(-11), 10^(-11)], say.) 9) Of course there are whole fields (e.g. Numerical Analysis) devoted to the handling of difficult cases, which can be a source of classically unstable problems. There are also plenty of examples in analysis of functions or sequences whose behaviour is unclear except in the very large or very small (e.g. sum(1/(n log(n)), n=2..\infty).) (Related exercise: although the sum of the reciprocals of all primes is known to diverge, the sum of all primes which have been written down -- and indeed the sum of all primes which will _ever_ be written down! -- is less than 5 !) III. Discretization errors A. In singularities like y=sin(1/x) I find the pixelated graph to be much less informative than the hand-drawn one. Likewise, the graph of y=sin(10^8 * x) shows no apparent pattern. (Interestingly, my TI-82 with the standard window shows a very definite pattern for the graph of y=sin(10^7 * x) !) For hand-discretization errors, ask for the limit of sin(\pi/x) as x -> 0; some students will try x = 1, x = 1/2, x = 1/3, ... Even a simple function of obvious use such as f = sin(365*x) cannot be shown on a tiny display. (Try asking calculator-bound students for the average value of f on [0,1] !) B. Since discretization involves regular sampling of points from the input of a function, it can conversely show patterns which do NOT exist. I attempted to use a Casio's "dynamic" graphing to show the graphs of a range of functions y = sin(k x), k=1, 2, ..., 15. This can be simulated with Maple, say, using commands of the form k:=10:L:=-6.4:R:=16.3:N:=127: plot({seq([L+(i/N)*(R-L),sin(k*(L+(i/N)*(R-L)))], i=1..126)},style=point); Small pertubations of L, R, N, or k will produce wildly different graphs, surely obscuring the point to be made for the student. C. Of course there are plenty of numerical examples, fooling students who think the calculator is secretly carrying infinitely many places of accuracy. They may be convinced that e^(pi*sqrt(43)) is an integer (if they use a computer, have them check e^(pi*sqrt(163)) instead). If you succeed in convincing them pi is not 22/7, try 355/113; or ask them for the positive root of 242 x^4 + 113 x - 23928, and see how many make a leap of faith. Likewise with cos(5 pi/16) = .5555702... which isn't really 5/9 but rather sqrt(2 - sqrt(2 - sqrt(2)))/2. My TI-82 also appears to know that pi is a special number, but reports sin(4*pi)=2*10^(-13), so evidently it is not treated symbolically after all. [Another fun example of misleading sequences: solve numerically log(x^4+x^5)=6 or log(3x^2 + 7x + 3) = 4] D. I was recently floored by a student making a discretization error related to the graphing display. The student graphed y=1-x/12 on a TI-82 (standard window: [-10,10] x [-10,10] ) and happily transcribed to her paper a step function... E. Ask the students whether or not f(x)= 1000 + |x|/x + x is continuous. The default display will show none of the graph (see next section); a clever student might think to zoom out. But if a big enough window is chosen, then the discontinuity is lost to view. F. Likewise no calculator's display can show the absence of one point in a curve; we may all agree that f(x) = (x^2-1)/(x-1) has a domain which excludes {1}, but the calculator cannot show it. IV. Graphing-window traps Students, naturally, begin with the default window on the graph of a function (typically showing the behaviour on [-10,10], say). It's easy to make examples in which this --- shows none of the graph (e.g. y=40+ln(x), -(x-100)^3 / 1000 ) --- fails to show large-scale behaviour (e.g. y=10^(-6)(x-1000)^3 ) --- misses extrema (e.g. f(x)=(x^2)exp(-.004x) ) --- suggests false limits (e.g. lim x-->-oo x^3/(x^3+10 x^2) is a particularly good trap on the TI default window [-10,10]! ) These problems can be fixed by zooming out far enough. Others require zooming in, especially --- failing to show small-scale variation (e.g. y=x^4-x^2+0.2 has 3 roots) Of course you can combine these into examples for which both zooming in and zooming out are necessary to get a complete picture. Here's a polynomial I once cooked up for students who were studying different techniques of root-finding: f(x)=4 x^7-10 x^6-5 x^5+(53/2)x^4 -22 x^3 + (59/2)x^2 -(69/2)x + 9 (its roots are -1.8794..., 0.3473..., 1.5, 1.5, 1.5321..., and -.25 +- sqrt(-15)/4 ; the successive extrema between the real roots are roughly +191.37, -16.22, and -.0003 -- not at all easy for a graphing calculator to display!) Likewise, I'm not even really sure what I would _like_ students or the calculator would do in some cases: what is the graph of x^25/1.0001^x ? Its maximum (around x=10^6/4) is about 10^124, but the function decays to 0 as x-> oo. Is it really "right" to use Cartesian coordinates here? Another example of this: y = ln(x) + 40 - x/100 . I'm not sure how zooming could really identify asymptotes. Ask your students to discuss the dips in the graph of y = ln(|cos(x)|), for example, or x^4+ln(1+cos(x)) (which approaches -\infty at pi, but which is positive for xThe TI-82 and -85 use adaptive Gauss-Kronrod integration (check out >http://archive.ppp.ti.com/pub/graph-ti/calc-apps/info/numinter.txt ). > >Some experimentation shows that the '85 uses 7 nodes while the '82 uses >(if I remember correctly) 15. > >So an error you can catch the '85 at: > >Integrate ( x(5x^2-3)(891x^4-990x^2+155) )^2 on [-1,1] and get 0. > >The HP-48GX seems to use a change of variables and a Romberg method >that dates back to some much earlier HP calculators. ("Handheld >Calculator Evaluates Integrals", William M. Kahan, Hewlett-Packard >Journal, August 1980) The handheld referred to in the title is the >HP-34C; it's a detailed article and tests lead me to believe the same >integrator is still in place in HP's latest machines. > >An error you can catch the HP-48G at: > >Integrate (cos(512 Pi x))^2 on [0,1] and get 1. > [Just try to graph the integrand on any calculator and have some fun]. > >As the HP Journal article points out, any numerical integration routine >has an Achilles' heel. This fact is pointed out in most numerical >integration texts. ============================================================================== From: Michael Hanke Newsgroups: sci.math.num-analysis Subject: Reference wanted Date: Mon, 16 Jun 1997 11:31:25 +0200 Hello, for more than 10 years I am using a special example in an undergraduate course on Numerical Analysis in order to demonstrate the effect of roundoff errors in an numerically unstable algorithmn. I found this example in a simple textbook for pupils showing the danger in believing the results of an electronic calculator without critical doubt. Unfortunately, no source was given. I heard some rumour that this example belongs to L. Fox, but I was not able to find a citation. Please help me to find the original reference. Thank you. The example: Compute the integral $I_n:=\int_0^1 x^ne^{x-1} dx$. $I_0$ can be easily computed analytically. By partial integration we obtain $I_n=1-nI_{n-1}$. This recursion is unstable, roundoff error accumulates as n-factorial. This is very impressive for students since after a very few steps the computed $I_n$ is exploding while the exact value is between 0 and 1. Michael Hanke ============================================================================== Date: Fri, 1 Nov 1996 08:43:41 -0500 (EST) To: rusin@vesuvius.math.niu.edu Newsgroups: sci.math.symbolic Subject: Re: Bugs wanted ! From: jacques.gelinas@drev.dnd.ca (Jacques Gelinas) A surprising example of computer software bug is the so-called 15-digit number bug of Microsoft Excel 7.0 for Windows 95 (and earlier versions), involving multiples of 2**(-49), 2**(-50) and 2**(-51). Enter 1.40737488355328 in a cell of this spreadsheet and you get ... 0.64 exactly! A patch is available. ============================================================================== From: israel@math.ubc.ca (Robert Israel) Newsgroups: sci.math.symbolic Subject: Re: Maple "int" Errors? Date: 6 Feb 1997 17:38:11 GMT In article <32F9D163.41C6@cip.mathematik.uni-stuttgart.de>, Thomas Haeberlen writes: |> can anyone give some examples for functions where the Maple int-command |> (either definite or indefinite integrtion) gives wrong results? I |> remember one thread about a related question but that was some time |> ago... . If not for "int", where else do wrong results occur? It's for a |> demonstration of the capabilities and limitations/"dangers" of a |> symbolic math package so the context should be explicable to |> "non-experts". There are lots of examples where the antiderivative is a multivalued function in the complex plane, and the path of integration crosses the branch cut that Maple uses. This is difficult for a program to detect, and very often causes an error in the definite integral. In Release 3, > int(sin(x)/(1+x^2), x = -infinity .. infinity) I sinh(1) Pi The correct answer, of course, is 0. This one has been corrected in Release 4, but you still have > int(exp(-I*t)/(1+t^2),t=-infinity .. infinity); 0 where the correct answer is Pi/e. Another is > int(exp(I*t)/(exp(I*t)+1/2), t=0..2*Pi); 0 where the correct answer is 2 Pi. Indefinite integration generally gives correct results, but sometimes not simplified very well, e.g. (this was pointed out by Sjoerd Rienstra) > int(1/(1+cos(x)^2), x); The result looks horrible, but should be arctan( tan(x)/sqrt(2) ) /sqrt(2). Also, despite having implemented the Risch algorithm, there are still cases where Maple fails to find an elementary antiderivative, e.g.: > int(2^x/sqrt(1 + 4^x), x); The reason seems to be that Maple doesn't realize that 4^x = (2^x)^2. Robert Israel israel@math.ubc.ca Department of Mathematics (604) 822-3629 University of British Columbia fax 822-6074 Vancouver, BC, Canada V6T 1Y4 ============================================================================== From: jpg@math.math.unm.edu (Jeffrey P. Golden) Newsgroups: sci.math.symbolic Subject: Re: Article on Wolfram/Mathematica in Wall St Journal Date: 1 Oct 1996 01:57:18 GMT > (the Beta 3 version only) and I like it better than 2.2.3. Aside from > being more robust in terms of integration, it is able to give conditional > answers (taking certain integrals, for example you would get different > solutions for different ranges, Mma 3 provides these). > > [...] It is surprising to me that given these conditional answers for integration that Mathematica 3.0 still gets Integrate[x^n,x] wrong. It still gives x^(n+1)/(n+1) when one might have expected perhaps If[n != -1, x^(n+1)/(n+1), Log[x]] . It is also hard to get real answers for real integrals sometimes with Mathematica 3.0 . E.g. sometimes you want Integrate[1/x,x] to give Log[Abs[x]] instead of Log[x] ; or Integrate[1/(x^2+a),x] to give a real answer when symbolic a<0 . You might like Integrate[Sqrt[1-Cos[x]],x] to give a continuous answer without spurious discontinuities since the integrand is continuous over real intervals. And should Integrate[Abs[x],x] give an answer? Mathematica 3.0 doesn't think so. (I hope all of my observations of Mathematica 3.0 are correct. The Mathematica 3.0 "Vision of Mathematica" came to M.I.T. today.) From: Jeffrey P. Golden Organization: Macsyma Inc. Reply-To: jpg@macsyma.com URL: http://www.macsyma.com ============================================================================== Excerpts from: From: A.Esser@Mailer.Uni-Marburg.DE (Alex Esser) Newsgroups: sci.math.symbolic Subject: Maple V R4 can't solve 3 simple problems Date: Fri, 23 Aug 1996 18:42:51 +0200 I have just started working with Maple V R4 and stumbled over three very simple problems which Maple couldn't solve: # Example 1 > assume(n,even); > additionally(n>0); > is(n,odd); FAIL # Why doesn't Maple return "false" ?! # Example 2 > assume(n>0); > limit(x^(n+1),x=0,left); (n~ + 1) lim x x -> 0- # Here is the problem! # Example 3 > f := piecewise(x<=0,0,x); > readlib(discont): > discont(f,x); {0} # Although this is only a list of possible discontinuities... > limit(f,x=0); 0 # ...Maple should know that f is continuous ============================================================================== More Maple errors, all presumably problems with branch-cut choices: #1: > int(1/((x^2 + x)^2 + 1),x=-infinity..infinity); #Obviously positive 0 #2: > evalf(int(log(5+cos(x)),x=0..1)); #Obviously real 16.16847078 + 19.73920880 I #Maple requires the slightly different > evalf(Int(log(5+cos(x)),x=0..1)); # to get 1.764697791 #3: > sum(m*Z^m,m=1..infinity); #correctly gets Z/(Z-1)^2 > sum(m*Z^m,m=0..infinity); #gets a complicated expression; simplify with > factor("); taylor(",Z); #to see it missed the terms with m=0,1: 2 3 4 5 6 2 Z + 3 Z + 4 Z + 5 Z + O(Z ) #4: > maximize(x1^2, {x1}, {x1=0..1}); #correct 1 > maximize(x1^2+x2^2, {x1,x2}, {x1=0..1, x2=0..1}); #incorrect 0 > maximize(x1^2+x2^2+x3^2, {x1,x2,x3}, {x1=0..1, x2=0..1, x3=0..1}); > #No answer, which is incorrect too I guess. #5: Not really Maple's error, I suppose: > x*y/(x+y-1); x y --------- x + y - 1 > subs(x=1,y=0,"); 1 > subs(y=0,x=1,""); 0 #6: Mathematica can't Solve[] : From: bruck@math.usc.edu (Ronald Bruck) Newsgroups: sci.math.num-analysis Subject: Re: Mathematica & f(x)=0 Date: 14 Nov 1998 12:59:35 -0800 [...]That said, I do wish Mathematica would improve its symbolic computation abilities. For example, surely the solver could be taught that Solve[Sin[x] == 0,x] should have x = n * Pi as a solution, not just x = 0. If it knew even THAT much, it could solve a whole raft of other problems. I warn my students to be very cautious of the Solve command, even when it seems to work, and to pay ATTENTION to those warnings. Try solving f'[x] == 0 for f[x_] = (1 + Sin[x]^2)/(2 + Cos[x]). Mathematica returns five solutions, and when you plot the function on [0,2 Pi] you see five local maxima and local minima; but TWO of its solutions aren't real! Still, to its credit, it does attempt to take ArcCos. It entirely misses the solution at x = Pi. ============================================================================== Date: Thu, 31 Oct 1996 09:12:05 -0500 From: David Hart To: Dave Rusin Subject: Re: Bugs wanted ! [sci.math.symbolic] [deletia -- djr] Incidentally, regarding the errors that you point out for Maple: - int(x*(1-x), x=0..1); returns -1/6 was fixed by a patch almost immediately after release 3 came out, two years ago [and is not present in release 4]. - int( sqrt(cos(x))^2, x=0 .. Pi); returns 0 seems to me correct; for example sqrt(cos(2))=I*sqrt(-cos(2))~=.64I, ( sqrt(cos(2)) )^2=cos(2)~= -.42, and (sqrt(cos(x)))^2 = cos(x). By the way, int( sqrt(cos(x)^2), x=0..Pi); returns 2, which seems to be correct, also. Also, the error that you list for Mathematica: - Integrate[ 1/x^2, {x,-1,1}] returns -2 is not present in version 2.2.2 [and presumeably not in 3.0, currently being released], which is all that I have currently available. I get "Integrate::idiv: Integral does not converge". I realize that these softwares are a moving target, and that there could still be [and probably are] less flagrant errors; but I believe that the situation regarding these particular examples was the same a year ago [when you posted your note]. I appreciate your effort to serve the community, and encourage you to correct these points [if you agree that you were mistaken] [agreed! -- djr. Further deletia...] David Hart [later addenda received -- djr] After looking some more, I see that I have been confused about different versions. "integrate( sqrt( (cos(x))^2 ), x=0..Pi);" used to return 0, [in rel 3], now returns 2 [in rel 4]. ============================================================================== Date: Thu, 31 Oct 96 08:41:03 CST From: rusin (Dave Rusin) To: dhart@indiana.edu Subject: Re: Bugs wanted ! [sci.math.symbolic] Thanks, I'll take a fresh look at the file. Even if some of the bugs are fixed in newer releases, there are older copies in use so that care is needed even to avoid the old errors. The situation for sqrt(cos(x)^2) is perhaps a matter of preference. If you want the composite to be analytic, and to take the value cos(x) for some specific x, then the composite must equal cos(x) for all x. This would cause the integral to be zero, as reported by that early version of Maple. On the other hand, it seems a little disingenuous to refer to the sqrt at all if it's not a function (this use of sqrt(u) requires knowning not only u but also the value of x for which u=cos(x). That is, sqrt(1)= 1 if x=0, sqrt(1)= -1 if x=Pi). If you define sqrt in the traditional way (as the _positive_ square root for real numbers, or the _principal value_ for complex numbers) then one can only conclude sqrt(cos(x)^2) = |cos(x)|. In particular, the integral of this function must be positive. At some point the "bug vs feature" debate takes over, which is why I consider the CASs to be a great tool but not a substitute for "real" calculation. For example, would you agree that (x^a)^b = x^(a/b) ? Then isn't (x^2)^(1/6) = x^(2/6) = x^(1/3) ? But for x<0, these functions aren't equal. Well, I can't imagine which step of this process I want a CAS not to do automatically, so I have to be prepared for such a system to give me answers I disagree with sometimes. [deletia -- djr] ============================================================================== From: Peter Newsgroups: sci.math.symbolic Subject: Maple Bugs?? Date: Sun, 30 Nov 1997 21:11:58 -0800 > eq1:=x+1+1/(x-2)=3+1/(x-2); 1 1 eq1 := x + 1 + ----- = 3 + ----- x - 2 x - 2 > solve(eq1,x); 2 eq1 should have NO solution. x = 2 is NOT a solution since 1/(x-2) is undefined for x = 2. > eq2:=1/(2^x-1)-4/(2^x+1)=(2*(2-4^x))/(4^x-1); x 1 4 2 - 4 eq2 := ------ - ------ = 2 ------ x x x 2 - 1 2 + 1 4 - 1 > solve(eq2,x); _Z _Z _Z _Z _Z 2 _Z 2 _Z RootOf(-3 2 4 + 3 2 + 3 4 - 1 - 4 (2 ) + 2 (2 ) 4 ) > allvalues("); 0 The solution of eq2 is x = -1. x = 0 is NOT a solution since 1/(2^x-1) is undefined for x = 0. ============================================================================== New Maple goof: > limit(ln(-2+a*t^2),t=0); #Causes some kind of infinite loop. Note that... > limit(ln(-2+(3+2*I)*t^2),t=0); ln(2) + I Pi > limit(ln(-2+(3-2*I)*t^2),t=0); ln(2) - I Pi > limit(ln(-2+a*t),t=0); lim ln(-2 + a t) t -> 0 #...are all handled in the mathematically appropriate way ============================================================================== From: kovarik@mcmail.cis.McMaster.CA (Zdislav V. Kovarik) Subject: Re: Definition of a discontinuous function Date: 7 Jun 1999 15:33:29 -0400 Newsgroups: alt.algebra.help,sci.math Keywords: calculator errors In article <375B6DDC.FD1E4A91@hut.fi>, Pertti Lounesto wrote: :"Zdislav V. Kovarik" wrote: : :> Suppose the definitions go (I am starting with the one I do not accept :> but it can be found in many textbooks): :> :> f is continuous at c iff all three following conditions are satisfied: :> c is in the domain of f, :> lim[as x->c] f(x) exists, :> lim[as x->c] f(x) = f(c) :> (end of definition); :> :> f is discontinuous at c iff it is not continuous at c; [...] : :This definition is good for basic calculus courses, while it intesifies :the learning of the concept of limit, taught about the same time. : (Prof. Lounesto need not be told the facts; I am addressing a wider audience.) Some time ago, I was lured into a dispute about "definitions for the masses vs. definitions for the experts" - that time it was probability. (The other debater turned out to be trolling, but I digress.) I am still convinced that holding back a part of the definition which is so easy to formulate would be cheating: [...] :> :> One can amend the definition of continuity of f by adding "or, if c is :> an isolated point of the domain of f", but this looks forced. On second thought, it is not so forced if we draw attention to the fact that limits are unavailable (or not unique, depending on the definition of a limit) at isolated points, hence a default clause in in order. [...] :> To put isolated and non-isolated ("accumulation") points under one :> roof, to call f continuous at c, we require that :> c be in the domain of f (as above), and :> the inverse image of every neighbourhood of f(c) contain a :> neighbourhood of c, relative to the domain of f. :> (end of definition). [...] : :This definition is good in a course heading for topology. This latter :definition is conceptual and cannot be checked by a pocket calculator, :to the satisfaction of a lazy student. : The sight of students' fingers dancing on the calculator keys is sadly familiar to me; it leads to generations of students graduating with the impression that all you have to do to check out a limit is to try it on the student's single favourite sequence: a student's favourite sequence convergent to 3 is {2, 2.9, 2.99, 2.999, ...} but rarely {3.1, 3.01, 3.001, ...} Or vice versa, if the notation uses "3 + Delta x". The impression (about a single sequence being enough), for less informed readers, is false. To wake up the calculator-happy ones, give them the limit of (sin(x))^(-2) - x^(-2) as x tends to 0, or variations on this theme. The calculated values will soon go crazy or settle at 0, depending on the hardware, and the limit is 1/3. And there is always the old standby: limit of a(n) = n^5 * (0.999)^n as n goes to infinity. Here a(n) increase as long as n < 4997, and a(4997) > 2*10^16 is the largest. We know, of course, that the limit is 0. (How do I prove it without the hand-waving L'Hopital style manipulation? With some foresight, I find the maximum of n^6 * (0.999)^n, estimate it from above by some M, and then 0 < a(n) < M/n -- Squeeze argument. I calculated M=2*10^20. And I do not need Calculus for the maximum; just solve ((n+1)/n)^6 * (0.999) > 1.) There is a correct sequential formulation of limits and continuity (in metric spaces), due to Heine, which uses the hypothetical process of testing _every_ sequence with entries in the domain of f, convergent to c but different from c. For continuity, one drops the condition "but different from c". (And: isolated points are covered by Heine without any trouble.) The neighborhood definition is easy to illustrate graphically, both by static and by moving pictures. It is also an opportunity to put the student "in the driver's seat": instead of sitting back and watching teeny-weeny cobolds pushing x towards 3 with all their might, but never reaching it, we answer a challenge: tell me the tolerance - how close you want f(x) to be to L, the proposed limit (or to f(c) for continuity) - and I will specify how close x should be to c. Engineering students would (or should) relate to that. Regards, ZVK(Slavek). ============================================================================== Note of possible interest: some calculators round in unorthodox ways. See http://groups.google.com/groups?ic=1&selm=50jnke%24def%40news.iastate.edu ============================================================================== From: Dr. =?iso-8859-1?Q?J=FCrgen?= Barsuhn Newsgroups: sci.math.symbolic Subject: Re: History of Computer Algebra, factoring, integratioin Date: Sun, 11 Nov 2001 22:14:05 +0100 Richard Fateman schrieb: > Dr. Jürgen Barsuhn wrote: > > ............ > >>Whether any of the well known CAS implement the Risch algorithm > >>"completely" should be asked. Perhaps there is an implementation > >>by Bronstein (in Axiom?) > >> > > > > There was a posting in this newsgroup a few weeks ago that there is so far no > > "Risch-complete" CAS > Actually this posting was a year ago and it was written by Bronstein. I attach its text below: *************************** Subject: Re: Integration algorithm Date: Fri, 24 Nov 2000 10:38:01 +0100 From: Manuel Bronstein Organization: INRIA CC: mywyb2@cam.ac.uk, bmanuel@sophia.inria.fr Newsgroups: comp.soft-sys.math.maple MYWY Becker wrote: > > Does anyone know whether the integration algorithm in Maple is > Risch-complete? That is, if Maple's answer is not an elementary > function, can you be sure that there doesn't exist an elementary answer? > In other words, has Maple implemented the *entire* Risch-like algorithm, > in particular the *entire* algebraic case? It is not Risch-complete, even in the purely transcendental case (recursion problems in the logarithmic case). It is not complete either in the purely algebraic case (see below), and certainly not in the mixed algebraic-transcendental case. Neither is Axiom (despite various rumors). The difference is that Axiom issues an error message when an unimplemented branch of the algorithm is hit, so an unevaluated integral in Axiom is a proof that the integral is not elementary. Neither is Mathematica, despite all the hype and ads (source code is unavailable but "black box" experiments show Mma's integrator to be in the, ahem, "low" category). For the sceptics, here is an elementary integral of an algebraic function, whose integral is a simple logarithm, missed by the Risch integrators of both Maple and Mma: Mathematica 4.0: g = x / Sqrt[x^4 + 10 x^2 - 96 x - 71] Integrate[g,x] f = -Log[(x^6+15 x^4-80 x^3+27 x^2-528 x+781) Sqrt[x^4+10 x^2-96 x-71] - x^8 - 20 x^6 + 128 x^5 - 54 x^4 + 1408 x^3 - 3124 x^2 - 10001]/8 Simplify[D[f,x] - g] Maple 5.5 and Maple 6: g := x / sqrt(x^4 + 10*x^2 - 96*x - 71); int(g,x); int(convert(g,RootOf),x); f := -log((x^6+15*x^4-80*x^3+27*x^2-528*x+781) * sqrt(x^4+10*x^2-96*x-71) - x^8 - 20*x^6 + 128*x^5 - 54*x^4 + 1408*x^3 - 3124*x^2 - 10001)/8; normal(diff(f,x)-g); For fairness, here is an easy one that Axiom cannot decide: integrate(sqrt atan x,x) -- Manuel Bronstein -- Manuel.Bronstein@sophia.inria.fr -- http://www.inria.fr/cafe/Manuel.Bronstein/ ============================================================================== The following error still persists in Maple 7: From: Dave Rusin (rusin@shuksan.math.niu.edu) Subject: Another Maple integration gaffe Newsgroups: sci.math.symbolic Date: 1999/03/10 The integration command int(ln(U)^(1/2)/U/(-1+U)^(1/2),U); gives an erroneous result in release 4; I don't have release 5 to test. The function and "its antiderivative" are 1/2 3/2 ln(U) ln(U) -------------, 2 ----------- 1/2 1/2 U (-1 + U) (-1 + U) Setting infolevel[int]:=5: reveals that Maple attempts to perform integration by parts, and then decides that the resulting second integrand is zero. Differentiating the wrong answer and asking Maple to integrate that derivative leaves it stumped. I had always wanted my calculus students to have the same skills as Maple; unfortunately I seem to have gotten my wish :-) ============================================================================== From: Richard Fateman Subject: Re: optimizing symbolic code Date: Fri, 26 Jan 2001 13:54:15 -0800 Newsgroups: sci.math.symbolic Daniel Lichtblau wrote: > > Paul Lutus wrote: > > > > "Richard Fateman" wrote in message > > news:3A709362.9BBDFB11@cs.berkeley.edu... > > > > > > > > > Paul Lutus wrote: > > > > > > > Mathematica (like all similar computer programs) is much more robust > > when > > > > doing symbolic mathematics, and integer-only mathematics, than the > > > > get-our-hands-dirty floating-point variety. > > I'd be curious to see an example of this non-robustness. I do not claim > that no such examples exist, but rather that in the majority of cases > one sees expected consequences of reasonable design decisions rather > than actual flaws. > Hi Dan! I'd like to invite any readers to see my (now 11+ years old) review of Mathematica at http://www.cs.berkeley.edu/~fateman/papers/mma.review.pdf I have heard that people at WRI claim that "all the bugs have been fixed" that were reported in that review. Since my intention in 1990 was NOT to mention bugs that were easily fixed (and also so common), but to mention design flaws, I looked forward to new releases of Mathematica. While some of the details have been moved around, in my view, nearly all the flaws remain. Many of them are hardly expected consequences to the users of mathematica, although I agree with Dan that one could say that someone truly familiar with the design decisions might be able to anticipate the bizarre consequences. That's how I (and W. Kahan) came up with these examples. Here's an example from that paper. p=314159265358979323; q=314159265358979323.; r=314159265358979323.00000000000000000000; s=p+0.00000000000000000000; {Tan[s],N[Tan[p]],Tan[q],Tan[r]} The result is {1.59981,1.59981,-0.,-1.1297926523089085443} in the Mathematica I used for the review, I got ComplexInfinity instead of -0. {p==q, q==r, r==s, r==p} The result is {True,True,True,True} > On this topic, there is a recent article that discusses Mathematica > numerics for statistics purposes, from an outsiders (that is, non-WRI) > point of view. > > Computational Statistics > Volume 15 Issue 2 (2000) pp 279-299 > The accurary of Mathematica 4 as a statistical package > B. D. McCullough > Federal Communications Commission, USA, > > The article makes some mention of numerical accuracy and general > robustness issues. I do not have access on-line to this paper, but it refers to another paper on a similar topic (using EXCEL for statistics) by the same author. It seems that EXCEL and many other packages do not use the best known numerical techniques. This may be attributed to ignorance (e.g. choosing a bad pseudo-random number generator) age, speed tradeoffs, etc. I have no doubt that Mathematica's choice of floating-point library routines could be more astute. I also have no doubt that --given sufficient programming effort-- Mathematica's big-float capability can be used to compute high accuracy results. I DO however, believe that naive users -- who do not make a study of the Mathematica design, but merely use it as though it were doing mathematics as taught in numerical analysis courses-- will be unpleasantly surprised on occasion. Or if they are not surprised, they may just be getting wrong answers. I mostly agree with Dan's comments except that the idea that it is OK to do something wrong if it is documented (i.e. in the Solve command description) should be discouraged. It is not ok to convert a bug into a feature by documenting it! RJF > > > > > -- > > > > Paul Lutus > > > > www.arachnoid.com > > > > > > If you are doing polynomial arithmetic on symbols and integers, there > > > is not much opportunity to mess up. However, > > > Integrate[1/x,{x,a,b}] > > > > > > gives an answer -Log[a]+Log[b] > > > > > > which is clearly a problem for some values of a and b. > > > For a=-1, b=1, we get -I*Pi. > > Handling of branch cuts for symbolic integration is always problematic; > this example in essence proves that fact. There has been work within the > computer algebra community regarding placing assumptions on the > parameters, and some of this is reflected in our version currently under > development. But I doubt whether anyone has found a generally good way > to handle symbolic branch cut issues. > > > > The implicit premise in Mathematica that it is OK to > > > give a "generic" answer which is wrong at specific > > > places represents a divergence from mathematics as > > > usually practiced. > > > > I agree, and this is certainly a classic. I suppose if I look through the > > documentation, I'll find a disclaimer about discontinuities that may appear > > "in some cases." :) > > > > The general equation solver generally avoids this sort of error, but it also > > provides a straightforward result for y = 1/x without warning about > > inappropriate values: > > > > Solve[1/x==y,x] > > > > x == 1/y > > Documentation for Solve explicitly notes that solutions are always > generic. If you think a moment about the Solve output design (as > replacement rules, not in the equation form you indicate) you realize it > must be this way: how do you specify e.g. "NotEqual" as a replacement > rule? > > In[9]:= Solve[1/x==y,x] > 1 > Out[9]= {{x -> -}} > y > > For nongeneric results one can use Reduce. > > In[10]:= Reduce[1/x==y, x] > 1 > Out[10]= x == - && y != 0 > y [deletia --djr] ============================================================================== From: Dave Rusin (rusin@vesuvius.math.niu.edu) Subject: Re: integral Newsgroups: sci.math Date: 2002-01-08 12:00:08 PST In article , Mr Whippy wrote: >can anyone tell me what the general solution of the integral of tan^2(x) is >please? I face constant pressure from people who think Teaching With Technology is the wave of the future. I'll have to remember this example, which is a trivial calculus exercise. But let's be modern and use technology. There are on-line integrators out there, so we don't have to think. But Fateman's online integrator, http://torte.cs.berkeley.edu:8010/tilu , failed to respond when I tried to connect. Oh no! Well, there's also the site which the Mathematica people provide: http://integrals.wolfram.com/index.en.cgi This is hardly a great advertisement for Mathematica, though. Warm up with input Sec[x]^2 and you'll get output Tan[x] . Change the input to Tan[x]^2 and you'll get output which looks like this: 3 tan x ------- 3 I kid you not. (However, an actual copy of Mathematica successfully gave the textbook answer.) Maple gives an answer too, of course, but it's not what I would have given. A student who copies this and hands it in will have some explaining to do for the teacher, I think! Maple's answer is tan(x) - arctan(tan(x)) I checked a TI-92, too, and its answer is the same as Mathematica's. They even display the integrand with multiple sets of parentheses, which is what I encourage students to do ("tan^2 x" is a terrible notation). Of course, the original poster asked for the "general solution", which none of these systems is providing. (Maple's solution actually triggers something closest to the truth when you stop to think about it.) And people wonder why I pooh-pooh the use of technology. dave From: Dave Rusin (rusin@vesuvius.math.niu.edu) Subject: Re: integral Newsgroups: sci.math Date: 2002-01-08 13:20:07 PST n article , Timothy E. Vaughan wrote: >"Dave Rusin" wrote in message >news:a1fih9$6m9$1@news.math.niu.edu... >> Well, there's also the site which the Mathematica people provide: >> http://integrals.wolfram.com/index.en.cgi >> This is hardly a great advertisement for Mathematica, though. Warm up >> with input Sec[x]^2 and you'll get output Tan[x] . Change the >> input to Tan[x]^2 and you'll get output which looks like this: >> 3 >> tan x >> ------- >> 3 >> > >Although I agree with the general message of your post, it is unfair for you >to represent the Mathematica online integrator as you have. You did not >enter the expression correctly, which is why you got the wrong answer. A >notationally correct entry gives the correct result. Well, yes and no, so I apologize partially. I had entered the function incorrectly the first time (I forgot that it's Fateman's integrator, not Wolfram's, which is permissive with notation). I then switched to Mathematica notation, which is what Wolfram requires, but still got this answer. I thought this was a software error on their part but on further reflection I now see that the problem has to do with Netscape caching pages on my end. So I guess Wolfram is not to blame here. On the other hand, if I'm trying to teach calculus and have to spend time helping students with computer notation and web-page caching, I think that's more doing more harm than good to a calculus class! dave From: Robin Chapman (rjc@maths.ex.ac.uk) Subject: Re: integral Newsgroups: sci.math Date: 2002-01-09 10:54:49 PST Tee-hee! I tried the free MuPAD program. It integrates tan^2 (x) as tan(x) - x . Hurrah! I then asked it to integrate sec^2(x). Answer (2 sin(2x))/(2 cos(2x) + 2 ) :-) (I think ou can cancel a factor of 2, but it doesn't!) > And people wonder why I pooh-pooh the use of technology. The main reason for computer technology being introduced in schools and universities is to open up captive markets for hardware and software companies, backed with emotional blackmail along the lines of "we must make sure our children are prerpared for the information age of the 21st century (or whenever)". ============================================================================== New example hard for calculators: graph (x-1)/(x-3)^2 (small variation in y-coordinates of critical/inflection points) ============================================================================== From: ol3@webtv.net (Oscar Lanzi III) Newsgroups: sci.math Subject: Re: Maple not integrating exp(arcsin(x)) Date: Sun, 27 Oct 2002 08:03:38 -0600 (CST) I once stumped my TI-89 with this integral: INT(sqrt((1+x)/(1-x)), x) It could not figure out how to ratinalize the numerator! When I put the rationalized numerator form in, I got the correct answer. ========================================================================== From: Gerry Myerson Newsgroups: sci.math Subject: Re: Symbolic calculations on the web Date: Fri, 11 Feb 2005 09:12:14 +1100 In article <3rMOd.9404\$UL4.6236@fe09.lga>, "Stephen J. Herschkorn" wrote: > In response to my recent request for a Mathematica(R) favor, a reader > sent me e-mail telling me about http://www.quickmath.com/ , which will > do many symbolic calculations. It is very helpful. Cool. I asked it to integrate x*tan(x) from 0 to pi/4 and got (8C + i(pi)^2 - 4 pi log(1 + i)) / 16. What does C stand for in this context? Is that some sort of reserved symbol in Mathematica? -- Gerry Myerson (gerry@maths.mq.edi.ai) (i -> u for email) From: "Stephen J. Herschkorn" Newsgroups: sci.math Subject: Re: Symbolic calculations on the web Date: Fri, 11 Feb 2005 12:38:37 -0500 Stephen J. Herschkorn wrote: > In response to my recent request for a Mathematica(R) favor, a reader > sent me e-mail telling me about http://www.quickmath.com/ , which will > do many symbolic calculations. It is very helpful. Actually, now I see that the integrator of limited usefulness. For example, it just told me that integral(r=0..infty, 4r / (4-r^4)) = i pi/8. -- Stephen J. Herschkorn sjherschko@netscape.net ============================================================================== From: Gerry Myerson Newsgroups: sci.math Subject: Re: "deceptive" graphs of functions Date: Wed, 23 Feb 2005 09:20:46 +1100 [...] Here's another nice example of calculator-gone-wrong: Consider the sequence given by a_1 = pi, a_2 = pi, a_n = 20 a_{n - 1} - 19 a_{n - 2}. Now you can see at a glance that this sequence is just pi, pi, pi, pi, .... But if you give it to a calculator (unless you have one that can work with pi as a symbol), the sequence moves wildly away from this after just a few terms. This isn't mine, but I saw it so long ago that I can't remember where I saw it. From: ol3@webtv.net (Oscar Lanzi III) Newsgroups: sci.math Subject: Re: "deceptive" graphs of functions Date: Tue, 22 Feb 2005 17:29:00 -0600 We can analyze that behavior in elementary terms. Imagine a_n = r^n for charateristic roots r. Then r^2 - 20 r + 19 = 0 leading to r = 1, 19. The latter root dominates with its larger absolute value, so when a roundoff error propagates through future terms in proportion to 19^n it overwhelms the intended solution. Any input that cannot be represented exactly in the binary code of the calculator/computer, like 1/3, will give the same kind of result. ============================================================================== Here is an interesting philosophical question: what does the graph of y = (x^2 - 2 ) / (x - 1.414) "really" look like? The problem is that there is a singularity at a point which is _close to_ and perhaps _intended to be_ a root of the numerator; if the two are considered to be equal then we have cancellation, i.e. the singularity is removable. But strictly speaking they are not equal so the function has a pole and a zero very close to each other. This problem is hidden in this more complicated one, sent to me by Dave Renfro in December 2005: why does a calculator mess up the graph of (6*x^4-17*x^3-25*x^2+19*x-3)/(x^3-2*x^2-7*x+2) In this case there is no ambiguity: the numerator and denominator have a common quadratic factor so the singularities at 2 +- sqrt(3) are removable. Unfortunately the calculator treats the function literally as the quotient of two polynomials, which are evaluated numerically and then divided into each other. Since the common zeros are not at rational points, the machine will certainly experience roundoff errors evaluating the polynomials near the roots, giving answers such as ( 1 * 10^{-10} ) / ( 3 * 10^{-10} ) = 0.333.. near the singularity. The calculator may or may not display this "noise" in a default window but it can almost surely be made to appear with some zooming in on the horizontal axis (though it is probably instructive to leave the vertical interval as large as [-10, 10], say, since as my numerical example above shows, it's quite reasonable to expect outputs in the single-digit range.) More information about this example is at http://mathforum.org/kb/message.jspa?messageID=4139401 ==============================================================================