Generalizing integration Is it possible to generalize the notion of integrals to other sets than the reals? In particular, would it be possible to integrate over a subset of the reals such as the rationals or the irrationals? What about more exotic sets?
 A: I recall once glancing at the following article (no subscriptions required!):

C.A. Deavours (1973) The Quaternion Calculus American Mathematical Monthly 80:995–1008

It isn't merely about integration, but about building a reasonable array of calculus machinery on the quaternion number system, which generalizes complex numbers just as they generalize real numbers - but with complications arising due to noncommutativity of the quaternions. The work-arounds include splitting concepts into left and right versions and redefining regularity with weaker variants inspired by complex analysis. Historical background is also discussed. Here are most of the major mathematical points of interest throughout the paper.



*

*Define the quaternion gradient operator: $$\square=\frac{\partial}{\partial w}+\mathbf{\nabla}=\frac{\partial}{\partial w}+\mathbf{i}\frac{\partial}{\partial x}+\mathbf{j}\frac{\partial}{\partial y}+\mathbf{k}\frac{\partial}{\partial z}.$$ This can be understood to act from either the left or right with different results. If we split $\mathbf{F}$ into scalar and vectorial parts, $\mathbf{F}=f+\mathbf{u}$, we can write the action of the gradient operator from the left (careful about the curl computation) as: $$\square\mathbf{F}=\left(\frac{\partial f}{\partial w}-\nabla\cdot\mathbf{u}\right)+\nabla f+\left(\frac{\partial}{\partial w}+\nabla\times\right)\mathbf{u}.$$ Let $R$ be a simply connected region in $\mathbb{H}$, and let $d\mathbf{q}$ be the outwardly directed surface element of $\partial R$ and $dV$ the volume measure (as if it were Euclidean space). Then $$\oint_{\partial R}(d\mathbf{q})\mathbf{F}=\int_R(\square\;\mathbf{F}) dV \qquad\text{ and }\qquad\oint_{\partial R} \mathbf{F}d\mathbf{q}=\int_R(\mathbf{F}\;\square)dV.$$ 
This is essentially a multicomponent divergence theorem in four dimensions.

*Usually, regular functions are given locally by convergent power series, but requiring either of the derivatives (defined via $\lim\;\Delta \mathbf{F} (\Delta \mathbf{x})^{-1}$ and $\lim\; (\Delta\mathbf{x})^{-1}\Delta\mathbf{F}$) to be path-independent creates a complicated overdetermined system of PDEs which is for most purposes useless because even basic functions like $\mathbf{x}^2$ then fail to have derivatives, so the idea of doing calculus with things like Taylor series is kaput. However one can model Morera's theorem from analysis on $\mathbb{C}$ and define left (respectively, right) regular functions as those such that $$\oint_{\partial R}(d\mathbf{q})\mathbf{F}=\mathbf{0}\qquad\left(\text{resp. }\quad\int_{\partial R}\mathbf{F}d\mathbf{q}=\mathbf{0}\right)$$ for all closed hypersurfaces $\partial R$ of $\mathbb{H}$. Both regularities are translation-invariant, and (as an analogue to Liouville's theorem) any regular function with bounded norm must be a constant function. Each component of a left or right regular function is a harmonic function in the components of $\mathbf{x}$. A function $\mathbf{F}$ is left (right) regular in $\mathbf{x}$ if and only if $\square\;\mathbf{F}=\mathbf{0}$ ($\mathbf{F}\;\square=\mathbf{0}$), and left (right) regular in the conjugate $\overline{\mathbf{x}}$ if and only if $\overline{\square}\;\mathbf{F}=\mathbf{0}$ ($\mathbf{F}\;\overline{\square}=\mathbf{0}$). Finally, if $\mathbf{F}$ is right regular and $\mathbf{G}$ left regular then $$\oint_{\partial R}\mathbf{F}(d\mathbf{q})\mathbf{G}=\mathbf{0}$$ for every closed hypersurface $\partial R$ of $\mathbb{H}$.

*Even still, these regular functions aren't generally given by convergent power series. However we can generate a certain class of quaternionic analytic functions using $\mathbb{C}$ as a springboard: let $f(x+iy)= u(x,y)$ $+iv(x,y)$ be a regular function of a complex variable, and define $\mathbf{r}=x\mathbf{i}+y\mathbf{j}+z\mathbf{k}, r=\|\mathbf{r}\|$ and $\mathbf{e_r}=\mathbf{r}/r$, then let $\mathbf{F}=u(w,r)+\mathbf{e_r}v(w,r)$. If we furthermore let $\Delta_4$ denote the 4-space gradient operator acting on each component of a quaternion function independently, we find that (1) $\Delta_4\mathbf{F}$ is regular in $\mathbf{x}$; (2) the infinite series $\sum \mathbf{a}_n \Delta_4 \mathbf{x}^n$ is regular if it is norm convergent; (3) each component of $\mathbf{F}$ is biharmonic, i.e. $\Delta_4\Delta_4\mathbf{F}=\mathbf{0}$. We also arrive at another analogue in the Cauchy-Fueter integral formula: $$\oint_{\partial R}\Delta_4(\mathbf{q}-\mathbf{q}_0)^nd\mathbf{q}=8\pi^2\delta_{n+1} $$ for any closed hypersurface $\partial R$, and where $\delta$ is the Kronecker delta. Moreover, $$\mathbf{F}(\mathbf{q}_0)=\frac{1}{8\pi^2}\oint_{\partial R}\mathbf{F}(d\mathbf{q})\Delta_4(\mathbf{q}-\mathbf{q}_0)^{-1}.$$ This generalizes Cauchy's integral formula from complex analysis.

*Lastly, if we define $\square^* =-\frac{i}{c}\frac{\partial}{\partial t}+\nabla $, we obtain a compactified version of Maxwell's equations: $$\square^*(\mathbf{E}+i\mathbf{H})=-\rho+\frac{i}{c}\mathbf{J}.$$
A: For bounded intervals $I \subset \mathbb{R}$, the most well-known type of integration is Riemann integration, which can be shown to be equivalent to the very similar process of Darboux integration.  Darboux integration can be generalized to bounded rectangles $S \subset \mathbb{R}^n$, and even further to a sizable class of bounded subsets of $\mathbb{R}^n$.
As Henry mentioned in his answer, the techniques of measure theory allow one to define a very general type of integration on any set whatsoever.  This kind of integral is often studied in courses on real analysis.  Moreover, there exists a measure (called Lebesgue measure) on the real numbers such that integration with respect to that measure is (for Riemann integrable functions) Riemann integration.
A somewhat less well-known type of integration is Daniell integration, which also works on arbitrary sets.  The Daniell approach to integration is interesting in part because it is based on axioms.
But there are still other ways to generalize the concept of integration.  For instance, one might want to define integrals of vector fields (or covector fields) on a curve or surface.  This idea is taken up in multivariable calculus (or vector calculus) classes, and is ultimately generalized even further by the machinery of differential forms and differentiable manifolds, which forms part of the study of differential geometry and differential topology.
A: Yes it is possible to generalise, for example into measure theory.
A: One can approach 'measure theory' and integration in two different ways.  The difference is what is defined first, the measure or the integral.  Starting with measures is generally the more common method, at least once Lebesgue's theory is introduced.  Unlike integrals, measures are defined on sets, not functions.  For example, the Lebesgue measure of the intersection of the irrational numbers with the interval $[0,1]$ is $1$.  Measure theory deals with notions of length/area/volume/size/'content'/'probabilistic likelihood' etc...  The important point for this answer is that once you have a measure, you have an integral.
Anyways, there are a great many situations where you can integrate functions of the form $f: X \mapsto \mathbb{R}$.  Why?  Because you get a measure (and thus an integral) 'for free' when given any number of a large class of mathematical objects $X$.  Nice examples of $X$ include countable sets (think summation of series), the real and complex numbers, vector spaces, Riemannian manifolds and so on to more exotic structures like topological groups, etc...  Even more examples can be obtained by considering measures which arise canonically on subsets and cartesian products of sets already equipped with measures.
One other point I should mention, using $X = \mathbb{R}$ as an example: as mentioned, once you have a measure on a set $X$ you can not only integrate functions defined on $X$, but you can also integrate functions defined subsets of $X$ which are 'measurable'.  This notion of non-measurability is needed to avoid contradictions which arise when one assumes it always makes sense that every subset of a set have a well-defined measure.  In practice, however, these sets rarely occur.
[In fact, they are impossible to produce without the Axiom of Choice.  By this I mean that "ZF set theory + Axiom of Choice" and "ZF set theory + [All subsets of $\mathbb{R}$ are Lebesgue measurable]" are equally consistent, if not compatible, theories.]
