I have an expression which represents an intersection of the unit sphere and a cone, projected to two-dimensional plane:
expr = x^2 + y^2 <= 1 &&
1/Sqrt[5] (2 (1 + Sqrt[5]) x^2 + (-1 + Sqrt[5]) x (-2 y +
Sqrt[2 (5 + Sqrt[5])] Sqrt[1 - x^2 - y^2]) +
y ((3 + Sqrt[5]) y +
2 Sqrt[2 (5 + Sqrt[5])] Sqrt[1 - x^2 - y^2])) == 1;
$x^2+y^2\leq 1\land \frac{\left(\sqrt{5}-1\right) x \left(\sqrt{2 \left(5+\sqrt{5}\right)} \sqrt{1-x^2-y^2}-2 y\right)+y \left(2 \sqrt{2 \left(5+\sqrt{5}\right)} \sqrt{1-x^2-y^2}+\left(3+\sqrt{5}\right) y\right)+2 \left(1+\sqrt{5}\right) x^2}{\sqrt{5}}=1$
On basis of its geometric origins it is obviously an ellipse which lies inside the unit disk:
It has the $\sqrt{1-x^2-y^2}$ term which I find hard to eliminate, at least just playing with assumptions.
I want to rewrite this equation to its polynomial, conic section form. How to accomplish this without resorting to numerics?
My best effort solution still involves numerics through combination of high-precision N
and RootApproximant
, which works at least with these coefficients.
a x^2 + b x y + c y^2 + d x + e y == 1 /.
(First@Solve[
a x^2 + b x y + c y^2 + d x + e y == 1 /.
FindInstance[expr, {x, y}, Reals, 5]] /.
v_?NumericQ :> RootApproximant[N[v, 100]]) //
FullSimplify
Here the conic section solution is calculated by applying five solutions to expr
with FindInstance
to the conic section equation. Solve
'ing this problem does produce exact coefficients, but they're over ten megabytes in size which makes simplification hopeless. The "simplification" through the aforementioned numerical route does produce a sensible result, though:
$\frac{8 x^2}{\sqrt{5}}+\left(2-\frac{2}{\sqrt{5}}\right) x y+\sqrt{2} \left(\sqrt{5}-1\right) x+y \left(\frac{7 y}{\sqrt{5}}+y+2 \sqrt{2}\right)=1$
The positive side is that validity of this solution can be actually checked (although this takes a moment):
Resolve[ForAll[{x, y}, Equivalent[%, expr]], Reals]
(* True *)
Are there better, purely symbolic ways to accomplish this based on expr
?
EDIT:
One may look at those FindInstance
results and conclude that the roots are horribly complicated even after RootReduce
; what if one would just pick "simple" numbers and find solutions restricted by, say, $x=0$, $y=0$ and some other very simple line. Yes, roots are simpler, especially after RootReduce
, and this probably would help Solve
. The problem is that even for $x=0$ and $y=0$ finding real instances takes minutes, and something like $x=-\frac{1}{2}$ clearly a lot longer.