There is a two variable function, called $\text{atan2}$ in C, that may do the job for you, if something like it is built into the piece of software that you are using.
For some discussion of the $\text{atan2}$ function, see this.
Roughly speaking, $\text{atan2}(y,x)$ is $\arctan(y/x)$ if $x$ is positive. If $x$ is negative, and $y\ge 0$, then $\text{atan2}(y,x)=\pi+\arctan(y/x)$, while if $x<0$ and $y<0$, then $\text{atan2}(y,x)=-\pi+\arctan(y/x)$. And so the program won't blow up, $\text{atan2}(y,x)$ is defined in the reasonable way when $x=0$.
In particular, $\text{atan2}(1/\sqrt{2},-1/\sqrt{2})=3\pi/4$, precisely what you wanted. You may be less happy with $\text{atan2}(-1/\sqrt{2},-1/\sqrt{2})$.
Warning: While many software packages implement an $\text{atan2}$-like function, the name and the syntax are not universal. Sometimes $x$ and $y$ are interchanged. The details for Fortran, C, Mathematica, MATLAB, and Excel, to mention some examples, are slightly different!
If you connect the centers of two adjacent little circles and the center of the big one, you'll get a triangle. The sides of this triangle have lengths $r+R, r+R$ and $2r$. A little trigonometry will get you that the top angle is
$$\theta=2\arcsin\left(\frac{r}{r+R}\right) \; .$$
Since you want the small circles to form a closed ring around the big circle, this angle should enter an integer amount of times in $360°$ (or $2\pi$ if you work in radians). Thus,
$$\theta=360°/n \; .$$
From this, you can compute that
$$r=\frac{R \sin(180°/n)}{1-\sin(180°/n)} \; .$$
Here's a plot of the result for $n=14$:
Here's the code in Scilab:
n=14;
R=1;
r=R*sin(%pi/n)/(1-sin(%pi/n));
theta=2*%pi*(0:999)/1000;
plot(Rcos(theta),Rsin(theta));
hold on;
for k=0:(n-1),
plot((r+R)*cos(2*k*%pi/n)+r*cos(theta),(r+R)*sin(2*k*%pi/n)+r*sin(theta));
end;
hold off;
Best Answer
If you start from the right wing of the $x$ axis, your points of the regular $n$-gon are $$P_k=(r\cos\left(\frac{k\cdot 2\pi}{n}\right), r\sin\left(\frac{k\cdot 2\pi}{n}\right))$$ where $k=0,..,n-1$.
If the first angle, measured from the right wing of $x$ axis, counterclockwise, is not $0$ but some $\alpha_0$, then $$P_k=(r\cos\left(\frac{k\cdot 2\pi}{n}+\alpha_0\right), r\sin\left(\frac{k\cdot 2\pi}{n}+\alpha_0\right))$$