In $\mathbb{R}^n$, we say that a linear subspace is *rational* if it admits a basis in $\mathbb{Q}^n$ (or equivalently in $\mathbb{Z}^n$). This means that $E\cap \mathbb{Z}^n$ is a submodule of $\mathbb{Z}^n$ of rank equal to the dimension of the given subspace. By convention, we declare that $\{0\}$ is rational.

Now, if $E$ is any linear subspace of $\mathbb{R}^n$, we denote by $b(E)$ (*resp.* by $c(E)$) the dimension of the biggest rational subspace of $\mathbb{R}^n$ contained in $E$ (*resp.* of the smallest rational subspace of $\mathbb{R}^n$ containing $E$).

My questions:

1) How can one compute $b(E)$ and $c(E)$? I am mainly looking for an algorithm (if it is possible). My entries for the algorithm are either a basis of $E$, or a system of equations (or any equivalent characterization).

2) It is clear that $0\leq b(E)\leq \dim(E)\leq c(E)\leq n$. In an article, I have read that every case is possible. How can one construct examples of the different cases? I have some ideas but I am stuck in verifying because of the first question.

I would already be happy if someone can point me to a reference.