Sign in to follow this  

Continuous and differentiable?

Recommended Posts

kSquared    1356
I'm writing a simple symbolic math library as a way to hone my skills (and hopefully to integrate some statistics-based functionality into my game AI). One of my methods determines if a piecewise function is continuous and differentiable. But I've run into a problem here. Suppose that f(x) = {0, x <= 0; e-1/x, x > 0}. Is f(x) continuous? If so, is it differentiable? If you looked at a graph, you'd probably guess that it is indeed continuous and differentiable. But while it's defined at zero, there will be an infinitesmal break at f(0 + dx) = e-1/dx. If I let dx go to zero, the difference also shrinks to zero. This suggests both continuity (since the function has equal limits from both sides) and differentiability (since the derivative is equal from both sides), but am I missing something here? For now, my algorithm assumes a function is "numerically continuous" if the difference between f(x) and f(x + epsilon) (where epsilon is the smallest possible value that can be represented in an IEEE floating-point number) is less than a specially determined constant. [Edited by - kSquared on March 29, 2005 1:39:07 PM]

Share this post

Link to post
Share on other sites
Dmytry    1151
I remember that function as some classical example...
Let's take derivative:
e-1/x ' = e-1/x / x2
and find limit at 0:
lim(e-1/x / x2 , x-->0) = lim(e-y*y2, y-->infinity) = 0
As you can see, limit of derivative is 0. And limit of function is 0.

So we have:
lim((f(0)-f(-dx))/dx, dx-->0) = lim((f(dx)-f(0))/dx, dx-->0) = 0 .
edit: actually it should be written clearer as
lim((f(dx)-f(0))/dx, dx-->0 +) = lim((f(dx)-f(0))/dx, dx-->0 -) = 0

And, IIRC that means it is differenciable in point x=0 by definition.
edit: mathworld , look right under 6 . (Wording is kinda unclear, but as i understand, existence and equality of both limits is both necessary and sufficient , and continuity alone is not.)

As about your algorithm... with many functions in most points you will have
f(x+epsilon)=f(x) because of roundoff errors. Also, with such "bad" functions involving divide by zero, you'll have computational problems...

edit: or take for example sum of sine waves
f(x)=sum(n=0..infinity, sin(x*(e^n))/(e^n))
f is finite and lim(f(x+dx)-f(x))=0 , but lim((f(x+dx)-f(x))/dx) does not exist and therefore function is not differentiable...

[Edited by - Dmytry on March 29, 2005 2:51:38 PM]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this