Why can't calculus be done on the rational numbers? I was once told that one must have a notion of the reals to take limits of functions. I don't see how this is true since it can be written for all functions from the rationals to the rationals, which I will denote $f$, that
$$\forall L,a,x:(L,a,x\in\mathbb{Q})\forall \epsilon:(\epsilon>0)\space \exists\delta:(\delta>0)$$
$$\lim_{x\rightarrow a}f(x)=L\leftrightarrow(\mid x-a\mid<\epsilon\leftrightarrow\mid f(x)-L\mid<\delta) $$
Since, as far as I know, functions like $\mid x\mid$ and relations like $<$ can be defined on the rationals. Is it true you couldn't do calculus on just the rational numbers? At the moment I can't think of any rational functions that differentiate to real functions. If it's true that it isn't formally constructible on the rationals, what about the algebraic numbers? 

Edit
Thanks for all the help, but I haven't seen anyone explicitly address whether or not we could construct integrals with only algebraic numbers. Thanks in advance to anyone who explains why or why not this is possible.
 A: This is a slightly softer answer.
You can 'do calculus' in-so-far as you can define the derivative and perhaps compute some things. But you'll get no theorems out: the main interval theorems (the Intermediate Value Theorem and the Extreme Value Theorem) rely heavily on the fact that the real numbers are complete, which the rationals aren't. In fact, the 'Intermediate Value Property' is equivalent to the completeness of the reals, and I'm pretty sure the 'Extreme Value Property' is as well.
Going on from there, Rolle's Theorem depends on the Extreme Value Theorem, the Mean Value Theorem depends on Rolle's Theorem, and Taylor's Theorem depends on the Mean Value Theorem.
Going in a different direction, L'Hopital's Rule is typically proven using the Cauchy Mean Value Theorem, which of course depends on the Mean Value Theorem. I don't know if there's some way to prove L'Hopital's Rule without this dependence, but I expect that if it's possible then the proof will depend crucially on completeness.
Above all, much of the usefulness (and beauty) of calculus comes from the theorems mentioned above. So while you can set up the usual definitions in non-complete spaces, and you may even be able to get some partial results, you eventually reach the question: is this really worth calling 'calculus'? It certainly doesn't compare to the real-variable theory.
This is all not-to-mention the lack of a meaningful theory of integrals, which is detailed in other answers.

Addendum: Consider the 'rational complex numbers' $\mathbb{Q}[i]$. If you like, you can extend your rational calculus to $\mathbb{Q}[i],$ but I don't think it will bear much resemblance to complex analysis. As a first example, the fact that satisfaction of the Cauchy-Riemann equations, along with continuity of partial derivatives of real and imaginary parts, implies complex differentiability of a complex function at a point depends, at least in the proof I've seen, on the Mean Value Theorem.
A: The simple answer here is that the Riemann Integral doesn't allow for you to have infinite discontinuities like that; this is a strong motivator for some uses of Lebesgue Integration. However, even if we consider the function
$$f(x)=\begin{cases}0,&\text{if }x\in \mathbb{Q}\\
1,&\text{if }x\notin \mathbb{Q}\;.
\end{cases}$$
and we try to integrate over the domain $x \in [0,1]$ we find that
$$\int_{[0,1]} f(t) dt = \int_{[0,1] - \mathbb Q} f(t) dt + \int_{\mathbb Q} f(t) dt = \int_{[0,1]- \mathbb Q} dt= 1$$
With measure $0$ the rationals simply aren't strong enough for many uses even in this context... the rationals are countable, and you can imagine an integral over the rationals as being an integral over a real function with infinite holes. This breaks many of the requirements for simple integral and derivative properties, fails to satisfy basic differential equations, etc. Now, you can define your own integral over the rationals and find what properties it satisfies, but you'll soon hit your limitations. Note that the concept of the derivative also gets a little tougher to define at any rational point due to the countability of the set, as a result of having to mess with the standard definition of continuity (again, you could simply take the inverse functional of the integral I said you could design earlier, but you will get a fundamentally different derivative)
A: You can define limits of functions from $\mathbb{Q}$ to $\mathbb{Q}$ and also define limits of sequences with rational values and thus in general any concept based on limit of functions and sequences can be developed easily (almost in line with the way usual calculus is developed with real numbers). In particular it is possible to define derivatives and Riemann integrals.
However such a system of calculus over rationals will be almost totally uninteresting because it will lack all the significant theorems of calculus which are based on completeness property of real numbers. In essence the "calculus over rationals" will be nothing more than just fancy algebra. In general most of the interesting limits will not exist in this system.
It is a rather deep misconception that the power of calculus is because of ideas like derivatives and integrals (differential and integral calculus). The power of calculus comes entirely out of the structure of real numbers and by a sheer act of smartness/shrewdness the importance of real numbers is never emphasized in introductory calculus textbooks and students are left with the feeling that the strange new techniques of derivatives / integrals and their applications are the backbone of calculus.
A: Something the other answers haven't really brought up is that it is profitable to study rational functions defined over the rationals using (among other things) some techniques from differential calculus.  This is done in arithmetic algebraic geometry (also known simply as "arithmetic geometry.")
A: Just some warning this answer may contain traces of engineering math.
You clearly can do calculus on rational numbers since 


*

*Computers and electronics are not able to / focused on representing irrational numbers.

*There are plenty of useful applications utilizing differential calculus in basically all fields of science and engineering by now. 
But one needs to consider at least two facts:


*

*You can approximate real numbers as well as you want or need to with rational numbers.

*Differentiation in practice is never purely infinitesimal. Anything that is measurable in our world is when measured (a.k.a. sampled) in some sense a sum or an integral, so whatever you would hope to calculate a differential on is in fact a differential onto an integral or approximation by finite difference of such sums.

A: By the way, I just recently found that the completeness of the field we're working over is equivalent to the Intermediate Value Theorem for functions over that field. Since the rationals are incomplete, IVT does not apply. I know IVT is necessary with the Extreme Value Theorem to prove the Mean Value Theorem for Integrals, so it would certainly be impossible to prove FTC for the rationals although I don't know that the absence of IVT would have any effect on differential calculus.
A: If you handle real-valued functions defined on the rationals, then these functions are obviously not Lebesgue-integrable with respect to the $\sigma$-algebra of $\mathbb{Q}$ inherited from $\mathbb{R}$, except when they vanish outside finite sets.  This is because the only sensible measures on the rationals are those that place a weight on each rational number.  However, this will guarantee that the traditional derivative and the Lebesgue-antiderivative of a function have completely nothing to do with one another.
On the other hand, there may be some sense in finding the Riemann-integral of such a function, given that it is sufficiently nice.  For example, continuous functions (with respect to the topology on the rationals inherited from the reals) may work well.  One can simply lend the usual theory and demand that the partitions are done at rational points.   Anyhow, I would expect many odd things to happen.  Brevan Ellfsen's function would indeed be continuous relative to the rationals, i.e., the zero function, with constant functions as Riemann-antiderivatives, but as Henry Swanson's shows, there are also non-constant functions with this zero derivative.
A: It seems like most people are talking about integrals; let me answer with the first thing that popped into my head about derivatives.

$$\lim_{x\rightarrow a}f(x)=L\leftrightarrow(\mid
 x-a\mid<\epsilon\leftrightarrow\mid f(x)-L\mid<\delta) $$

While this may be a fine definition for rational-restricted limits, it winds up saying nothing about non-rational limits. Which are almost all of them. For example, the sequence {1, 1.4, 1.41...} approaching $\sqrt{2}$ has no limit according to this (rational-restricted) definition. 
Likewise if we seek to use the definite integral as the area under some curve, then we find that the rationals are a set of measure zero and therefore the area over that set is automatically zero.  
In short, because rationals are a set of measure zero, they account for almost none of the limits on rational functions or sequences, and no area under any curve of interest. I do find that a tiny bit of knowledge of Lebesgue measure theory makes a lot of this stuff immediately clear. 
A: Based on your comments, I think you might be particularly interested in the theory of real closed fields, or more generally, real algebraic geometry.
There is a formal, logical sense in which all real closed fields are the "same", and two prominent examples of real closed fields are the real numbers and the real algebraic numbers.
By leveraging this "sameness", it turns out that a large fragment of calculus still works the same way if you stick to algebraic numbers and algebraically defined functions.
It's mainly notions like continuity, completeness, or differentiation that carry over well; other techniques can be developed too, but I believe they tend to follow more along the lines of algebraic geometry than that of the calculus of real numbers.
A: $\newcommand{\QQ}{\mathbb{Q}}$
Derivatives don't really go wrong, it's antiderivatives.
(EDIT: Actually, the more I think about it, this is just a symptom. The underlying cause is that continuity on the rationals is a much weaker notion than continuity on the reals.)
Consider the function $f : \QQ \to \QQ$ given by
$$f(x) = \begin{cases} 0 & x < \pi \\ 1 & x > \pi \end{cases}$$
This function is continuous and differentiable everywhere in its domain. If $x < \pi$, then there's a neighborhood of $x$ in which $f$ is a constant $0$, and so it's continuous there, and $f'(x) = 0$. But if $x > \pi$, there's a neighborhood of $x$ in which $f$ is a constant $1$, so it's continuous there too, and $f'(x) = 0$ again.
So the antiderivatives of $0$ can look rather messy. By adding functions like this, you can construct arbitrarily "jagged" functions with zero derivative. As you can imagine, this completely destroys the Fundamental Theorem of Calculus, and any results that follow from it.

This can happen in the real line to some extent, but it's not nearly as bad. The traditional antiderivative of $1/x$ is $\ln|x| + C$. But so is the following function:
$$ g(x) = \begin{cases} \ln x + C_1 & x > 0 \\ \ln(-x) + C_2 & x < 0 \end{cases} $$
By changing $C_1$ and $C_2$, we can push the two halves of the real line around completely independently. This is only possible because $1/x$ isn't defined at $0$, and so we've "broken" the real line at that point.

If you like dumb physical metaphors, here's one:
The real line is kind of like an infinite stick. If you wiggle a section of it, the whole thing must move.
With the $1/x$ example, you've made a cut at $x = 0$, and now you have two half-sticks. They can be wiggled independently, but each half must still move as a unit.
The rational numbers are more like a line of sawdust. You can't really move one grain by itself, but you can certainly take an interval and move it around independent of its neighbors.
By completing the rationals, you're adding all the glue between the grains to form a stick again. (I hope no one from diy.stackexchange is reading this...)
A: On the rational numbers you can not really do Algebra, much less Calculus.
Since the rational numbers are not "complete", you can not for instance define the square root function. Similarly you can not define many other functions, e.g. power functions with non-integer exponent, ln(x), log(x), exp(x), sin(x), cos(x) etc.
Even if you restrict yourself only to functions $f:\mathbb{Q}\rightarrow\mathbb{Q}$, you can not always take limits, derivatives, antiderivatives etc. as pointed out in other answers.
So, the problem is a lot more fundamental than "you'll get no theorems out". 
A: Can I give my view? For me, there are many huge distinctions between a "rational analysis" and the real analysis, and few of them are dependent on the concept of integration.
Derivatives and integrals are indeed defined on sets which are very different from the real numbers; the Cantor sets for instance. This means that derivatives and integrals are not what makes real analysis real analysis. The monotone convergence theorem and, equivalently, the fact that every bounded sequence has a convergent subsequence is a point of real calculus which I think is prior to integrals. Riemman integrals, themselves, are defined via supremes and infs, or via limits, which exist thanks to the monotone convergence theorem. So, the difference between rationals and reals comes first from facts relating to sequences and series, and then from antiderivatives. 
Before learning about integrals, we learn things like mean value theorem or rolle theorem. Both come from topology of the real number set, which is very different from the topology of reals, thanks to the existence of supremes and infs. Mean value theorem would not hold in the rationals set. For example, the square of x would have values above and bellow 2, without passing through 2.
Of course, all of that also makes us think whether real numbers are something fundamentally necessary, or else a matter of convenience. In fact, thinking about all these examples, one can have the impression that real numbers are a construct which allows us to talk about some limits, even when we can't calculate them. This would, in my opition, be a precise observation, and which takes us to the old criticism of Dedekind to Cantor's theory. In my opinion, Cantor's set theory is much more important from being a huge and ingenious notational aid, than from being a fundamentally and filosofically consistent description of mathematics. The same observation applies to real numbers: they make analysis much easier, as we can talk about limiting values (as pi or e) using a single name, symbol, and thinking of them as numbers like 1 or 0, while without completeness theorem we would have to talk about "aproximate behaviours" in each and every place in mathematics were these numbers appear.
The values of many and many integrals are some of these limiting numbers, about which we can talk naturally in real analysis, but not in "rational analysis". Without completeness, we would not be able to talk about the integral of any continuous function on a closed set; we would have to put the huge restriction that the integration results in a rational number.
But, as I said, calculus is all about limits, and integrals are only one of the examples of limits which are only defined thanks to supremes and infs.
