# Ejercicio 10.21

## Apartado a)

kill(all)$

f1(x,y):=x*(2*y+1);
f2(x,y):=x*(1-x)-y^2;
F(x,y):=if x<0 then f2(x,y) else f1(x,y);

Dxf1(x,y)=diff(f1(x,y),x);
Dyf1(x,y)=diff(f1(x,y),y);

Dxf1(x,y):=2*y+1$         
Dyf1(x,y):=2*x$
'Dxf1(x0,y0)=Dxf1(x0,y0);     
'Dyf1(x0,y0)=Dyf1(x0,y0);

'Dxf1(0,0)=Dxf1(0,0);     'Dyf1(0,0)=Dyf1(0,0);

## Apartado b)

Jf1(x,y) = Jf:jacobian([f1(x,y)] , [x,y]);

'Jf(x0,y0) = subst([x=0,y=0], Jf);

'F=F: matrix(
 [x], 
 [y]
);

DF(x,y)=subst([x=0,y=0], Jf).F;

F11(t):=(f1(0+t, 0) - f1(0,0))/(t);

limit( F11(t) , t, 0, plus);

F12(t):=(f2(0-t, 0) - f1(0,0))/(-t);

limit( F12(t) , t, 0, minus);

F2(t):=(f1(0, 0+t) - f1(0,0))/(t);

limit(F2(t),t,0,plus);

F2(t):=(f1(0, 0-t) - f1(0,0))/(-t);

limit(F2(t),t,0,minus);

## Apartado c)

'Tr=Tr:matrix([1],[-2]);

v=v:[2,1];

modul_Tr= m : sqrt(1^2+(-2)^2);
'Tu[1]=u1: Tr/m;

Dvf(0,0)=matrix([1,0]).u1;

## Apartado d)

Gradiente normal en la superficie z=f(x,y) en el punto (0,0,0):

'n= n:[1,0,-1];

Ecuación del plano tangente: x-z=0

Vector del eje OX:

e=e:[1,0,0];

e.n;

'n1=n1: sqrt(1^2+(0)^2+(-1)^2); 
'e1=e1:sqrt(1^2+(0)^2+(0)^2);

e.n=n1*e1*cos(alpha);

cos(alpha) = 1/sqrt(2);

alpha=acos(1/sqrt(2));