6
$\begingroup$

I'm doing a geometry study between a circle and an ellipse.

After several attempts with Mathematica I had no choice but to use other software to obtain the values of the $r_x$, $\theta _1$ and $\theta _2$.

enter image description here

The results obtained by the other software were:

enter image description here

According to the documentation I need these parameters to get an ellipse:

$\text{Circle}\left[\{x,y\},\left\{r_x,r_y\right\},\left\{\theta _1,\theta _2\right\}\right]$

$r_x=11.4935$

$\theta _1=2 \pi +0.023$

$\theta _2=\pi -0.023$

With these values I was able to create what I wanted:

ClearAll["Global`*"]
g1 = Graphics[{Thickness[0.006], Circle[{0, 0}, 19]}];
g2 = Graphics[{Thickness[0.003], Circle[{0, 15}, {11.4935, 1.5}, {2 Pi + 0.023, Pi - 0.023}]}];
Show[g1, g2]

enter image description here

I did an analysis to get the points where there is the tangency of the geometries using the equation of the circle and the equation of the ellipse:

$ \left(x-x_0\right){}^2+\left(y-y_0\right){}^2=r^2$

enter image description here

$ \frac{\left(x-x_0\right){}^2}{a^2}+\frac{\left(y-y_0\right){}^2}{b^2}=1$

enter image description here

I noticed that the results were right

ClearAll["Global`*"]
a = 11.4935;
Solve[((x - 0)^2 + (y - 0)^2 == 19^2) && ((x - 0)^2/a^2 + (y - 15)^2/1.5^2 == 1), {x, y}] // N

${{x -> -11.3197 - 0.0000200237 I, y -> 15.2599 - 0.0000148534 I}, {x -> 11.3197 + 0.0000200237 I, y -> 15.2599 - 0.0000148534 I}, {x -> -11.3197 + 0.0000200237 I, y -> 15.2599 + 0.0000148534 I}, {x -> 11.3197 - 0.0000200237 I, y -> 15.2599 + 0.0000148534 I}}$

enter image description here

The question is as follows:

What should I do to get the values of the $r_x$, $\theta _1$ and $\theta _2$?

The geometries must be tangent, but I do not know how to do it ...

$\endgroup$
1
  • $\begingroup$ Can you explain what "largest radius of the ellipse" and "angles of the ellipse" mean? I see no actual ellipse in any of your images. What ellipse are you looking at? $\endgroup$
    – bill s
    Commented May 30, 2017 at 15:34

2 Answers 2

6
$\begingroup$

The circle.

Solve[x^2 + y^2 == 19^2, y]

{{y -> -Sqrt[361 - x^2]}, {y -> Sqrt[361 - x^2]}}

D[Sqrt[361 - x^2], x]

-(x/Sqrt[361 - x^2])

The ellipse.

With[{b = 3/2}, 
  Simplify[Solve[x^2/a^2 + (y - 15)^2/b^2 == 1, y], a > 0]] 

{{y -> 15 - (3 Sqrt[a^2 - x^2])/(2*a)}, {y -> 15 + (3 Sqrt[a^2 - x^2])/(2*a)}}

D[15 + (3 Sqrt[a^2 - x^2])/(2 a), x]

-((3 x)/(2 a Sqrt[a^2 - x^2]))

The points of tangency are the points where the two curves intersect and have the same derivatives. We make use of this to find a.

Solve[
  {Sqrt[361 - x^2] == 15 + (3 Sqrt[a^2 - x^2])/(2 a), 
   x/Sqrt[361 - x^2] == (3 x)/(2 a Sqrt[a^2 - x^2])}, 
  {a, x}]

solutions

Now we can draw the figure.

With[{a = 1/2 Sqrt[1/2 (553 + 5 Sqrt[10153])], b = 3/2}, 
  Graphics[{Circle[{0, 0}, 19], Circle[{0, 15}, {a, b}]}, 
    PlotRange -> {12 {-1, 1}, {13, 19.2}}]]

figure

Update

For the record, here is the computation of the two angles θ1 and θ2 that allow the section of the ellipse lying above the two tangents points to be clipped out of the figure.

a1 = N[(1/2) Sqrt[(1/2) (553 + 5 Sqrt[10153])]];
b1 = 1.5;

x-coordinates of the points of tangency.

x1 = -N[Sqrt[-(10153/288) + (467 Sqrt[10153])/288]]; (* left *)
x2 = -x1; (* right *)

Translating the ellipse to the origin to get y1.

y1 = N[Sqrt[361 - x2^2] - 15];

This next calculation is a little tricky. Because of the way Mathematica draws ellipses by stretching circles, it is necessary to reverse the stretch of the y-commponent when computing the angles.

θ = ArcTan[x2, y1 a1/b1]];
θ1 = π - θ;
θ2 = θ + 2 π;

Graphics[
  {Circle[{0, 0}, 19], 
   Circle[{0, 15}, {a1, b1}, {θ1, θ2}],
   Red, Point[{{x1, 15 + y1}, {x2, 15 + y2}}]},
  PlotRange -> {12 {-1, 1}, {12.9, 19.2}}]

figure

$\endgroup$
3
  • $\begingroup$ Now I just need to find $\theta_ 1$ and $\theta_ 2$ $\endgroup$
    – LCarvalho
    Commented May 30, 2017 at 21:06
  • $\begingroup$ @LCarvalho. Since you know the ellipse center {0, 15} and my answer gives the x values of the tangents, you can solve for the y values from the equation of the circle. With those three points, finding the angles is not hard. $\endgroup$
    – m_goldberg
    Commented May 30, 2017 at 21:12
  • $\begingroup$ That's exactly what I'll do. Thanks. $\endgroup$
    – LCarvalho
    Commented May 30, 2017 at 21:38
3
$\begingroup$

My answer is totally with reference to the m_goldberg answer, but with some changes because some steps were manually entered and I want to make everything automatic.

Some unwanted messages will appear, so I'll leave clean outputs

ClearAll["Global`*"]
Off[Solve::ratnz]
Off[General::ivar]

A general function for the circle equation was created. The Circle function already exists, but the output of this function will give me the equation as a function of x.

eqCircle[x0_, y0_, r_] := 
 Solve[(x - x0)^2 + (y - y0)^2 == r^2, y] /. Rule -> Set // Last

I will highlight the variable r because it will be used in function as in graphics.

r = 19;
eqCircle[0, 0, r]

$\left\{\sqrt{361-x^2}\right\}$

g1 = Graphics[{Thickness[0.006], Circle[{0, 0}, r]}]

enter image description here

As the variable y received a value through eqCircle function I will save its value in another variable and clear the memory so that the variable y receives another value when passing through eqEllipse function.

eqC = y
Clear[y];

$\left\{\sqrt{361-x^2}\right\}$

The points of tangency are the points where the two curves intersect and have the same derivatives. Below is the derivative of the circle equation.

dy1 = D[eqC, x]

$-\frac{x}{\sqrt{361-x^2}}$

I will highlight the variable b because it will be used in the function as in graphics. I will highlight the variable y0Ellipse because it will be used to get the variable $\theta$

b = 1.5;
x0Ellipse = 0;
y0Ellipse = 15;
eqEllipse[x0_, y0_, a_, b_] := 
 Solve[(x - x0)^2/a^2 + (y - y0)^2/b^2 == 1, y] /. Rule -> Set // Last
eqEllipse[x0Ellipse, y0Ellipse, a, b]

$\left\{1.5 \left(\frac{\sqrt{a^2-1. x^2}}{a}+10.\right)\right\}$

As the variable y has received a value through eqEllipse function I will save its value in another variable and clear the memory.

eqE = y
Clear[y];

$1.5 \left(\frac{\sqrt{a^2-1. x^2}}{a}+10.\right)$

The points of tangency are the points where the two curves intersect and have the same derivatives. Below is the derivative of the ellipse equation.

dy2 = D[eqE, x]

$-\frac{1.5 x}{a \sqrt{a^2-1. x^2}}$

The solution to the question is here

Using Solve by matching the two specific functions and their derivatives to this scenario I have created the values of the variables a and x.

Just a remark: At this point only I improved what m_goldberg answered by adding the expressions && a > 0 && x > 0 to filter the expected results.

Solve[{eqC == eqE, dy1 == dy2 && a > 0 && x > 0}, {a, x}] /. 
 Rule -> Set

$\left( \begin{array}{cc} 11.4935 & 11.3197 \\ \end{array} \right)$

To obtain the angles that create the section of the ellipse, simply find the angle formed between eqE-y0Ellipse and x. The variable x was obtained by the above resolved.

eqE
y0Ellipse
x
θ = ArcTan[x, eqE - y0Ellipse]

$15.2599$

$15$

$11.3197$

$0.0229571$

Here is a chart to make it easier to understand

enter image description here

Enlarging the image above

enter image description here

g2 = Graphics[{Thickness[0.003], 
   Circle[{0, 15}, {a, b}, {2 Pi + θ, Pi - θ}]}]

enter image description here

Show[g1, g2]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.