Question:Given the equation $$c^2=a^2+(\frac{pq}{\sqrt{q^2\sin^2{\theta}+p^2\c os^2{\theta}}})^2-2a\frac{pq}{\sqrt{q^2\sin^2{\theta}+p^2\cos^2{\the ta}}}\cos{\theta},$$

is it possible to solve for $\theta$ in terms of $a,c,p,$ and $q$?

Original Problem:I am attempting to develop an algorithm to solve an extension of a spherical codes problem.This image:

shows a partial cutaway of a spherical codes solution (a center sphere with as many smaller spheres packed onto it as possible, cut away to show the inner sphere).

I'd like to extend this problem to ellipsoids, so essentially to take an ellipsoid with given dimensions and pack as many spheres of another given dimension on its surface as possible. The equation above is a central part of my solution to this problem, and is derived from the law of cosines with $\theta$ as the opposite angle to side $c$ and the side $b$ substituted by the large fraction ($\frac{pq}{...}$).

Attempts:I've plugged the equation into Matlab's solve feature, Mathematica's Reduce function (both to no avail), and Mathematica's Solve function , which returned this:

> $x = \arccos{\sqrt{(-((a^2 p^2 pq^2)/(a^4 p^4 - 2 a^2 c^2 p^4 +

c^4 p^4 - 4 a^2 p^2 pq^2 - 2 a^4 p^2 q^2 +

4 a^2 c^2 p^2 q^2 - 2 c^4 p^2 q^2 + 4 a^2 pq^2 q^2 +

a^4 q^4 - 2 a^2 c^2 q^4 +

c^4 q^4)) + (c^2 p^2 pq^2)/(a^4 p^4 - 2 a^2 c^2 p^4 +

c^4 p^4 - 4 a^2 p^2 pq^2 - 2 a^4 p^2 q^2...}}$

(truncated, else it would continue for 21 total lines)

However, after substituting variables into the full expression above, I determined that it too returned false values (e.g. $\arccos(n)$ where $n>1$).

I was wondering if there is a way to solve this by hand or if it is impossible to do so? Thank you in advance.