ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 06 Jul 2020 01:59:42 +0200how do I test if a function is continuoushttps://ask.sagemath.org/question/52325/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
Sat, 04 Jul 2020 19:34:36 +0200https://ask.sagemath.org/question/52325/how-do-i-test-if-a-function-is-continuous/Comment by Florentin Jaffredo for <p>Is there a way to test programmatically if a function is continuous?</p>
<p>e.g
$f(x) = \frac{1}{x} $</p>
<p>I'm looking for a function is_continuous(f) = False</p>
https://ask.sagemath.org/question/52325/how-do-i-test-if-a-function-is-continuous/?comment=52328#post-id-52328I 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.Sat, 04 Jul 2020 22:37:55 +0200https://ask.sagemath.org/question/52325/how-do-i-test-if-a-function-is-continuous/?comment=52328#post-id-52328Comment by Florentin Jaffredo for <p>Is there a way to test programmatically if a function is continuous?</p>
<p>e.g
$f(x) = \frac{1}{x} $</p>
<p>I'm looking for a function is_continuous(f) = False</p>
https://ask.sagemath.org/question/52325/how-do-i-test-if-a-function-is-continuous/?comment=52343#post-id-52343Isn'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.Sun, 05 Jul 2020 19:43:47 +0200https://ask.sagemath.org/question/52325/how-do-i-test-if-a-function-is-continuous/?comment=52343#post-id-52343Comment by Emmanuel Charpentier for <p>Is there a way to test programmatically if a function is continuous?</p>
<p>e.g
$f(x) = \frac{1}{x} $</p>
<p>I'm looking for a function is_continuous(f) = False</p>
https://ask.sagemath.org/question/52325/how-do-i-test-if-a-function-is-continuous/?comment=52339#post-id-52339Florentin, 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 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...).Sun, 05 Jul 2020 15:22:45 +0200https://ask.sagemath.org/question/52325/how-do-i-test-if-a-function-is-continuous/?comment=52339#post-id-52339Comment by dazedANDconfused for <p>Is there a way to test programmatically if a function is continuous?</p>
<p>e.g
$f(x) = \frac{1}{x} $</p>
<p>I'm looking for a function is_continuous(f) = False</p>
https://ask.sagemath.org/question/52325/how-do-i-test-if-a-function-is-continuous/?comment=52353#post-id-52353I 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](https://www.wolframalpha.com/) 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.Mon, 06 Jul 2020 01:59:42 +0200https://ask.sagemath.org/question/52325/how-do-i-test-if-a-function-is-continuous/?comment=52353#post-id-52353