Forecasting an ellipse in 3D I have 3D data which is a band of $x$ width data ‘sliced’ from a 3D ellipsoid.
If I wanted to try and infer the shape of the original ellipsoid (or at least a wider section of the band of data) I was wondering if it was possible to fit an ellipse to stacked 2D slices of the data and then use a technique analogous to regression to forecast/predict what the next ellipse shape would be in 2D at position $x$.; thereby inferring the original shape in 3D. Would anyone know of any mechanisms that could achieve such a regression or is this not possible? Any pointers to papers or code would be appreciated.
 A: The equation of an ellipsoid is given as
$$\left[\dfrac{x-x_0}{a}\right]^2+\left[\dfrac{y-y_0}{b}\right]^2+\left[\dfrac{z-z_0}{c}\right]^2=1.$$
For fitted parameters $\hat{x}_0,\hat{y}_0, \hat{z}_0, \hat{a},\hat{b}, \hat{c}$ we will have an error $\varepsilon$. I will not use the hat notation in the following.
Then we can rewrite the error $\varepsilon_n$ for the $n^\text{th}$ observation $(x_n,y_n,z_n)$ as 
$$\varepsilon_n=\left[\dfrac{x_n-x_0}{a}\right]^2+\left[\dfrac{y_n-y_0}{b}\right]^2+\left[\dfrac{z_n-z_0}{c}\right]^2-1.$$
You can take these errors and determine a global loss function $J$ as the sum of squared errors
$$J=\sum_{n=1}^N\varepsilon^2_n=\sum_{n=1}^N\left[\left[\dfrac{x_n-x_0}{a}\right]^2+\left[\dfrac{y_n-y_0}{b}\right]^2+\left[\dfrac{z_n-z_0}{c}\right]^2-1\right]^2.$$
Your goal is to adapt the parameters $\hat{x}_0,\hat{y}_0, \hat{z}_0, \hat{a},\hat{b}, \hat{c}$ to minimize the loss function $J$. The sum is summing all errors for all your observations (your data points) that you have received by slicing the ellipsoid. In order to solve this nonlinear optimization problem, you can the gradient descent algorithm (first-order method) or the Newton-Raphson algorithm (second-order method).
