existence of antiderivatives of nasty but elementary functions In discussing with my honors calculus class the fact that some continuous elementary functions do not have an elementary antiderivative, I realized I was unsure whether every discontinuous elementary function has an antiderivative at all.
The answer may depend on the precise definition of elementary function one uses.  Note that the elementary function $\sqrt{x^2}/x$ equals +1 or -1 according to whether $x$ is positive or negative, and is undefined at $x=0$.  Of course this particular discontinuous elementary function has an antiderivative on its domain.  But once you have discontinuous functions like this, and you have trig functions, and you start forming compositions, you can get fairly nasty functions with infinitely many discontinuities, and it's not obvious to me that a function of this kind with domain $D$ necessarily has an antiderivative on $D$.
 A: This shows that "elementary function" needs a good definition.  We do NOT want to allow, for example $f(x) = 1$ when $x$ rational and $f(x) = -1$ when $x$ irrational.  Even though $f^2 = 1$, this $f$ is not an algebraic function.
So, correctly defined, an elementary function is an analytic function on a domain in the complex plane, such that ...... [fill in the usual conditions]
Added later. My advice:  For "elementary function" do not use the popularized form of the
definition as in Wikipedia.  Instead, use a definition from
the actual mathematics papers.  (Papers with proofs, not
just quickie approximate definitions for the masses.)  
For example  
"Integration in Finite Terms", Maxwell Rosenlicht,
The American Mathematical Monthly  79 (1972), 963--972.
Stable URL: http://www.jstor.org/stable/2318066
Everything is carried out in differential fields ... In particular, every function involved is infinitely differentiable ... None of those
"discontinuous elementary functions" mentioned in the question.
Not even $|x| = \sqrt{x^2}$ is elementary.
===========  
"Algebraic Properties of the Elementary Functions of Analysis",
Robert H. Risch,
American Journal of Mathematics 101 (1979) 743--759.
Stable URL: http://www.jstor.org/stable/2373917 
He also works in differential fields.  Some quotes:  
The elementary functions of a complex variable $z$ are those analytic functions that are built up from the rational functions of $z$ by successively applying algebraic operations, exponentiating, and taking logarithms. As is well known, this class includes the trigonometric and basic inverse trigonometric functions.  
[Part II]
Suppose $\mathbb{C}(z, \theta_1, \dots, \theta_m) = \mathcal{D}_m$ is the abstract field, isomorphic to a field of meromorphic functions on some
region $R$ of the complex plane, ...  
==========  
A: I assume you want $f$ to be defined everywhere on $D$.  In that case, it's pretty clear for an "elementary" function like $\tan x$ that $D$ needs to have holes in it, and it's totally unclear what an integral "across" these holes should mean (from a real-variable perspective).  You also probably don't want to consider functions whose integrals don't exist because they diverge, since you asked about discontinuities and unboundedness is a different reason for the integral not existing.  That means you should really only consider the case where $D$ is a closed interval and $f$ is bounded.
In that case, there is a theorem due to Lebesgue which states that a function on a closed interval $[a, b]$ is Riemann integrable if and only if it is bounded and also continuous almost everywhere.  This is true of essentially every reasonable "elementary" function I can think of; if you can write down an "elementary" function which is discontinuous on a set of positive measure then your definition of elementary is in trouble!
Edit:  The functions you listed in your comment all have the property that they are continuous on intervals where they are defined, so they'll all have the above property and so will sums, products, and compositions thereof.  
A: "Integration in finite terms" uses an exact definition of the class of elementary functions. According to J. F. Ritt, $\exp$, $\ln$ and the algebraic functions are analytic almost everywhere, and therefore the elementary functions.
"Integration in finite terms" treats only formal antiderivatives. Clearly, the concrete antiderivative depends on the concrete domain of the function in the integrand. If you integrate functions by applying other methods, you have also make decisions about the domain of the functions.
A: I haven't a concrete example but there is a theorem that says that the derivative of a function has the intermediate value property. This fact makes me think that could be a elementary function without antiderivative.
EDIT:
I am going to be more explicit:
If f is a elementary function, it is defined in the interval (a,b), and it is the derivative of another function (not necessary an elementary function) then f satisfies the intermediate value property inside (a,b).
A: Just to reiterate: we need to know what you have in mind by an elementary function.
The algebraic approach is to take say polynomials, $\exp(x)$ and perhaps $\ln(x)$ and then to say a function is elementary if it can be written in terms of these using operations of linear combinations, multiplication, composition. Then there are elementary functions with no antiderivative. So the obvious thing to do is to extend the definition of elementary function to include these antiderivatives. The theorem is that this doesn't work.
There are algorithms which are implemented in computer algebra systems which given an elementary function will either find an antiderivative or will prove that no elementary function is an antiderivative.
Response This answers the question the OP asked with the definition of elementary that OP intended. This appears to have caused offence so I wish to state my position.
It is a fact of life that in the classroom and in computer algebra systems that functions are described by formulae. This leads to many problems and the (now defunct) symbolic algebra newsgroup was inundated with complaints from people who did not appreciate the limitations of this approach.
There are several interesting discussions we could have on the issues that arise from this but I don't think this would be welcome on this site.
A: What about something like $\sqrt{cos(x)-1}$?  This function is just a bunch of discrete points sitting at $(2n\pi,0)$, but it is a composite of functions most people would consider elementary.
