how do I test if a function is continuous

asked 2020-07-04 19:34:36 +0100

lolora gravatar image

Is there a way to test programmatically if a function is continuous?

e.g $f(x) = \frac{1}{x} $

I'm looking for a function is_continuous(f) = False

edit retag flag offensive close merge delete

Comments

2

I don't think it is possible to implement such an algorithm. Proving that a function is continuous can be very hard. For a given point it is possible to compare the left and right limits, but you would need to do this test for every point, and even that is not enough.
If your functions are simple enough, you can try to look for zeros in the denominator.

Florentin Jaffredo gravatar imageFlorentin Jaffredo ( 2020-07-04 22:37:55 +0100 )edit

Florentin, your example isn't good enough:

sage: abs_symbolic(x).limit(x=0,dir="-")
0
sage: abs_symbolic(x).limit(x=0,dir="+")
0

and even : sage: abs_symbolic(x).limit(x=0) 0

But isabs continuous in 0?

Worse : think of the (boolean) function indicating if its argument is rational. Is it continuous or not ? (Hint : that's a nice counter example, abundantly discussed...).

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2020-07-05 15:22:45 +0100 )edit

Isn't abs continuous in 0?
For your second example (does it exist as a symbolic function in Sage?) the limit doesn't even exist, so of course it cannot be continuous. Here is an example that doesn't work: f: x->0 if x!=0 else 1.
I know this is not a real criteria, that's why I added "and even that is not enough". It was just meant to show how hard this problem is.

Florentin Jaffredo gravatar imageFlorentin Jaffredo ( 2020-07-05 19:43:47 +0100 )edit
1

I agree that continuity can't be determined in general but it seems possible when it involves the typical functions learned in high school mathematics. For example you can go to Wolfram Alpha and type in is 1/x continuous and get an answer to that specific problem and many others. The example you chose, 1/x, is a rational function so it's just a matter of finding when the denominator is 0.

dazedANDconfused gravatar imagedazedANDconfused ( 2020-07-06 01:59:42 +0100 )edit