Given a linear diophantine equation like
$$\sum_{i=1}^na_ix_i=b$$
with $x_i$ as variables and $a_i$ and $b$ as fixed integer parameters, I want to count the number of solutions that satisfy the conditions $x_i\in[\theta_L,\theta_H]$ for all $I$. Note that the interval is the same for all $i$. How can I do it?
I expect this number to be finite and countable but I don't know how to obtain it. Any help will be extremely appreciated, thanks!
EDIT: Ok I will be more specific. This is for an economic model and by assumption of the model $a_i>0$ (they are quantities). As for the upper and lower bound of the variables, if there exists some specific case of $[\theta_L,\theta_H]$ such that we can count the number of solutions, like the one you proposed $[-n;n]$ please post it! So what I mean is, if by making some restrictions in the parameters I can count the number of solutions, please propose it.
Clearly the number of solutions is finite. The number of solutions is bounded by $r^n$ where $r$ is the number of possible values $x_i$ can take in $[\theta_L, \theta_H]$. As the number of solutions, this heavily depends on the coefficients $a_i$ and $b$.
A few examples : if $x_i\in[0,1]$ and $a_i>0$ for all $i$ and $b<0$ then it cannot have any solution as the left hand side is always positive while the right hand side is always negative.
Another example : $x_1 + x_2 = 0$ for $x_i\in[-n,n]$, then it has $2n+1$ coupled solutions of the form $(x_1,x_2) = (k,-k)$ for all $k\in[-n,n]$.
My point is that you can find an upper bound to how many solutions you have but you won't find a general formula in terms of all the parameters and possible range of $x_i$.
For specific $a_i$, $b$ and $[\theta_L, \theta_H]$, you should try to find a parametric solutions, that is in term of another variable (like I did with $k$ in my second example). If you can do so, then you will be able to count how many solutions you have as this will be the number of values your parameter can take.