# Solving for Ellipse Parameters Given a radius and angle (Challenge 2)

Given an ellipse centered on the origin in an x-y plane expressed as

$$\bigg(\frac{x}{a} \bigg)^2+\bigg(\frac{y}{b} \bigg)^2 = 1$$

In polar coordinates with radius $$R$$ and angle = $$\theta$$, this can be expressed as:

$$R = \sqrt{\big(a^2 cos^2\theta\big)+\big(b^2 sin^2\theta\big)}$$

If we set a and b to be related as follows:

$$a = 1 - \Delta$$

$$b = 1 + \Delta$$

The solution for $$\Delta$$ as a function of $$R$$ and $$\theta$$ is determined from

$$R = \sqrt{1 - 2\Delta cos(2\theta)+ \Delta^2}$$

Which as given in Solving for Ellipse Parameters given a radius and angle (Challenge 1) has the simplest solution as $$\Delta = cos(2\theta) \pm \sqrt{R^2-sin^2(2\theta)}$$

I am trying to similarly solve for $$\Delta$$ given a modified ellipse with the following relationship:

$$R = (1-\Delta)\sqrt{1 - 2\Delta cos(2\theta)+ \Delta^2}$$

What is the simplest form of $$\Delta$$ given $$R$$ and $$\theta$$ from the above equation?

If a simple relationship does not exist, then an approximation will be acceptable given that I can limit $$\Delta$$ to be $$0.9<\Delta<1$$

(Note this is related to my answer at this link on the signal processing site where I had to find the root of the equation to solve but am hoping for a simple closed form equation: https://dsp.stackexchange.com/questions/54006/computation-of-parameter-filter-to-match-a-given-frequency-response/54008#54008)

Squaring both sides gives $$R^2 = (1 - \Delta)^2 (\Delta^2 - 2 \Delta \cos 2 \theta + 1) .$$ This is a quartic equation in $$\Delta$$, so there is a closed form in terms of $$R, \theta$$, but it's too large to reproduce here: For general values of $$\theta, R$$ there won't be a simple form, and given the content of the linked post, the numerical approximations you've already been using are probably the most useful. If you're interested in limiting cases, say, $$R \ll 1$$ or $$R \gg 1$$, one can analyze the above equation to produce good approximate solutions for $$\Delta$$.

Edit If we have the additional condition that $$R \ll 1$$, then substituting gives $$\Delta \approx 1$$. To get a next-order approximation, we can set $$\Delta = 1 + \epsilon$$ with $$\epsilon \approx 0$$ (this is close to the condition specified in the edit to the original question), giving $$\epsilon^4 + 4 \sin^2 \theta \, \epsilon^3 + 4 \sin^2 \theta \, \epsilon^2 = R^2 .$$ Provided that $$\sin \theta$$ is not too close to $$0$$, the $$\epsilon^2$$ term on the left dominates the others, giving $$\epsilon \approx \pm \frac{R}{2} \csc \theta,$$ so $$\Delta \approx 1 \pm \frac{R}{2} \csc \theta .$$

On the domain $$\frac{9}{10} < \Delta < 1$$ of interest, this is a robust approximation:

From innermost to outermost, the red curves are the graphs of the solution functions $$\Delta(\theta)$$ for $$R = \frac{1}{8}, \frac{1}{16}, \frac{1}{32}, \frac{1}{64}, \frac{1}{128}$$, and the blue curves are the graphs of the above approximations.

On the other hand, for very small $$R$$, say, $$R < \frac{1}{64}$$, it's possible for to have $$\frac{9}{10} < \Delta < 1$$ but $$\sin \theta$$ small enough that the above approximation becomes poor: In the limit $$\sin \theta \to 0$$, the $$\epsilon^4$$ term dominates, giving a zeroth-order approximation $$\Delta \approx 1 - \sqrt{R}$$. Computing to second order in $$\sin \theta$$ gives the approximation $$\Delta \approx 1 - \sqrt{R} + \left(1 - \frac{1}{\sqrt{R}}\right) \sin^2 \theta .$$

This plot for $$R = \frac{1}{256}$$ is typical for $$R < \frac{1}{100}$$; the green curve is the small-angle approximation. (NB the expanded scale of the horizontal axis.)

• Thank you Travis. I can limit $Delta$ to be greater than 0.9 and less then 1 if that helps get to an approximate solution. What approach do you suggest to find an approximate in that case? (Or should I post that as another question?) Dec 11, 2018 at 16:18
• If we know a priori that $\frac{9}{10} < \Delta < 1$, one strategy is to change variables to $s = 1 - Delta$, so that we're working in the domain $s \ll 1$. Then, the equation becomes $R^2 = 2 (1 - \cos 2 \theta) s^2 - 2(1 - \cos 2 \theta) s^3 + s^4$. Provided that $\cos 2 \theta$ isn't too close to $1$, the $s^2$ term dominates, and ignoring the other terms gives $s \approx \pm \frac{1}{2} R \csc \theta$ (so, the condition on $\Delta$ implies that $R$ must have been small in the first place). Dec 11, 2018 at 16:28
• Super- yes this would be similar to poles for an analog filter on a s plane. In this case it is a digital filter so maps to polar coordinates on a z plane; the vertical imaginary $j\omega$ axis becomes the unit circle. Thanks for your help! Dec 11, 2018 at 17:02
• Works great! I got 0.9696 using your estimate for my example case from the Signal Processing Stack Exchange link, where $\theta$ was 0.377 and R=1/44.67. The answer I got by solving for the real root of the equation was 0.9691. Dec 11, 2018 at 17:18
• (And yes, I agree that for $\theta = 0$ we have $\Delta = 1 \pm \sqrt{R}$.) Dec 12, 2018 at 1:40