Open rtoy opened 4 months ago
Imported from SourceForge on 2024-07-07 00:17:56 Created by billingd on 2021-10-07 22:47:30 Original: https://sourceforge.net/p/maxima/bugs/3873/#8caa
Imported from SourceForge on 2024-07-07 00:18:00 Created by billingd on 2021-10-07 22:57:59 Original: https://sourceforge.net/p/maxima/bugs/3873/#32cd
For maxima code to find the intersection of two conics see https://sourceforge.net/p/maxima/mailman/message/37345071/
I recently (last week) extended this to find a tangent ellipse numerically. I just used a binary search to find the value where a parametric ellipse and a fixed ellipse just intersected. It is reliable provided you maintain the condition that one end of the interval has two real points of intersection and the other has none. I don't have to deal with degenerate cases such as concentric circles.
Imported from SourceForge on 2024-07-07 00:17:55 Created by adamhendry on 2021-10-07 16:46:49 Original: https://sourceforge.net/p/maxima/bugs/3873
I am attempting to find the general equation for common tangents to two ellipses:
$$
\left\{
\begin{array}{c} \frac{(x-h)^2}{a^2}+\frac{(y-k)^2}{b^2}-1=0 \\ \frac{(x-p)^2}{c^2}+\frac{(y-q)^2}{d^2}-1=0 \\ \end{array} \right. \tag{1}
$$
However, the
solve
function of Maxima CAS does not give me an answer (it just runs and hangs). Am I doing something wrong?The equations are as follows:
Method:
To solve, first we find the dual curves in line coordinates for the equations in $(1)$, which requires converting each to standard form and homogenizing
$$
\left\{
\begin{array}{c}
f_1(x,y,z)=b^2x^2+a^2y^2-2(hb^2x+ka^2y)z+(h^2b^2+k^2a^2-a^2b^2)z^2=0 \\ f_2(x,y,z)=d^2x^2+c^2y^2-2(pd^2x+qc^2y)z+(p^2d^2+q^2c^2-c^2d^2)z^2=0 \\ \end{array}
\right. \tag{2}
$$
and then recognizing that since
finding dual curves amounts to solving an optimization problem subject to a constraint via the method of Lagrangian multipliers
$$ \nabla f=\lambda \nabla g \ g = 0. $$
At point $(x_0,y_0,z_0)$, this becomes
$$ f_x(x_0,y_0,z_0) = \lambda X \ f_y(x_0,y_0,z_0) = \lambda Y \ f_z(x_0,y_0,z_0) = \lambda Z \ Xx_0+Yy_0+Zz_0=0. $$
(NOTE: In truth, $\lambda$ can go on either side without loss of generality since it is a proportionality constant we wish to eliminate.)
Solving the above yields our dual curves $F_1$ and $F_2$
$$ \left\{ \begin{array}{c} F_1(X,Y) = (h^2-a^2)X^2 + (2hk)XY + (k^2-b^2)Y^2 + 2hX + 2kY + 1 = 0 \\ F_2(X,Y) = (p^2-c^2)X^2 + (2pq)XY + (q^2-d^2)Y^2 + 2pX + 2qY + 1 = 0 \\ \end{array} \right. \tag{3} $$
Second, we must find the line of incidence (i.e. the "point of intersection") of the system (3), which amounts to solving the system for $X$ and $Y$. Since this is a multivariate polynomial system, we can compute the reduced Gröbner bases of the l-elimination ideals of the ideal $I=<F_1,F_2>$ generated by $F_1$ and $F_2$ to solve.
Let $K=\mathbb Q [a,b,c,d,h,k,p,q]$, which is algebraically closed, and $R = K[x,y]$ be a polynomial ring under pure lex monomial ordering. Since $R$ is Noetherian by the Hilbert Basis Theorem (i.e. $R$ is finitely generated), the varieties $V(I)$ are affine (i.e. finite and equal to the varieties of the generators of $I$).
Using Macaulay2, the generators of the Gröbner basis of $I$ are found via
which yields a large $1 X 10$ matrix. The first elimination ideal, $G_1$, is the first entry of $G$, which is a quartic in $y$ alone. Since there are two variables in our problem, there is no second elimination ideal (it is the empty set).
Since the leading coefficients of $x$ in the other 9 entries in $G-G_1$ are constants (they do not involve $y$), the Elimination Theorem guarantees we should be able to extend our solution for $y$.
Problem:
Attempting to solve $G_1$ with any of the other entries of $G-G_1$ using
solve
in Maxima CAS does not give a solution. Here is my code (I call the first entry of $G-G_1$ the variable $H$):