Question: Triangle bisectors and Apollonius' hyperbola

restart;
with(plots);
A := [0, 0];
B := [4, 2];
C := [2, 3];
distance := proc(P1, P2) sqrt((P1[1] - P2[1])^2 + (P1[2] - P2[2])^2); end proc;
plot_triangle := proc(A, B, C) plot([A, B, C, A], style = line, color = black, thickness = 2); end proc;
plot_bisectors := proc(A, B, C) local AB, BC, CA, AB_bisector, BC_bisector, CA_bisector, i; AB := [A, B]; BC := [B, C]; CA := [C, A]; AB_bisector := [seq(A[i] + t*(B[i] - A[i]), i = 1 .. 2)]; BC_bisector := [seq(B[i] + t*(C[i] - B[i]), i = 1 .. 2)]; CA_bisector := [seq(C[i] + t*(A[i] - C[i]), i = 1 .. 2)]; plot([AB_bisector, BC_bisector, CA_bisector], t = 0 .. 1, style = line, color = blue, thickness = 2); end proc;
plot_apollonius := proc(A, B, C, ratio) local f, g; f := (x, y) -> sqrt((x - A[1])^2 + (y - A[2])^2)/sqrt((x - B[1])^2 + (y - B[2])^2) - ratio; g := implicitplot(f(x, y), x = -5 .. 5, y = -5 .. 5, grid = [100, 100], style = line, color = red, thickness = 2); g; end proc;
plot_inscribed_circle := proc(A, B, C) local a, b, c, s, r, Ii; a := distance(B, C); b := distance(A, C); c := distance(A, B); s := 1/2*a + 1/2*b + 1/2*c; r := sqrt((s - a)*(s - b)*(s - c)/s); Ii := [(a*A[1] + b*B[1] + c*C[1])/(a + b + c), (a*A[2] + b*B[2] + c*C[2])/(a + b + c)]; plot(circle(Ii, r), style = line, color = green, thickness = 2); end proc;
plot_exscribed_circles := proc(A, B, C) local a, b, c, s, rA, rB, rC, IA, IB, IC; a := distance(B, C); b := distance(A, C); c := distance(A, B); s := 1/2*a + 1/2*b + 1/2*c; rA := sqrt((s - b)*(s - c)*s/(s - a)); rB := sqrt((s - a)*(s - c)*s/(s - b)); rC := sqrt((s - a)*(s - b)*s/(s - c)); IA := [(a*A[1] - b*B[1] + c*C[1])/(a - b + c), (a*A[2] - b*B[2] + c*C[2])/(a - b + c)]; IB := [(a*A[1] + b*B[1] - c*C[1])/(a + b - c), (a*A[2] + b*B[2] - c*C[2])/(a + b - c)]; IC := [(-a*A[1] + b*B[1] + c*C[1])/(-a + b + c), (-a*A[2] + b*B[2] + c*C[2])/(-a + b + c)]; plot([circle(IA, rA), circle(IB, rB), circle(IC, rC)], style = line, color = magenta, thickness = 2); end proc;
with(geometry);
point(A1, 0, 0);
point(B1, 4, 2);
point(C1, 2, 3);
tx := textplot([[coordinates(A1)[], "A"], [coordinates(B1)[], "B"], [coordinates(C1)[], "C"]], font = [times, bold, 16], align = [above, left]);
triangle_plot := plot_triangle(A, B, C);
restart;
with(plots);
A := [0, 0];
B := [4, 2];
C := [2, 3];
distance := proc(P1, P2) sqrt((P1[1] - P2[1])^2 + (P1[2] - P2[2])^2); end proc;
plot_triangle := proc(A, B, C) plot([A, B, C, A], style = line, color = black, thickness = 2); end proc;
plot_bisectors := proc(A, B, C) local AB, BC, CA, AB_bisector, BC_bisector, CA_bisector, i; AB := [A, B]; BC := [B, C]; CA := [C, A]; AB_bisector := [seq(A[i] + t*(B[i] - A[i]), i = 1 .. 2)]; BC_bisector := [seq(B[i] + t*(C[i] - B[i]), i = 1 .. 2)]; CA_bisector := [seq(C[i] + t*(A[i] - C[i]), i = 1 .. 2)]; plot([AB_bisector, BC_bisector, CA_bisector], t = 0 .. 1, style = line, color = blue, thickness = 2); end proc;
plot_apollonius := proc(A, B, C, ratio) local f, g; f := (x, y) -> sqrt((x - A[1])^2 + (y - A[2])^2)/sqrt((x - B[1])^2 + (y - B[2])^2) - ratio; g := implicitplot(f(x, y), x = -5 .. 5, y = -5 .. 5, grid = [100, 100], style = line, color = red, thickness = 2); g; end proc;
plot_inscribed_circle := proc(A, B, C) local a, b, c, s, r, Ii; a := distance(B, C); b := distance(A, C); c := distance(A, B); s := 1/2*a + 1/2*b + 1/2*c; r := sqrt((s - a)*(s - b)*(s - c)/s); Ii := [(a*A[1] + b*B[1] + c*C[1])/(a + b + c), (a*A[2] + b*B[2] + c*C[2])/(a + b + c)]; plot(circle(Ii, r), style = line, color = green, thickness = 2); end proc;
plot_exscribed_circles := proc(A, B, C) local a, b, c, s, rA, rB, rC, IA, IB, IC; a := distance(B, C); b := distance(A, C); c := distance(A, B); s := 1/2*a + 1/2*b + 1/2*c; rA := sqrt((s - b)*(s - c)*s/(s - a)); rB := sqrt((s - a)*(s - c)*s/(s - b)); rC := sqrt((s - a)*(s - b)*s/(s - c)); IA := [(a*A[1] - b*B[1] + c*C[1])/(a - b + c), (a*A[2] - b*B[2] + c*C[2])/(a - b + c)]; IB := [(a*A[1] + b*B[1] - c*C[1])/(a + b - c), (a*A[2] + b*B[2] - c*C[2])/(a + b - c)]; IC := [(-a*A[1] + b*B[1] + c*C[1])/(-a + b + c), (-a*A[2] + b*B[2] + c*C[2])/(-a + b + c)]; plot([circle(IA, rA), circle(IB, rB), circle(IC, rC)], style = line, color = magenta, thickness = 2); end proc;
with(geometry);
point(A1, 0, 0);
point(B1, 4, 2);
point(C1, 2, 3);
tx := textplot([[coordinates(A1)[], "A"], [coordinates(B1)[], "B"], [coordinates(C1)[], "C"]], font = [times, bold, 16], align = [above, left]);
triangle_plot := plot_triangle(A, B, C);
bisectors_plot := plot_bisectors(A, B, C);
apollonius_plot := plot_apollonius(A, B, C, 1);
with(geometry);
inscribed_circle_plot := plot_inscribed_circle(A, B, C);
exscribed_circles_plot := plot_exscribed_circles(A, B, C);
display(triangle_plot, tx, bisectors_plot, apollonius_plot, axes = none, scaling = constrained, title = "Triangle with Bisectors, Apollonius Hyperbola, and Circles");
Error, (in plot) cannot determine plotting variable
Error, (in plot) cannot determine plotting variable
Warning, data could not be converted to float Matrix
Can you tel why these errors mean ? Thank you.
 

Please Wait...