370 Reputation

5 years, 225 days

Difficulty with displat draw and textplo...

Maple 2021

restart;
with(geometry):
with(plots):
_EnvHorizontalName = 'x':
_EnvVerticalName = 'y':
Vdot := proc(U, V) local i; add(U[i]*V[i], i = 1 .. 2); end proc:
R := 5:
ang := [2/3*Pi, -3*Pi*1/4, -Pi*1/6]:
seq(point(`||`(P, i), [R*cos(ang[i]), R*sin(ang[i])]), i = 1 .. 3):
seq(dsegment(`||`(seg, i), [`||`(P, i), `||`(P, irem(i, 3) + 1)]), i = 1 .. 3):
circle(cir, [point(OO, [0, 0]), R]):
dist := proc(M, N) sqrt(Vdot(M - N, M - N)); end proc:

display*([draw*[P1(color = black, symbol = solidcircle, symbolsize = 12),
P2(color = black, symbol = solidcircle, symbolsize = 12),
P3(color = black, symbol = solidcircle, symbolsize = 12),
cir(color = blue)],
textplot*([[coordinates(P1)[], "P1"],
[coordinates(P2)[], "P2"],
[coordinates(P3)[], "P3"]], align = [above, right])], axes = none);
/[
plots:-display |[geometry:-draw [
\[

P1(color = black, symbol = solidcircle, symbolsize = 12),

P2(color = black, symbol = solidcircle, symbolsize = 12),

P3(color = black, symbol = solidcircle, symbolsize = 12),

/[[-5  5  (1/2)      ]
cir(color = blue)], plots:-textplot |[[--, - 3     , "P1"],
\[[2   2             ]

[  5  (1/2)    5  (1/2)      ]  [5  (1/2)  -5      ]]
[- - 2     , - - 2     , "P2"], [- 3     , --, "P3"]],
[  2           2             ]  [2         2       ]]

\]             \
align = [above, right]|], axes = none|
/]             /

no figure drawn, Why? Thank you

Projection of a point on a line...

Maple 2021

do not accept substitution after line EQ
restart;
with(LinearAlgebra);
A := [1, -2];
B := [-2, 3];
C := [1, 1];
M := [x, y];
ProjPL := proc(C, A, B) local M, AB, AM, Q, eq, EQ, eq1, a, b, c, t, tt, n, dist, x, y, xH, yH, H, CH, no; M := [x, y]; AM := M - A; AB := B - A; Q := Matrix(2, [AM, AB]); eq := Determinant(Q); a := coeff(eq, x); b := coeff(eq, y); c := tcoeff(eq); dist := abs(a + b + c)/sqrt(a^2 + b^2); n := [a, b]; x := C[1] + n[1]*t; y := C[2] + n[2]*t; EQ := eq = 0; tt := solve(subs(x = C[1] + n[1]*t, y = C[2] + n[2]*t, EQ), t); xH := subs(t = tt, x); yH := subs(t = tt, y); H := [xH, yH]; CH := H - C; no := sqrt(CH[1]^2 + CH[2]^2); RETURN(EQ, dist, H, no); end proc;
ProjPL(C, A, B);

poncelet theorem for the triangle...

Maple 2021

restart;
with(geometry);
with(plots);
_EnvHorizontalName = 'x';
_EnvVerticalName = 'y';
Vdot := proc(U, V) local i; add(U[i]*V[i], i = 1 .. 2); end proc;
dist := proc(M, N) sqrt(Vdot(M - N, M - N)); end proc;
EQ := proc(M, N) local eq, a, b, c; eq := simplify(expand((y - M[2])/(x - M[1]) - (N[2] - M[2])/(N[1] - M[1]))*(x - P1[1])*(P2[1] - P1[1])); a := coeff(eq, x); b := coeff(eq, y); c := tcoeff(eq, [x, y]); RETURN(-a*x/c - b*y/c - 1); end proc;
R := 5;
ang := [2/3*Pi, -3*Pi*1/4, -Pi*1/6];
seq(point(`||`(P, i), [R*cos(ang[i]), R*sin(ang[i])]), i = 1 .. 3);
seq(dsegment(`||`(seg, i), [`||`(P, i), `||`(P, irem(i, 3) + 1)]), i = 1 .. 3);
circle(cir, [point(OO, [0, 0]), R]);
sol := solve(subs(x = 2, Equation(cir, [x, y])), y);
point(A, [2, sol[1]]);
triangle(Tri, [P1, P2, P3]);
incircle(inc, Tri, 'centername' = oo);
circle(Cr, [A, oo]);
sol := solve({Equation(Cr, [x, y]), Equation(inc, [x, y])}, {x, y});
point(H1, [subs(sol, x), subs(sol, y)]);
line(L, [A, oo]);
reflection(H2, H1, L);
line(L1, [A, H1]);
line(L2, [A, H2]);
Equation(cir, [x, y]);
Equation(L1, [x, y]);
sol := solve({Equation(L1, [x, y]), Equation(cir, [x, y])}, {x, y});
evalf(%);
point(M1, [subs(sol, x), subs(sol, y)]);
sol2 := solve({Equation(L2, [x, y]), Equation(cir, [x, y])}, {x, y});
evalf(%);
point(M2, [subs(sol2, x), subs(sol2, y)]);
triangle(TR, [M1, M2, A]);
display([draw([P1(symbol = solidcircle, symbolsize = 8, color = blue), P2(symbol = solidcircle, symbolsize = 8, color = blue), P3(symbol = solidcircle, symbolsize = 8, color = blue), A(symbol = solidcircle, symbolsize = 8, color = black), H1(symbol = solidcircle, symbolsize = 8, color = black), H2(symbol = solidcircle, symbolsize = 8, color = black), L1(color = black), L2(color = black), seg1(color = magenta), seg2(color = magenta), seg3(color = magenta), Cr(color = black), cir(color = magenta), inc(color = blue)]), textplot([seq([coordinates(`||`(P, i))[], convert(`||`(P, i), string)], i = 1 .. 3)], 'align' = {'above', 'left'})], view = [-6 .. 10, -15 .. 6], scaling = constrained, size = [800, 800], axes = none);
It seems that there is conusion between M1 and M2. How to write letters A, M1 ,M2, H1, H2 ? Thank you.

Problem with power...

Maple 2021

A:= <x1,y1,z1>:  B:= <x2,y2,z2>:  P :=<x3, y3, z3>:  H:=A+t*(B-A):  solve( (P-H)^+ . (B-A), t ):  'H'=eval(H, t=`%` );

Error, invalid powe, rhow to overcome this mistake ? Thank you.
Typesetting:-mambiguous( AAssign (x1commay1commaz1)colon  BAssign

(x2commay2commaz2)colon  P Assign(x3comma y3comma z3)colon  H

AssignA + tast(Buminus0A)colon  solveApplyFunction(

Typesetting:-mambiguous((Puminus0H)circ + ,

Typesetting:-merror("invalid power")) period (Buminus0A)comma t

)colon  (H)equalsevalApplyFunction(Hcomma tequals% )semi)

Brianch0n theoreme with hexagon...

Maple 2021

Théorème de Brianchon
restart; with(plots):unprotect(gamma):
Error, missing operator or `;`
##Si un hexagone est circonscrit à un cercle, les droites qui joignent les sommets opposés passent par un même point.
_EnvHorizontalName := 'x';_EnvVerticalName := 'y';
_EnvHorizontalName := x

_EnvVerticalName := y

line := proc (x1, y1, x2, y2) options operator, arrow; (x-x1)*(y2-y1)-(y-y1)*(x2-x1) end proc:
R := 3:
ang := [0, (1/3)*Pi, 3*Pi*(1/4)+.2, 7*Pi*(1/6)+.4, 8*Pi*(1/5), 13*Pi*(1/7)]:
for i to 6 do P || i := [R*cos(ang[i]), R*sin(ang[i])] end do:
pts := [seq(P || i, i = 1 .. 6)]:
for i to 6 do tang || i := x*P || i[1]+y*P || i[2] = R^2 end do:
sol:=solve({tang1,tang3},{x,y}):Q13:=[subs(sol,x),subs(sol,y)]:
sol := solve({tang1, tang2}, {x, y}): Q1 := [subs(sol, x), subs(sol, y)]:
sol := solve({tang2, tang3}, {x, y}): Q2 := [subs(sol, x), subs(sol, y)]:
sol := solve({tang3, tang4}, {x, y}): Q3 := [subs(sol, x), subs(sol, y)]:
sol := solve({tang4, tang5}, {x, y}): Q4 := [subs(sol, x), subs(sol, y)]:
sol := solve({tang5, tang6}, {x, y}): Q5 := [subs(sol, x), subs(sol, y)]:
sol := solve({tang1, tang6}, {x, y}): Q6 := [subs(sol, x), subs(sol, y)]:
ptQ := [seq(Q || i, i = 1 .. 6)]:
line14 := line(Q1[1], Q1[2], Q4[1], Q4[2]): L14 := implicitplot(line14, x = -10 .. 10, y = -10 .. 10, color = red):
line25 := line(Q2[1], Q2[2], Q5[1], Q5[2]): L25 := implicitplot(line25, x = -10 .. 10, y = -10 .. 10, color = red):
line36 := line(Q3[1], Q3[2], Q6[1], Q6[2]): L36 := implicitplot(line36, x = -10 .. 10, y = -10 .. 10, color = red):
sol := solve({line14, line25}, {x, y}): I1 := [subs(sol, x), subs(sol, y)]:

lineP23 := line(P2[1], P2[2], P3[1], P3[2]): lineP56 := line(P5[1], P5[2], P6[1], P6[2]):
sol := solve({lineP23, lineP56}, {x, y}): gamma := [subs(sol, x), subs(sol, y)]:
Error, attempting to assign to `gamma` which is protected.  Try declaring `local gamma`; see ?protect for details.
lineP12 := line(P1[1], P1[2], P2[1], P2[2]): lineP45 := line(P4[1], P4[2], P5[1], P5[2]):
sol := solve({lineP12, lineP45}, {x, y}): beta := [subs(sol, x), subs(sol, y)]:
lineP34 := line(P3[1], P3[2], P4[1], P4[2]): lineP16 := line(P1[1], P1[2], P6[1], P6[2]):
sol := solve({lineP16, lineP34}, {x, y}): alpha := [subs(sol, x), subs(sol, y)]:
pl:= line(alpha[1], alpha[2], gamma[1], gamma[2]):
hexa := seq(implicitplot(tang||i, x = -20 .. 20, y = -20 .. 20, linestyle=3,color = blue),i=1..6);
hexa:=plot([seq([P||i,P||(i mod 6)+1],i=1..6),color=green);
hexa:=plot([seq([P||i,P||(i+1)],i=1..6)],thickness=4,color=green);
hex:=plot([[Q1,Q2],[Q2,Q3],[Q3,Q4],[Q4,Q5],[Q5,Q6],[Q6,Q1]],thickness=4,color=green);
tp := textplot({seq([op(pts[i]), cat("P", i)], i = 1 .. 6)}, 'align' = {'above', 'left'});
tpq := textplot({seq([op(ptQ[i]), cat("Q", i)], i = 1 .. 6)}, 'align' = {'above', 'left'});
TP:=textplot([[I1[],"I"],[alpha[],"alpha"],[beta[],"beta"],[gamma[],"gamma"]],'align' = {'above', 'left'});
slopes:=[seq(((dx,dy)->dy/dx)((pts[i]-pts[(i mod 6)+1])[]),i=1..6)];
lines:=zip((pt,slope)->y=slope*(x-pt[1])+pt[2],pts,slopes);
plotpts:=plot(pts,style=point,colour=red,symbol=solidcircle,symbolsize=5);
plotptQ:=plot(ptQ,style=point,colour=black,symbol=solidcircle,symbolsize=5);
plotlines:=plot(rhs~(lines),style=line,linestyle=3,colour=magenta);
cir:=implicitplot(x^2+y^2=R^2,x=-R..R,y=-R..R,color=black);
PL:=implicitplot(pl,x=-1..15,y=-15..6,color=blue,thickness=3);

hexa := implicitplot(tang1, x = -20 .. 20, y = -20 .. 20,

linestyle = 3, color = blue), implicitplot(tang2,

x = -20 .. 20, y = -20 .. 20, linestyle = 3, color = blue),

implicitplot(tang3, x = -20 .. 20, y = -20 .. 20,

linestyle = 3, color = blue), implicitplot(tang4,

x = -20 .. 20, y = -20 .. 20, linestyle = 3, color = blue),

implicitplot(tang5, x = -20 .. 20, y = -20 .. 20,

linestyle = 3, color = blue), implicitplot(tang6,

x = -20 .. 20, y = -20 .. 20, linestyle = 3, color = blue)

Error, `)` unexpected
display(plotpts,plotptQ,plotlines,hex,cir,L14,L25,L36,PL,tp,tpq,TP,axis = [gridlines = [4, color = blue]],
view=[-6..10,-15..6],scaling=constrained,axes=none,size=[800,800]);
display(plotpts, plotptQ, plotlines, hex, cir,

implicitplot(0, x = -10 .. 10, y = -10 .. 10, color = red),

implicitplot(0, x = -10 .. 10, y = -10 .. 10, color = red),

implicitplot(0, x = -10 .. 10, y = -10 .. 10, color = red), PL,

tp, tpq, TP, axis = [gridlines = [4, color = blue]],

view = [-6 .. 10, -15 .. 6], scaling = constrained,

axes = none, size = [800, 800])

NULL;
I don’t know how to correct those mistakes. Thank you to help me.

 1 2 3 4 5 6 7 Last Page 2 of 23
﻿