porteKZ.mws

> restart;with(plots):with(plottools):with(linalg):unprotect(O):

Warning, the name changecoords has been redefined

Warning, the name arrow has been redefined

Warning, the protected names norm and trace have been redefined and unprotected

Mouvement d'une porte KZ

> KZ_plot:=proc(theta0,L0)
local O0,A0,B0,L1,l1,l2,TA,TB,TC,TP,C1,C2;

O0:=[0,0]; A0:=[L0*cos(theta0),L0*sin(theta0)];B0:=[2*L0*cos(theta0),0];

l1:=line(O0,A0,color=green,thickness=4):TA:=textplot([A0[1],A0[2]+0.1,"A"],font=[HELVETICA,BOLD,20]):

l2:=line(A0,B0,color=green,thickness=4):TB:=textplot([B0[1],B0[2]+0.1,"B"],font=[HELVETICA,BOLD,20]):

C1:=arc(O0,L0,0..Pi/2,color=red): C2:=arc(O0,L0/5,0..theta0,color=blue):

L1:=line(O0,B0,color=red):

TP:=textplot([(A0[1]+B0[1])/2,(A0[2]+B0[2])/2+0.1,"P"],font=[HELVETICA,BOLD,20]):

TC:=textplot([L0/4*cos(theta0/2),L0/4*sin(theta0/2),"q"],font=[SYMBOL,20]):

display({l1,TA,l2,TB,C1,C2,L1,TC,TP},axes=boxed,scaling=constrained,title=`Portes KZ`);

end proc:

> KZ_plot(Pi/6,2.0);

[Plot]

> KZ_anim:=proc()
local theta,dtheta,L,N,i,F;

L:=2; N:=10:

theta:=0: dtheta:=Pi/(2*(N-1)):

for i from 1 to N do

  F[i]:=KZ_plot(theta,L):

  theta:=theta+dtheta:

end do;

F:=seq(F[i],i=1..N):

end proc:

> display(KZ_anim(),insequence=true,scaling=constrained,axes=none);

[Plot]

Equation du mouvement d'un point P de AB

> O:=[0,0]; A:=[L*cos(theta),L*sin(theta)];B:=[2*L*cos(theta),0];

O := [0, 0]

A := [L*cos(theta), L*sin(theta)]

B := [2*L*cos(theta), 0]

> OA:=matadd(O,A,-1,1); AB:=matadd(A,B,-1,1);

OA := vector([L*cos(theta), L*sin(theta)])

AB := vector([L*cos(theta), -L*sin(theta)])

> AP:=scalarmul(AB,x);

AP := vector([x*L*cos(theta), -x*L*sin(theta)])

> OP:=matadd(OA,AP);

OP := vector([L*cos(theta)+x*L*cos(theta), L*sin(theta)-x*L*sin(theta)])

Trajectoires des points P

> L:=1; Lx:=[0,1/4,1/2,3/4,1];

L := 1

Lx := [0, 1/4, 1/2, 3/4, 1]

> display(seq(plot(subs(x=Lx[i],[OP[1],OP[2],theta=0..Pi/2])),i=1..5),scaling=constrained,thickness=2);

[Plot]

>

FIN !