Professional Documents
Culture Documents
Pract4 Transf2D Sols
Pract4 Transf2D Sols
reset();
use(linalg);
use(plot);
Warning: Identifier 'htranspose' already has a value. It is not exported. [use]
Warning: Identifier 'transpose' already has a value. It is not exported. [use]
Warning: Identifier 'Pyramid' seems to be protected. It is not exported. [use]
Warning: Identifier 'hull' already has a value. It is not exported. [use]
Warning: Identifier 'Integral' seems to be protected. It is not exported. [use]
Exemple 1
T:=matrix([[1,0,10],[0,1,0],[0,0,1]])
! "
1 0 10
0 1 0
0 0 1
Exemple 2
C:=matrix([[1,0,4],[0,1,4],[0,0,1]]);
R0:=matrix([[cos(-PI/4),-sin(-PI/4),0],[sin(-PI/4),cos(-PI/4),0],[0,0,1]]);
R1:=C*R0*C^(-1);
! "
1 0 4
0 1 4
0 0 1
# '& '& (
&&2 &&2 0
$ 2 2 )
$ '& '& )
$
$ − &&2 &&2 0 )
)
% 2 2 *
0 0 1
# '& '& '& (
&&2 &&2 4−4 2
$ 2 2 )
$ '& '& )
$
$ − &&2 )
% 2 &&2 4 )
*
2
0 0 1
Exemple 3
el:=t->matrix([2*cos(t),sin(t),1]):
el(t);
gel1:=Curve2d(el(t)[1..2],t=0..2*PI,Color=RGB::Blue):
plot(gel1,Scaling=Constrained)
# (
2 cos(t )
$ )
% sin(t ) *
1
y
1.0
0.5
-0.5
-1.0
y
1
-2 -1 1 2 3 4 5 6 7 8 9 10 11 12
-1 x
y
1
-2 -1 1 2 3 4 5 6 7 8 9 10 11 12
-1 x
-2
-3
-4
Exercici 1
C:=matrix([[1,0,1],[0,1,1],[0,0,1]]);
H2:=matrix([[2,0,0],[0,2,0],[0,0,1]]);
T2:=C*H2*C^(-1)
! "
1 0 1
0 1 1
0 0 1
! "
2 0 0
0 2 0
0 0 1
# (
2 0 −1
$ )
%0 2 −1 *
0 0 1
C:=concatMatrix(u,v,P);
Sx:=matrix([[1,0,0],[0,-1,0],[0,0,1]]);
T3:=C*Sx*C^(-1)
# '&&
& '&&& (
3 13 2
&&&& &&&&13
− 13 −2
$ 13 )
$ '&&& '&&& )
$ 2 13 3 13 )
$ &&&& &&&& 0 )
% 13 13 *
0 0 1
! "
1 0 0
0 −1 0
0 0 1
# (
&5& − 12
&& − 16
&&
$ 13 13 13 )
$ )
$ − 12
&& &5
& 24
&& )
% 13 − 13 − 13 *
0 0 1
M:=T3*T2*T1
# (
10
&& − 24
&& − 1
$ 13 13 )
$ )
$ − 24
& − 10 )
% & 13
&& − 5
13 *
0 0 1
(b) L'apliquem a l'el.lipse
el:=t->matrix([1+5*cos(t),1+2*sin(t),1]):
el(t);
gel1:=Curve2d(el(t)[1..2],t=0..2*PI,Color=RGB::Blue):
plot(gel1,Scaling=Constrained)
# (
5 cos(t ) + 1
$ )
% 2 sin(t ) + 1 *
1
y
3
-4 -3 -2 -1 1 2 3 4 5 6
x
-1
Li apliquem el moviment
el2:=t->M*el(t):
el2(t);
# (
50 cos(t&) sin(t&)
&&&&&
13
− 48
&&&&&
13
− 27
&&
13
$ )
$ )
$
$ − 120 cos(t ) 20 sin(t ) 99
)
)
% &&&&&&& − &&&&&& − &&
13 13 13 *
1
Les dibuixem
gel2:=Curve2d((el2(t))[1..2],t=0..2*PI,Color=RGB::Red):
plot(gel1,gel2,Scaling=Constrained)
y
2
-6 -4 -2 2 4 6
-2 x
-4
-6
-8
-10
-12
-14
-16
Fem els tres moviments per separat, pero un darrere l'altre, i comprovem que surt el mateix
elT1:=t->T1*el(t):
elT2:=t->T2*elT1(t):
elT3:=t->T3*elT2(t):
gelT1:=Curve2d((elT1(t))[1..2],t=0..2*PI,Color=RGB::Orange):
gelT2:=Curve2d((elT2(t))[1..2],t=0..2*PI,Color=RGB::Black):
gelT3:=Curve2d((elT3(t))[1..2],t=0..2*PI,Color=RGB::Red):
plot(gel1,gelT1,gelT2,gelT3,Scaling=Constrained)
y
6
-6 -4 -2 2 4 6 8 10 12 14
-2 x
-4
-6
-8
-10
-12
-14
-16
En blau l'el·lipse inicial, en taronja despres del primer moviment, en negre despres del segon i en
vermell despres del tercer
Exercici 3
u:=normalize(matrix([-1,4,0]));
v:=normalize(matrix([2,1,0]));
P:=matrix([-1,3,1]);
C:=concatMatrix(u,v,P);
# '&&
& (
17
− &&&
17
$ )
$ '&&& )
$
$ 4&&&&
17 )
)
% 17 *
0
# '& (
2
&&&&5
$ 5 )
$ '& )
$
$ &&5 )
)
% 5 *
0
! "
−1
3
1
# '&&
& '& (
17 2 &5 − 1
− &&& &&&
$ 17 5 )
$ '&&& '& )
$ 4 17 )
$ &&&&
% 17 &&5 3 )
*
5
0 0 1
S:=matrix([[3.5,0,0],[0,0.5,0],[0,0,1]]);
T1:=C*S*C^(-1)
! "
3.5 0 0
0 0.5 0
0 0 1
# (
0.8333333333 − 0.6666666667 1.833333333
$ )
% − 1.333333333 3.166666667 − 7.833333333 *
0 0 1
u:=normalize(matrix([2,1,0]));
v:=normalize(matrix([1,-2,0]));
P:=matrix([-5,0,1]);
C:=concatMatrix(u,v,P);
Px:=matrix([[1,0,0],[0,0,0],[0,0,1]]);
T2:=C*Px*C^(-1)
# '& (
2 &5
&&&
$ 5 )
$ '& )
$
$ &&5 ))
% 5 *
0
# '& (
&&5
$ 5 )
$ '& )
$ 2 )
$−
% &&& &5 )
*
5
0
! "
−5
0
1
# '& '& (
2 &
5
&&& &&5 −5
$ 5 5 )
$ '& '& )
$ 5 2 )
$ &&
% 5 − &&& &5 0 )
*
5
0 0 1
! "
1 0 0
0 0 0
0 0 1
# (
4
& 2 −1
&
$5 5
)
$
$ 2& )
% 5
1
&
5
2 )
*
0 0 1
(c)
T3:=T2*T1
! "
0.1333333333 0.7333333333 − 2.666666667
0.06666666667 0.3666666667 1.166666667
0 0 1
(d)
T4:=T1*T2
# (
0.4 0.2 − 0.3333333333
$ )
%0.2 0.1 − 0.1666666667 *
0 0 1
Observem que no és la mateixa matriu (per tant, els moviments (a) i (b) no commuten)
Exercici 4
Circumferencia inicial:
circ:=t->matrix([-1+cos(t),3+sin(t),1]):
circ(t);
dibcirc:=Curve2d(circ(t)[1..2],t=0..2*PI,Color=RGB::Blue):
plot(dibcirc,Scaling=Constrained)
# (
cos(t ) − 1
$ )
% sin(t ) + 3 *
1
y
4.0
3.5
3.0
2.5
2.0
-2.0 -1.5 -1.0 -0.5 0.0
x
Les dibuixem
dibcirc1:=Curve2d((circ1(t))[1..2],t=0..2*PI,Color=RGB::Red):
plot(circ1,dibcirc1,Scaling=Constrained)
y
6
0
-2 -1
t
Podem veure les direccions de la semblança (són les fletxes verdes):
A:=matrix([-1,3]);
v:=matrix([-1,4]);
w:=matrix([2,1]);
vg:=Arrow2d((A,A+v),Color = RGB::Green);
wg:=Arrow2d((A,A+w),Color = RGB::Green);
plot(dibcirc,dibcirc1,vg,wg, Scaling=Constrained);
+ ,
−1
3
+ ,
−1
4
- .
2
1
y
7
-2 -1 1
x
Circumferencia inicial:
circ:=t->matrix([-1+cos(t),3+sin(t),1]):
circ(t);
dibcirc:=Curve2d(circ(t)[1..2],t=0..2*PI,Color=RGB::Blue):
plot(dibcirc,Scaling=Constrained)
# (
cos(t ) − 1
$ )
% sin(t ) + 3 *
1
y
4.0
3.5
3.0
2.5
2.0
-2.0 -1.5 -1.0 -0.5 0.0
x
1
Les dibuixem (projeccio en vermell)
dibcirc2:=Curve2d((circ2(t))[1..2],t=0..2*PI,Color=RGB::Red):
plot(dibcirc,dibcirc2,Scaling=Constrained)
y
4.0
3.5
3.0
2.5
2.0
y
4
-5 -4 -3 -2 -1 0
x