discontinuities

My calculus book says that y = (x^2 - 2)/(x - sqrt(2)) is discontinuous at 2, but Maple finds a limit of

 

          -( 2/(-2 + sqrt(2))

 

I get the same result manually, and a plot of the function shows a straight line with no discontinuities.

 

Is the book in error?

 

Alla

 

 

Comments

alec's picture

at sqrt (2)

It is not defined at x=sqrt(2). All rational functions are continuous in every point they are defined, including x=2 in this example.

To be continuous at some point x=a, a function f should satisfy 2 conditions:

a) be defined at that point;

b) the limit of f at that point should exist and should be equal to f(a).

In your example, the function is not continuous at x=sqrt(2) because the condition a) is not satisfied - it is not defined there.

Such discontinuities, with existing limit, are called 'removable' - the function becomes continuous (at that point) after extending its definition to being equal to the limit at that point.

Alec

So, the book's error is typographical?

Alec:

Are you saying that the book's error is typographical?  That the discontinuity is at x= sqrt(2), not 2?

Alla

alec's picture

Yes

Yes.

Publishing is a complicated process, especially in math, so such things happen from time to time. Authors usually put errata (a collection of known typos) on the book web pages if such pages exist.

Alec

Discrepancy persists

Alec:

Trying x = sqrt(2) yields a limit of 2 sqrt(2).  Still no discontinuity.

Alla

alec's picture

Condition a)

I already said about that - there should be 2 things for continuity - the function should be defined, the limit should exist, and the value of the function should be equal to the limit.

In this case, the limit exists, but the function is not defined, so it is a discontinuity.

Maple has a function discont for finding discontinuities. It works well in this example,

discont((x^2-2)/(x-sqrt(2)),x);
                                  1/2
                                {2   }

If you do a plot, this point should be represented on it as an empty circle. Something like that,

with(plots): 
a := plot((x^2-2)/(x-sqrt(2))): 
b := pointplot([sqrt(2), 2*sqrt(2)+0.05], 
    symbolsize = 15, symbol = circle, color = blue): 
c := pointplot([sqrt(2), 2*sqrt(2)+0.05], 
    symbolsize = 10, symbol = solidcircle, color = white): 
display(a, b, c);

Alec

Still no resolution

Alec:

We are still not communicating too well.  I agree there's a discontinuity at sqrt(2), but why is Maple giving me a limit of 2*sqrt(2) instead of "undefined." And why does plotting show no discontinuity?

Alla

alec's picture

Limit

Limit exists, it is correct. In more detail, if you factor the numerator,

x^2-2 = (x - sqrt(2))*(x+sqrt(2))

and then cancel the (x-sqrt(2) term, you get x+sqrt(2). The function is equal to that in every point except x=sqrt(2). That's why the limit exists. It is not "undefined". And it can be seen from the plot.When x is approaching sqrt(2), y is approaching 2*sqrt(2) which is the limit.

The plot in Maple is constructed from points - in this example, 49 points, connected with line segments. The x-coordinates of points missed value x=sqrt(2), and there are no any problems in other points. So Maple connected those 49 points and got a straight line.

The correct plot should look as in the example I posted above.

Alec

 

Further questions

Alec:

 

Thanks for your patience.  I'm following you up to a point.  If you factor the numerator, you do get x + sqrt(2).  And if you substitute sqrt(2) for x, you get 2*sqrt(2) for the limit.  My questions are:

 

1) Since the limit is found in the same way as any continuous function, why is this called a removable discontinuity?  I thought that meant that some operation (a definition) was necessary to remove the discontinuity, but apparently it means: ignore the discontinuity.  Is that a fair statement?

 

2)  There are three other discontinuities listed in Thomas & Finney.  Two of them -- jump discontinuity (y = x*floor(x) @2) ) and infinite discontinuity (y = 1/(x - 2) @ 2) -- do show up as "undefined" when I ask Maple for the limit.  The third, oscillating discontinuity (y = sin(1/x) @ 0) yields a range of  -1..1, which I understand from Help that this is how Maple responds to that sort of discontinuity.  But we do get a limit in the present case, so is it properly labeled as a discontinuity?

 

3) If Maple had not missed the value x = sqrt(2), would it have drawn the graph differently?

 

4) Could you indicate exactly how I find the correct plot you posted?

 

Again, many thanks for this valuable information.

 

 

 

 

 

 

 

Alla

 

 

alec's picture

Some answers

1) I think, it is called removable, because the function can be made a continuous function after defining its value at that point being equal to the limit. For the other types of discontinuities that can not be done.

2) The jump discontinuities have the left and the right limits, but they are different. Infinite discontinuities have either left, or right limit infinite. "Oscillating" discontinuity doesn't have eiher left, or right limit. As one can see, all of them have some specific features. In many cases (but not all) the function is not defined at the discontinuity point. So it is usually good to check first. If a function is not defined - then it is a discontinuity and you don't even have to evaluate the limit to tell that. In particular, in your original example,

f:=x->(x^2-2)/(x-sqrt(2)):
f(sqrt(2));
Error, (in f) numeric exception: division by zero

One should be careful with that though, because Maple is not very good with that. See that thread, for example.

3) I think, it misses the singularity in most examples. It would be interesting actually to find an example in which the plot command would hit the discontinuity exactly, and see what happens. I don't know.

4) I tried to post a plot, but all the exports looked very bad. See that one, for example.

Also, there is a good SAGE tutorial for Calculus at that link. You might try it in addition (or instead) of Maple. SAGE developers are mathematicians, so Calculus in SAGE may be more mathematically correct than in Maple.

Alec

Mathematicians

1. I suspect that the people who write the calculus routines for most computer algebra systems are in fact mathematicians -- that in itself is certainly no guarantee of quality software.

2.  What is a "mathematician" anyway?  Do you have to have a Ph.D? Is a masters okay? What if that degree is in physics, engineering or computer science? Can you still be a mathematician in that case? 

3. Assertions about "the Sage developers" are pretty much irrelevant in this context since Sage outsources most calculus to Maxima.

alec's picture

Mathematicians

1. Who developed Calculus routines in Maple, I don't know. They certainly don't work the way it should.

2. A (pure) mathematician is a person with a PhD in pure mathematics, continuing doing research or teaching after getting his or her PhD. A masters is not OK. Degree in physics, engineering, or computer science also don't qualify, as well as a degree in applied mathematics, or computational mathematics. You can be a (pure) mathematician in those cases if you get a PhD in pure mathematics in addition to other degree, and continue doing research and/or teaching after that. Every rule has exceptions, and I know a few exceptions to that, but that is, I think, the usual meaning of the term.

3. The current situation with Calculus in SAGE, if I understand is correctly, is following. It uses wrappers (written in SAGE, or Python) for Maxima and some other packages. During this Summer many of them were replaced (or planned to be replaced) with SAGE and Cython code. Currently, it is a project in development. Being mathemathicians, and teaching Calculus, in particular, provides some warranties that the things are done right, i.e. usable for teaching Calculus.

Alec

Mathematicians

Alec

 

You write "SAGE developers are mathematicians, so Calculus in SAGE may be more mathematically correct than in Maple." Are you trying to say that Maple developers are not mathematicians?

David Clayworth Maplesoft GUI Developer

alec's picture

Mathematicians

David,

I am saying that many things in Maple are done in a way that contradicts usual practise in both research mathematics and teaching mathematics. Nobody doing research or teaching himself or herself would do it that way. Whether Maple developers got a proper mathematical education, I don't know, and I didn't imply that they did or did not.

Alec

JacquesC's picture

Calculus developers

The original authors of a lot of Maple were computer scientists and not pure mathematicians.  They believed that mathematics, as taught to them in their undergraduate mathematics courses, could be implemented as a set of direct rules (because it feels like that in undergraduate mathematics).  Unfortunately, with enough mathematical education, you realize that that is quite wrong, and that even simple mathematics is much more complicated than that.  Unfortunately a lot of the incorrect design decisions that were taken in the early days by these (otherwise brilliant!) computer scientists were so deeply buried in the fabric of Maple that many of them took years of hard work to 'undo'.  I know, I was one of the people who spent years repairing Maple after the over-simplification of (x^2)^(1/2) was removed from Maple's kernel.  Very slowly, over the past 15 years, more of these have been 'fixed'.  But there are some over-simplifications which remain, and they may never be fixed, not without creating a whole new system.

Other parts of Maple are 'broken' because there are huge holes in the theory.  For example, Calculus is all about functions, while Maple is not at all about functions, it is about expressions.  It other words, it is about syntactic expressions which are supposed to denote functions.  Unfortunately, there is no denotational semantics for open terms!  [defn: open term = term with free variables].  Just as bad, if you use the naive interpretation of open terms as being implicitly quantified (or more precisely, an implicit lambda), that still doesn't help much because:

  1. The lambda calculus is usually typed -- but what is supposed to be the domain of definition?
  2. Not all Maple expressions are functions, some are meant to be formal objects (like polynomials or series, for example)
  3. The denotational semantics of the lambda calculus is via pointwise evaluation, and functions are all assumed to be total [partial functions are totalized by adding an explicit 'bottom' element].  This is not standard mathematics!

I could go on, but that is probably enough.

I know that many of the current Maple developers are indeed mathematicians -- and I know several who would really love to fix several of those early mistakes, but who also know that it may never happen.

I should point out that, without some serious theoretical work, I don't think the SAGE developers have much chance to really improve things either.  The problem is quite deep.  If it was possible to 'algebraize' calculus, I am quite sure that the Axiom people would have done so long long ago -- but they didn't.  There is a good reason for that!

I do not understand

some things that you say as I am not conversant with CS and its jargon:

while Maple is not at all about functions, it is about expressions.

Isn't Maple also about procedures?

Unfortunately, there is no denotational semantics for open terms! [defn: open term = term with free variables].

Could you give an example of these "open terms"?

I have only a vague idea about lambda calculus. Indeed, what I am reading from the Wikipedia article sounds as if it deals with a (toy?) model for mathematical functions. Presumably, this is what you mean.

So, is there a proof (theorem) showing the imposibility to 'algebraize' calculus?

In case that this was shown, is it equivalent to say that calculus by computer is imposible? (for definiteness,  an ordinary computer, presumably equivalent to a Turing machine).

 

 

alec's picture

Steps

The calculus taught for undergraduate students shouldn't be very hard to implement. It is very algorithmic.

Maple has problems with that, I think, becase of working with complex numbers.

Generaly, the educational steps developed during hundreds, or maybe thousands years, have big sense, and they were ignored in Maple.

Starting from natural numbers and kindergarten problems, then covering elementary school, then high school problems, then Calculus with real numbers, and only after that starting to think about implementing complex numbers properly beyond quadratic equations (where they should be introduced in high school) would be an easy and natural way of building a CAS.

Currently, there are a lot of kindergarten problems (like solving inequalities with small integer solutions) which can't be solved in maple easily, like, say, using isolve command. Not talking about elementary and high school problems.

Alec

JacquesC's picture

But it's wrong!

The calculus taught for undergraduate students shouldn't be very hard to implement. It is very algorithmic

The problem with that is that the end result is wrong! If you look carefully at the exercises given to students, you'll see that quite a few of them are about cases where the 'rules' do not work (because the function is not continuous enough, there is a singularity, etc, etc). Basically, the calculus is very computational for nice functions, but is very ill-behaved otherwise.  Maple and most CAS assume that all functions are nice, which is where things go horribly wrong.  The side conditions on those 'rules' cannot be ignored -- and it is exactly those side conditions which make things non-algebraic.  The side-conditions are all about analyticity properties, which often (still) do not have good algorithms.  In other words, discharging the side conditions needs a little bit of theorem proving capabilities.  [Which, incidentally, was the reason for assume facility].

As it turns out, complex numbers tends to make things considerably easier, not harder, that is really not the source of the problems.  The source really is that the 'rules' of calculus have important side conditions which Maple ignores, because verifying some of them is too onerous.

If you want a CAS built using your described scheme, take a look at MathXpert.  Personally, I don't think such a system could ever scale up to the power of any decent CAS.

In fact, my current plans for building a solid CAS involve doing exactly the opposite: I start from lots of abstract nonsense, and 'specialize' down to the easier domains.

alec's picture

As I see it

As I see it (and I taught Calculus for more than 30 years), all the exceptions and special cases needed for teaching Calculus, are also very algorithmic. I tried to think about that, and to find an example that couldn't be implemented in a CAS, and I couldn't find one.

The approach of going through Calculus textbooks and implementing the examples and exercises from them seems to be exactly right. As I already said, it would be easier to do starting first from kindergarten, elementary school and high school textbooks.

With complex numbers, the situation is not that simple. If they are implemented correctly, they could be very useful. Unfortunately, the implementation of them in Maple is very basic and in many aspects wrong. It makes many things more complicated instead of making them more simple.

Alec

JacquesC's picture

Terminology

By 'function', I meant the mathematical meaning of function, namely an assignment of a value in a range for values in the domain.  An 'expression', in both logic and CS, is a syntactic term from a (formal) language.  A 'procedure' is then one way to represent a very small class of functions, namely those which are 'computable'.  But mathematics is about much more general functions.

And 'open term' is an expression with free variables in it.  So proc(x) exp(x)-13 end is both a procedure and a representation of a function. exp(x)-13 is an expression and an open term (x is free). In this case, there is a morphism that can go from one to the other, and vice-versa. But consider proc(x) (x-1)/(x-1) end and (x-1)/(x-1). The first is a representation of a function which is 1 everywhere except that it is undefined at 1, while the second is a representation of member of Q(x) which is equivalent to 1.  There is no way to go back-and-forth between these.

The lambda calculus is Turing-complete, so while it may look like a toy, it is extremely powerful.  Its very simplicity makes it easy to analyze.

Most general problems in calculus are wildly uncomputable (or undecidable).  That doesn't mean that there isn't a very useful subset of the problems for which there are efficient decision procedures!  The issue becomes one of being to identify which questions are interesting. 

I believe that computers can be taught to do the same kind of mathematics as humans, given enough time.  What does seem to be impossible is to do calculus by just doing straightforward computations, you have to (compute!) some proofs too.

denotational semantics?

Now, if exp(x)-13 is an expression and an open term, what does it mean that "there is no denotational semantics" for things like that?

alec's picture

A comment about limit

This is, by the way, an interesting example of an expression evaluated as a limit not at "singularity",

singular(exp(x)-13);
                           {x = infinity}
exp(-infinity)-13;
                                 -13

Now, I am still trying to understand what a singularity means in Maple. Is anywhere in the help a definition of it? None of the definitions of a singularity in the Dictionary seem to be working here. Why infinity is a singularity in this example and -infinity is not?

Is anywhere in the help the explanation of the following,

1/infinity;
                                  0

or other operations with infinities? I'm not saying that that doesn't make sense. It makes sense, just not in usual mathematical context.

Alec

JacquesC's picture

denotational semantics

A "denotational semantics" is a way to associate a 'mathematical object' from a (supposedly) well-understood domain to a syntactic expression.

What is exp(x)=13 supposed to be, as a mathematical object?  This may seem like an easy question, but it turns out to be extremely difficult.

For example, not that there is an 'x' in exp(x)-13.  What is that?  exp(x)-13 is not a 'function' [there are no variables in functions].  What is it?

risk

At the risk of being suckered into a deep question by the master, I would say that

exp(x)=13 is an equation, regardless of the context of x.

Something like exp(x)-13 would be an expression. I remember being disappointed that "expression" is not a Maple "datatype" yet the help screens give a decent defintion of expression. (I would like to define "expression" in such a way that equations and inequalities are not expressions, but so that an "expression" is somethat that could parse as one side of an "equation" or "inequality". I do see some pitfalls with this approach)

Something like unapply(exp(x)-13,x) would be a function.

It would be nice if something like this happened:

>type(x^2,expression);

  true

>type(x^2, procedure);

 false (this does happen, of course)

>type(unapply(x^2,x),procedure);

true (this also happens, of course)

 

 

JacquesC's picture

oops

That exp(x)=13 is a typo -- it should have been exp(x)-13 as well.

Of course, saying that exp(x)=13 is 'an equation' doesn't help unless you define what that is!

Two questions answered

Alec:

I can answer the first question I posed: by factoring & canceling x-sqrt(2) the discontinuity is removed. It is not necessary in this case to assign a value.

As to question 4, I was looking for an actual plot somewhere, but what you posted was Maple code for the graph, not the graph itself.

I'm still left with the issue of whether the "removable discontinuity" belongs in the same typology as the other three discontinuities.

Allan

Plotting with the discont option

As Alec points out, when you plot a function (an expression in Maple), that function is sampled over the given range. The values computed at those sample points are then connected. You can provide the 'discont' option, and the plot command will try to avoid connecting points over discontinuities. However, removable discontinuities are ignored, as stated on the plot/options help page under 'discont'. Nevertheless, you can create a plot showing the discontinuity by using the pointplot command to draw a circle, as Alec shows in his post.

I'd also recommend that you look at some of the interactive tutors available with the Student packages. Go to the Tools Menu and choose Tutors, to get started. These may not generate the exact plot you're looking for, but they may be helpful in understanding the properties of the function you're investigating.

Paulina Chin
Maplesoft

What is a function?

as a mathematical object. Which is its notation? These seems to be the first questions to be answerd then.

I see that there are many definitions around. I find eg:

Mathworld:

 Several notations are commonly used to represent (non-multivalued) functions. The most rigorous notation is x->f(x), which specifies that f is function acting upon a single number x (i.e., f is a univariate, or one-variable, function) and returning a value f(x). To be even more precise, a notation like "R->R, where f(x)=x^2" is sometimes used to explicitly specify the domain and range of the function. The slightly different "maps to" notation x|->f(x) is sometimes also used when the function is explicitly considered as a "map."

Generally speaking, the symbol f refers to the function itself, while f(x) refers to the value taken by the function when evaluated at a point x. However, especially in more introductory texts, the notation f(x) is commonly used to refer to the function f itself (as opposed to the value of the function evaluated at x). In this context, the argument x is considered to be a dummy variable whose presence indicates that the function f takes a single argument (as opposed to f(x,y), etc.). While this notation is deprecated by professional mathematicians, it is the more familiar one for most nonprofessionals. Therefore, unless indicated otherwise by context, the notation f(x) is taken in this work to be a shorthand for the more rigorous x->f(x).

I disagree here in that most professionals that I know, except  perhaps  mathematicians,  use f(x) to denote a function. Ie x in exp(x)-13 is meant a dummy variable. If this is good or bad for computational purposes seems another issue.

Wikipedia:

Set-theoretical definitions

A function ƒ is an ordered triple of sets (F,X,Y) with restrictions, where

F (the graph) is a set of ordered pairs (x,y),
X (the source) contains all the first elements of F and perhaps more, and
Y (the target) contains all the second elements of F and perhaps more.

The most common restrictions are that F pairs each x with just one y, and that X is just the set of first elements of F and no more.

This definition of function does not contain  "x". Is something like this one what you mean?

JacquesC's picture

A function

The definition I was using is that a function f is any element of A -> B where A and B are sets.  I find the MathWorld definition hopelessly confused in its notation, while the Wikipedia entry seems to confuse relation with function [ie the definition without the restriction is for a relation, not a function].

Note that if A=B=reals, then the number of elements of A -> B is huge, and most of them cannot be 'named', although they are all functions.  This simple cardinality argument shows that there must be a difference between 'mathematical function' and 'computable function' (ie algorithm). 

computable functions

Restricting to this case,  a "computable function" would be completelly specified by the sets A, B and the map, something like (A,B,exp(x)-13) where x is understood as an element of  A, isn't it?

 

JacquesC's picture

on computable functions

Actually, "computable functions" are defined in rather technical terms (using rapidly converging approximation and Turing machines).  This in turn leads to a fascinating theorem: all "computable functions" are continuous!  In other words, if you define a "function" as something that can always be evaluated (at all representable points) to arbitrary precision, then the only ones you can represent are the continuous ones.  Note that the assumptions are fairly strong, but that this is so (i.e. that merely asking for evaluation to arbitrary precision everywhere) is actually a fairly deep theorem.

computable is continuous?

Then piecewise(x<0,0,1) is not computable?

JacquesC's picture

That's right

That is because if you "evaluate" that function at a very complex expression which is actually 0 but cannot be determined to be equal to 0 (of which there are many), then any kind of approximation of the input will not be able to determine if the output should be 0 or 1.

Note that there are notions of left- and right-computability, where the above becomes right-computable (as it is right-continuous).  But piecewise(x<>0, 0, 1) is not computable in any setting, because it is impossible (through finite computations) to know if the input is equal to 0 or not.  This is, admittedly, a weird area of computer science!

Like chaos

This sounds to me like the subject of chaotic dynamical systems, because of the so called  "sensibility" under perturbations of the initial contidions.

fuzzy zero

I guess the point is that you cannot always decide if a certain number is zero. For example, think about the Goldbach number: g=0.000...x...000 etc., where the kth bit is 0 if 2*k is the sum of two odd primes (k>2), and 1 otherwise. Is g=0? 

One can imagine that the Goldbach conjecture is undecidable, in which case g is not computable. Of course most people think that someday somebody will prove the conjecture, but this is a nice colloquial example. It makes the point how a well-defined number might not be computable.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}