Question: Draw tangent lines from a given point on an ellipse.

Why this code does not work. Thank you.
restart;
with(plots);
with(geometry);
_EnvHorizontalName := 'x';
_EnvVerticalName := 'y';
x0 := 10;
y0 := 9;
a := 7;
b := 5;
c := sqrt(a^2 - b^2);
ellipse(el, x^2/a^2 + y^2/b^2 - 1);
point(F1, -c, 0);
point(F2, c, 0);
point(P, x0, y0);
eq := simplify((a^2 - x0^2)*(y - y0)^2 + (b^2 - y0^2)*(x - x0)^2 + 2*x0*y0*(x - x0)*(y - y0)) = 0;
eq := (a^2 - x0^2)*m^2 + 2*x0*y0*m + b^2 - y0^2 = 0;
sol := solve(%, m);
m1 := sol[1];
m2 := sol[2];
(y - y0 - m1) + (-x + x0);
(y - y0 - m2) + (-x + x0);
line(tang1, (y - y0 - m1) + (-x + x0));
line(tang2, (y - y0 - m2) + (-x + x0));
display*[textplot*([[-c, 0, "F1"], [c, 0, "F2"], [coordinates(P)[], "P"]], align = {"above", 'right'}), draw*([el(color = red), P(color = black, symbol = solidcircle, symbolsize = 16), tang1(color = green), tang2(color = green), F1(color = blue, symbol = solidcircle, symbolsize = 16), F2(color = red, symbol = solidcircle, symbolsize = 16)], axes = none)];
 

Please Wait...