Parametrization of the intersection of an ellipsoid with a sphere First I would like to say that geometry is far away from my domain.
I have encountered a problem that has a geometric formulation and I don't even know if this is a difficult or an easy problem. 
So here it is, let us be given an n-dimensional ellipsoid such that it is centered at the origin, its algebraic equation is : 
$\sum_{i=1}^{n}\big(\frac{x_i}{\lambda_i}\big)^2=1$ with $\sum_{i=1}^{n}\frac{1}{\lambda_i^2}=n$. 
What I am looking for is an explicit parametrization (in any coordinate system) of the surface  (a curve for n=3) defined by the intersection of this ellipsoid with the unit n-dimensional sphere. 
Ultimately, my goal is to be able to sample uniformly a point on this surface using this parametrization. I believe this problem is so common that it must have been solved somewhere but I couldn't find any reference.
 A: First, you can find an irrational parametrization of the (n-2)-dimensional intersection surface as follows. Projecting along the first coordinate axis to the hyperplane x1=0, you get an ellipsoid in $R^{n-1}$. Now parametrize the new ellipsoid and invert the projection map; you will get a parametrization of the initial surface involving square roots [1]. 
Second, you may ask of a rational parametrization, i.e., parametrization by rational functions. Here is the answer in particular cases:
n=3. The curve you consider is called a cyclic [2]. It has a rational parametrization with complex coefficients only if it is singular. So, for general values of $\lambda_i$ there is no rational parametrization. 
n=4. The surface you consider is called (an inverse stereographic image of) a cyclide [2,1] (not to be confused with a particular case of Dupin cyclide). Generically it is a del Pezzo surface of degree 4 from the point of view of complex algebraic geometry. Thus it always has a rational parametrization with complex coefficients,
and even a biquadratic one [4]. But not always real coefficients will work because there are cyclides which are irreducible and disconnected simultaneously. As far as I know, no simple  parametrization algorithm is available.
More information about algorithms for rational parametrization can be found in [3].
[1] H. Pottmann, L. Shi, M. Skopenkov, Darboux cyclides and webs from circles, Computer Aided Geom. Design 29:1 (2012), 77-97.
[2] J. Coolidge, A treatise on the circle and the sphere, AMS Chelsea Publ., 1971.
[3] J. Schicho, Rational Parametrization of Surfaces, J. Symbolic Computation (1998) 26, 1-29.
[4] J. Schicho, The multiple conical surfaces, Contributions to Algebra and Geometry, Volume 42 (2001), No. 1, 71-87.
A: You'll almost certainly find that sampling the parameters uniformly will not sample points uniformly on the intersection.
But a general parametrization, involving Jacobian elliptic functions, can be found inductively as follows (where for convenience I denote $ a_i = 1 / \lambda_i $).
Let $x_1 = 1 + p$ and, for $i > 1$, $x_i = p q_i $. Plugging these into the n-sphere gives either $p = 0$, which may or may not lead to a point in the intersection, or $p = -2 / ( 1 + q_2^2 + .. + q_n^2 )$.
Plugging the second equation for p into the $x_i$, and these into the ellipsoid, gives the remaining condition as follows, denoting $r^2 := q_2^2 + .. + q_n^2 $ :
$ a_1^2 (r^2 - 1)^2 + 4 a_2^2 q_2^2 + .. + 4 a_n^2 q_n^2 = (r^2 + 1)^2 $
Denoting $ s^2 := ((r^2 + 1)/2)^2 - a_1^2((r^2 - 1)/2)^2 $ and $ y_i := q_i / r$, these become:
$ y_2^2 + .. + y_n^2 = 1$
$ (a_2 \frac{r}{s} y_2)^2 + .. + (a_n \frac{r}{s} y_n)^2 = 1$
Noting that $r^2 = (\frac{r^2 + 1}{2})^2 - (\frac{r^2 - 1}{2})^2 $ identically, we see that $r$ and $s$ must satisfy:
$ \frac{r^2 - 1}{r^2 + 1} = sn(a_1, u) $
$ \frac{2 r}{r^2 + 1} = cn(a_1, u) $
$ \frac{2 s}{r^2 + 1} = dn(a_1, u) $
giving:
$ r = \frac{dn (1 + cn + sn)}{cn (1 + cn - sn)} $
$ s = \frac{1 + cn + sn}{1 + cn - sn} $
Finally, when you get down to:
$ z_{n-1}^2 + z_n^2 = 1$
$ (a_{n-1} z_{n-1})^2 + (a_n z_n)^2 = 1 $
you can treat this as a pair of linear equations in $z_{n-1}^2$ and $z_n^2$.
Regards
John R Ramsden
