# how do I test if a function is continuous

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

how do I test if a function is continuous

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

Asked: **
2020-07-04 12:34:36 -0500
**

Seen: **60 times**

Last updated: **Jul 04**

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.

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, your example isn't good enough:

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

But is

`abs`

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...).

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.

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.