Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

PRACTICA 4. Transformacions lineals al pla.

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

-2.0 -1.5 -1.0 -0.5 0.5 1.0 1.5 2.0


x

-0.5

-1.0

Hi apliquem la translació de l'exemple 1:


el2:=t->T*el(t);
el2(t);
t → T el(t )
# (
2 cos(t ) + 10
$ )
% sin(t ) *
1

Ho dibuixem (en vermell):


gel2:=Curve2d((el2(t))[1..2],t=0..2*PI,Color=RGB::Red):
plot(gel1,gel2,Scaling=Constrained)

y
1

-2 -1 1 2 3 4 5 6 7 8 9 10 11 12
-1 x

Li apliquem 1r la translació i 2n la rotació, i ho dibuixem (en verd):


el3:=t->(R1*T)*el(t);
el3(t);
gel3:=Curve2d((el3(t))[1..2],t=0..2*PI,Color=RGB::Green):
plot(gel1,gel2,gel3,Scaling=Constrained)
t → (R1 T ) el(t )
# '& '& '& (
2 sin(t&)
2 + 2 cos(t ) + &&&&& +4
$ 2 )
$ '& )
$ 2 sin(t ) '& '& )
$ &&&&&& − 2 cos(t ) − 5 2 + 4 )
% 2 *
1

y
1

-2 -1 1 2 3 4 5 6 7 8 9 10 11 12
-1 x

-2

-3

-4

Exercici 1

a) Translacio de vector u= (3,3)-(1,2)= (2,1)


T1:=matrix([[1,0,2],[0,1,1],[0,0,1]])
! "
1 0 2
0 1 1
0 0 1

b) Homotecia centre (1,1), rao 2.

Nou SR = { (1,1); (1,0), (0,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) Simetria respecte recta 2x+3y+4 =0

Nou SR= { (-2,0) ; (-3,2)/norma, (2,3)/norma}


En aquest nou SR, la simetria es Sox
u:=normalize(matrix([-3,2,0]));
v:=normalize(matrix([2,3,0]));
P:=matrix([-2,0,1])
# '&&& (
− 3&&&&
13
$ 13 )
$ '&&& )
$ 2 13 )
$ &&&& )
% 13 *
0
# '&&
& (
2 13
&&&&
$ 13 )
$ '&&& )
$ 3 13 )
$ &&&& )
% 13 *
0
! "
−2
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

Tambe es podria fer


Nou SR: { (-2,0) ; (2,3)/norma, (-3,2)/norma}
En aquest nou SR, la simetria es Soy
C2:=concatMatrix(v,u,P);
Sy:=matrix([[-1,0,0],[0,1,0],[0,0,1]]);
T3bis:=C2*Sy*C2^(-1)
# '&&& '&& & (
2 13
&&&& 3
&&&&13
− − 2
$ 13 13 )
$ '&&& )
$ 3 13 2 '&& &
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

Observem que surt la mateixa matriu fent-ho de les dues maneres


Exercici 2

(a) La matriu que busquem es:

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

(a) Nou SR ={(-1,3), (-1,4)/norma, (2,1)/norma}

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

(b) Nou SR = { (-5,0); (2,1)/norma, (1,-2)/norma}


En aquest nou SR la projeccio es Pox

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

Per a la semblança de l'apartat (a).

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

Li apliquem la transformacio lineal:


circ1:=t->T1*circ(t):
circ1(t);
# (
0.8333333333 cos(t ) − 0.6666666667 sin(t ) − 1.0
$ )
% 3.166666667 sin(t ) − 1.333333333 cos(t ) + 3.0 *
1

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

plot::Arrow2d([ − 1, 3], [ − 2, 7])

plot::Arrow2d([ − 1, 3], [1, 4])

y
7

-2 -1 1
x

Per a la projecció de l'apartat (b).

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

Li apliquem la transformacio lineal:


circ2:=t->T2*circ(t):
circ2(t);
# (
4 cos(t ) sin(t&)
&&&&&
5
+ 2&&&&
5
3
−&
5
$ )
$ )
$ cos(t ) )
$ 2&&&&&
% 5 &&&t&) + 11
+ sin( && )
*
5 5

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

-2.0 -1.5 -1.0 -0.5 0.0


x

Podem veure la recta sobre la qual hem projectat (en verd):


dibrecta:=Line2d([-5,0],[0,5/2],Color=RGB::Green);
plot(dibcirc,dibcirc2,dibrecta, Scaling=Constrained);
- / 0.
5
plot::Line2d [ − 5, 0], 0, &
2

y
4

-5 -4 -3 -2 -1 0
x

You might also like