JAMET

425 Reputation

4 Badges

7 years, 155 days

MaplePrimes Activity


These are questions asked by JAMET

How to make this program more effective ?
 

A := [-3, 1, 2];
B := [-2, -1, 1];
C := [0, 3, -3];
                        A := [-3, 1, 2]

                        B := [-2, -1, 1]

                        C := [0, 3, -3]

alpha[1] := 2;#weight
alpha[2] := -1;
alpha[3] := 1;
                         alpha[1] := 2

                         alpha[2] := -1

                         alpha[3] := 1

x[1] := A[1];
x[2] := B[1];
x[3] := C[1];
                           x[1] := -3

                           x[2] := -2

                           x[3] := 0

y[1] := A[2];
y[2] := B[2];
y[3] := C[2];
                           y[1] := 1

                           y[2] := -1

                           y[3] := 3

z[1] := A[3];
z[2] := B[3];
z[3] := C[3];
                           z[1] := 2

                           z[2] := 1

                           z[3] := -3

sum(alpha[i], i = 1 .. 3);
                               2

xG := sum(alpha[i]*x[i], i = 1 .. 3)/sum(alpha[i], i = 1 .. 3);
                            xG := -2

yG := sum(alpha[i]*y[i], i = 1 .. 3)/sum(alpha[i], i = 1 .. 3);
                            yG := 3

zG := sum(alpha[i]*z[i], i = 1 .. 3)/sum(alpha[i], i = 1 .. 3);
                            zG := 0
Thank you.

restart;
with(geometry):
with(plots):
_EnvHorizont:lName = 'x';
_EnvVerticalName = 'y';
Vdot := proc(U, V) local i; add(U[i]*V[i], i = 1 .. 2); end proc;
R := 5;
ang := [3/4*Pi, -(3*Pi)/4, -Pi/6,4*Pi/9];
seq(point(`||`(P, i), [R*cos(ang[i]), R*sin(ang[i])]), i = 1 .. 4);
pts:=[seq(P || i,i=1..4)]:
seq(dsegment(`||`(seg, i), [`||`(P, i), `||`(P, irem(i, 4) + 1)]), i = 1 .. 4);
Triangle(Tr1,[P1,P2,P4]);
EulerCircle(Elc1,Tr1,'centername'=o);
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), 
P4(color = black, symbol = solidcircle, symbolsize = 12),seg1,
seg2,seg3,seq4,Tr1,Elc1,
cir(color = blue)]), 
textplot([[seq( [ coordinates(`||`(P, i))[], convert(`||`(P, i), string)],i=1..4], 
,align = [above, right]), axes = none);
does not recognize neg4 or tr1? I don't know to manage. Thank you.

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

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);
Thank you for your help.

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.

First 9 10 11 12 13 14 15 Last Page 11 of 33