When I teach calculus, I really try to stress the importance of knowing the domain of a function. 


One example that I sometimes like to use to show students the importance of inspecting the domain is the following: $f(x) = \sqrt{\sin(x)-1}$. I ask the student to differentiate this function, and they happily apply their formal rules to obtain $f'(x) = \frac{\cos(x)}{2\sqrt{sin(x) - 1}}$. Then I ask them to graph the original function. Hey, it is just a discrete set of points! I think at this point they realize that the differentiation they did was totally meaningless, and that paying attention to the domain might be a good idea.


One defect with this example is that the derivative really does fail to exist everywhere - it has no domain. I would like an example of a rule for a function whose "largest domain" (the domain where the rule can be evaluated) is a discrete set of points, but where formally differentiating the rule yields a derivative which has a nonempty "largest domain". I have thought off and on about this for a while now, and was hoping the collective MO community might be able to come up with something. Or perhaps someone might be able to prove that the standard "formal rules of differentiation" (say from Stewart's calc book), and the standard list of "common functions" are incapable of producing such an example. I would be happy either way.



Can formally differentiating give a derivative of a discrete function?
How about $y=\log(-x^2)$?


