Gravity of a Circular Ring at a co-planar external point. I have a circular ring of unit mass and fixed radius R which lies in the XY plane at point $O$ with coordinates $O:(0,0)$.
I wish to find a formula for the gravitational force at a point $P: (D,0)$ which lies in the same plane as the ring and is at some variable distance D from the ring centre O.
(Note: There are many treatments of the case for a target lying on the axis of the ring.  The  reference so far found nearest to this co-planar case is Problems 5-12, 5-13, (no solutions given) p.127 in Classical Dynamics of Particles and Systems by Jerry B. Marion.
I expect that the formula should be of the form $F = GM*f(D)$ where $G$ is the gravitational constant, $M$ is the mass   and $f$ is some function similar to the Newtonian spherical divergence function $f(D) = \frac{1}{ D^2}$ (where the factor $\frac{1}{4.\pi}$ is absorbed in the value of the constant $G$ ).
So far I have obtained an integral formula by initially modelling the ring as a series of $N$ small point masses of mass $\frac{1}{N}$ separated by angle $\delta\theta$, whose distance from target is $L$ where: 
$$L^2 = (D-a)^2+b^2 = D^2-2aD+R^2 = D^2\left(1 -\frac{2a}{D} +\frac{R^2}{D^2}\right)$$ 
where $a (= R\cos\theta)$ and $b(=R\sin\theta)$ are the $x$ and $y$ coordinates of the point.  
Due to symmetry and vector addition of forces there is no net force in the y-direction and so the effective force contribution (along $x$) for a point is given by multiplying by the cosine factor $(D-a)/L$ thus:-
$$ F = \frac{-GM}{N}\frac{1}{4\pi.L^2}\frac{D-a}{L} 
= \frac{-GM}{ N}  \frac{D-a}{L^3} $$
$$ F = \frac{-GM}{ N}  \frac{D-R\cos\theta}{\left(D^2\left(1 -\frac{2a}{D} +\frac{R^2}{D^2}\right)\right)^{\frac{3}{2}}} $$
$$ F = \frac{-GM}{ N}  \frac{D-R\cos\theta}{D^3 \left(1 -\frac{2a}{D} +\frac{R^2}{D^2} \right)^{\frac{3}{2}}} $$
$$ F = \frac{-GM}{ N}  \frac{1-(R/D)\cos\theta}{D^2 \left(1 -\frac{2a}{D} +\frac{R^2}{D^2} \right)^{\frac{3}{2}}} $$
I then obtained the following integral formula for the force exerted on the target point by the ring:-
$$ F = \frac{-GM}{ D^2} \frac{1}{2\pi}\int_0^{2\pi}\frac{1-Q\cos\theta}{\left(1-2Q\cos\theta+Q^2\right)^{\frac{3}{2}}} \text{d}\theta$$
where $Q = R/D$.
$$ F = \frac{-GM}{ D^2} \frac{1}{2\pi}  \frac{1}{(2Q)^{3/2}}\int_0^{2\pi}\frac{1-Q\cos\theta}
{\left(\frac{Q^2+ 1}{2Q} - \cos\theta\right)^{\frac{3}{2}}} \text{d}\theta$$
Defining $A = \frac{Q^2+ 1}{2Q}$, Wolfram Alpha gives...
$$ \int_0^{2\pi}\frac{ 1 - Q \cos x}{(A -\cos x)^{3/2}} dx $$
$$=\left[\frac{2}{(A^2-1)\sqrt{A - \cos x}}\left(A^2-1\right)Q\sqrt{\frac{A - \cos x}{A-1}} \operatorname{F}\left(\frac{x}{2}~\big|~\frac{-2}{A-1}\right)-AQ\sin x- (A-1)(AQ-1)\sqrt{\frac{A-\cos x}{A-1}}\operatorname{E}\left(\frac{x}{2}~\big|~\frac{2}{1-A}\right)
+\sin x\right]_0^{2\pi}$$
Where $E(x|m)$ is an elliptic integral of the 2nd kind with parameter $m=k^2$, and $F(x|m)$ is an elliptic integral of the 1st kind with parameter $m=k^2$.
Replacing $\cos x$ by $1$ and $\sin x$ by $0$...
$$=\frac{2}{(A^2-1)\sqrt{A -1}}*\left[(A^2-1)Q \operatorname{F}\left(\frac{x}{2}~\big|~\frac{-2}{A-1}\right)-(A-1)(AQ-1) \operatorname{E}\left(\frac{x}{2}~\big|~\frac{-2}{A-1}\right)\right]_0^{2\pi}$$
Cancelling $(A^2-1)$...
$$=\frac{2}{\sqrt{A -1}}\left[Q\operatorname{F}\left(\frac{x}{2}~\big|~\frac{-2}{A-1}\right) 
- \frac{(AQ-1)}{A+1} \operatorname{E}\left(\frac{x}{2}~\big|~\frac{-2}{A-1}\right)  \right]_0^{2\pi}$$
Being unfamiliar with Elliptic Integrals, this is as far as I can comfortably go at present.

After reading the wikipedia article Elliptic Integral, proceeding tentatively, from the definitions of elliptic integrals I think that $E(x|k^2)$ and $F(x|k^2)$ both go to zero when $x$ is zero, thus...
$$=\frac{2Q}{\sqrt{A -1}}\left[\operatorname{F}\left(\pi~\big|~\frac{-2}{A-1}\right)-\frac{(AQ-1)}{AQ+Q} \operatorname{E}\left(\pi~\big|~\frac{-2}{A-1}\right)\right]$$
Next perhaps it would be helpful to reformulate the problem so that the amplitude(?) term in the elliptic integrals changes from $\pi$ to $\pi/2$, thereby making the elliptic integrals "complete" and permitting them to be expressed as power series.  This reformulation could be done by modelling the gravitational effect ($Fx$ component only) of two half rings (positive $y$ and negative $y$), independently, and using respectively the angles $\theta_1$ and $\theta_2$ which both range from $0$ to $\pi/2$ but in different directions.
 A: Considering similar problems it is usually simpler to consider the potential rather than force. The latter can be found latter as the negative of the potential gradient. Assuming the masses of the test point-like body and the ring be $m$ and $M$, respectively, we have in spherical coordinates with the origin at the center of the ring and the polar axis directed perpendicular to the plane of the ring:
$$
U({\bf r})=-\frac{GmM}{2\pi}\int_0^{2\pi}\frac{d\theta}{\sqrt{r^2+R^2+2rR\sin\phi\cos\theta}},\tag1
$$
where (following the "maths" convention referred to in the Spherical Coordinates link and for consistency with the Question) $r,\phi,\theta $ are radial distance, polar angle, and azimuthal angle of the point ${\bf r}$, and $R$ is the radius of the circle. 
The integral $(1)$ can be dealt in the following way:
$$\begin{align}
\int_0^{2\pi}\frac{d\theta}{\sqrt{r^2+R^2+2rR\sin\phi\cos\theta}}
&=2\int_0^{\pi}\frac{d\theta}{\sqrt{r^2+R^2+2rR\sin\phi\cos\theta}}\\
&=2\int_0^{\pi}\frac{d\theta}{\sqrt{(r^2+R^2+2rR\sin\phi)-4rR\sin\phi\sin^2\frac\theta2}}\\
&=\frac{4}{\sqrt{r^2+R^2+2rR\sin\phi}}
\operatorname{K}\left(\frac{4rR\sin\phi}{r^2+R^2+2rR\sin\phi}\right),
\end{align}
$$
where we used the convention
$$
\operatorname{K}(m)=\int_0^{\pi/2}\frac{d\theta}{\sqrt{1-m\sin^2\theta}}
$$
for the complete elliptic integral of the first kind.
Finally
$$
U({\bf r})=-\frac{2GmM}{\pi\sqrt{r^2+R^2+2Rr\sin\phi}}\operatorname{K}\left(\frac{4rR\sin\phi}{r^2+R^2+2rR\sin\phi}\right).\tag2
$$
In the plane of the circle $\phi=\frac\pi2$ and the above equation simplifies to:
$$
U({\bf r})=-\frac{2GmM}{\pi(R+r)}\operatorname{K}\left(\frac{4Rr}{(r+R)^2}\right).
$$

To obtain the expression for the acting force recall that:
$$
\nabla f={\partial f \over \partial r}\hat{\mathbf r}
+ {1 \over r}{\partial f \over \partial \phi}\hat{\boldsymbol \phi}
+ {1 \over r\sin\phi}{\partial f \over \partial \theta}\hat{\boldsymbol \theta}.
$$
As the potential $(2)$ does not depend on $\theta$ only two first terms remain. 
Tedious but straightforward calculation reveals:
$$\begin{align}
{\bf F}_r&=\frac{GmM}{\pi}\frac{(R^2-r^2)\operatorname{E}\left(1-\frac {y^2}{x^2}\right)-y^2\operatorname{K}\left(1-\frac {y^2}{x^2}\right)}{rxy^2};\tag3\\
{\bf F}_\phi&=\frac{GmM}{\pi}\frac{(R^2+r^2)\operatorname{E}\left(1-\frac {y^2}{x^2}\right)-y^2\operatorname{K}\left(1-\frac {y^2}{x^2}\right)}{rxy^2}\cot\phi,\tag4\\
\end{align}
$$
where $x=\sqrt{R^2+r^2+2Rr\sin\phi},\ y=\sqrt{R^2+r^2-2Rr\sin\phi}$.
A: In order to express the result in terms of complete elliptic integrals, it is easier to compute the gravitational potential $\phi(D)$ first. Then the (radial) field is given by $F(D) = - \phi'(D)$. Following your approach we find
$$ \phi(D) = - \frac{G M}{2 \pi D} \int \limits_0^{2\pi} \frac{\mathrm{d} \theta}{\sqrt{1 - 2 Q \cos(\theta) + Q^2}} = - \frac{G M}{\pi D} \int \limits_0^{\pi} \frac{\mathrm{d} \theta}{\sqrt{1 - 2 Q \cos(\theta) + Q^2}} \, . $$
In the last step we have used the fact that the integral from $0$ to $\pi$ and that from $\pi$ to $2\pi$ have the same value. Now we can write
$$ - \cos(\theta) = \cos(\pi - \theta) = 1 - 2 \sin^2\left(\frac{\pi - \theta}{2}\right) $$
and introduce the new integration variable $\alpha = \frac{\pi - \theta}{2}$ to obtain
$$ \phi(D) = -\frac{2 G M}{\pi D} \int \limits_0^{\pi/2} \frac{\mathrm{d} \alpha}{\sqrt{1 + 2 Q + Q^2 - 4 Q \sin^2(\alpha)}} = -\frac{2 G M}{\pi D} \frac{1}{1+Q} \int \limits_0^{\pi/2} \frac{\mathrm{d} \alpha}{\sqrt{1 - \frac{4 Q}{(1+Q)^2} \sin^2(\alpha)}} \, . $$
But this integral is just the definition of the complete elliptic integral of the first kind and (using the parameter $m = k^2$ as the argument)
$$ \phi(D) = - \frac{2 G M}{\pi D} \frac{1}{1+Q} \operatorname{K}\left(\frac{4 Q}{(1+Q)^2}\right) = - \frac{2 G M}{\pi D} \operatorname{K}(Q^2) = - \frac{2 G M}{\pi D} \operatorname{K}\left(\frac{R^2}{D^2}\right)$$
follows. The final simplification is an application of Gauss's transformation. Taking the derivative we find the field
$$ F(D) = - \frac{2 G M}{\pi(D^2 - R^2)} \operatorname{E}\left(\frac{R^2}{D^2}\right) $$
in terms of the complete elliptic integral of the second kind.
