Improper integral over the rationals Question:
Suppose that I wish to integrate a function over the natural numbers. How could I do this?

Answer:
Consider the definite integral $\int_a^bf(x)\ dx$. If we consider this as the 'area under the curve' between $x=a$ and $x=b$, then $\int_a^bf(x)\ dx$ is the sum of the areas infinitely many rectangles, each with an area of $f(x)\epsilon$, where $\forall x\in\mathbb{R}^+.\epsilon<x$. Thus:
$$\int_a^bf(x)\ dx=\lim_{\epsilon\to0}\sum_{x=a}^{b/\epsilon}f(x)\epsilon$$
For $x\in\mathbb{N}$, this is simply a finite sum, since there are no terms between $x=n$ and $x=n+1$:
$$\int_{M\subset\mathbb{N}}f(x)\ dx=\int_a^bf(x)\ dx=\lim_{\epsilon\to 0}\sum_{x=a}^{b}f(x)\epsilon\ \mid a,b,x\in\mathbb{N}$$
This summation is zero for all $a$ and $b$,
UNLESS $b=\infty$ and $a<b$, in which case the infinite sum, corresponding to the improper integral $\int_a^\infty f(x)\ dx$ can be nonzero, the nicest case being $a=0$:
$$f:\mathbb{N}\to X\implies\int_0^\infty f(x)\ dx=\lim_{\epsilon\to0}\sum_{x=0}^\infty f(x)\epsilon>0$$
Evaluating this sum can be incredibly difficult, but it is possible.

Now, the big question:
What is the improper integral of $f(x)$ over the rationals? i.e.:
$$f:\mathbb{Q}\to X\implies\int_0^\infty f(x)\ dx=\ \Large?$$
I would assume that because the rationals are dense
$$f:\mathbb{Q}\to X\land g:\mathbb{N}\to X\implies\int_0^\infty f(x)\ dx\gg\int_0^\infty g(n)\ dn$$
This following from the fact that for a finite natural number $b$:
$$\sum_{0\leq x\leq b\\x\in\mathbb{Q}}f(x)\gg\sum_{0\leq x\leq b\\x\in\mathbb{N}}f(x)$$
 A: Within nonstandard analysis you can proceed as follows: take any infinitely large $N \in ^\ast\mathbb{N}$ and consider the set $\{0, 1, \ldots, N\}\supset \mathbb{N}$. By the transfer principle, $[0,N]$ has the same properties of a finite subset of $\mathbb{N}$, and the sum $\varepsilon \sum_{x \leq N} f(x)$ is well-defined for every hyperreal (= nonstandard real) $\varepsilon$. In this setting, a somewhat natural choice is to define $\varepsilon=N^{-1}$.
In order to define a sum over $\mathbb{Q}$ you can proceed in a similar way: let $M=N!$ for some infinitely large $N \in ^\ast\mathbb{N}$, and consider the set $Q=\left\{ \frac{n}{M} : -M^2 \leq n \leq M^2 \right\} \supset \mathbb{Q}$. Transfer still ensures that $Q$ has the same properties of a finite subset of $\mathbb{Q}$, so the sum $\varepsilon\sum_{x \in Q} f(x)$ is well-defined. Once again, a meaningful choice for $\varepsilon$ is $\varepsilon = |Q|^{-1} =(2M^2+1)^{-1}$.
A similar construction can be carried out to arbitrary domains. This approach is used for instance in Nelson's Radically Elementary Probability Theory (https://web.math.princeton.edu/~nelson/books/rept.pdf), and it is discussed from a measure-theoretical point of view in the papers Elementary numerosity and measures (http://www.logicandanalysis.com/index.php/jla/article/view/212) and Some applications of numerosities in measure theory (http://www.dm.unipi.it/cluster-pages/dinasso/papers/Lincei2.pdf). In these papers, you can also find some meaningful references on the topic.
