graf=Plot3D[f[x,y],{x,-2,2},{y,-2,2},BoxRatios->{1,1,1}]

f[x_,y_]:=2-x^2-y^2
prvydiferencial[f_,a_,b_]:=
(D[f[x,y],x]/.{x->a,y->b})*(x-a)+
(D[f[x,y],y]/.{x->a,y->b})*(y-b)

dotykovarovina[f_,a_,b_]:=f[a,b]+prvydiferencial[f,a,b]

dotyk=Plot3D[Evaluate[dotykovarovina[f,1.5,1.5]],{x,-2,2},{y,-2,2}]
Show[graf,dotyk]

normalovyvektor[f_,a_,b_]:={{a,b,f[a,b]},
-{D[f[x,y],x]/.{x->a,y->b},D[f[x,y],y]/.{x->a,y->b},-1}}

<<"VectorFieldPlots`"

normalovyvektor[f,1.5,1.5]
sipka=ListVectorFieldPlot3D[{normalovyvektor[f,1.5,1.5]},VectorHeads->True,
ColorFunction->Hue];
Show[graf,sipka,dotyk,PlotRange->All,BoxRatios->Automatic]

dotyk=Plot3D[Evaluate[dotykovarovina[f,0.5,0.5]],{x,-2,2},{y,-2,2}]
sipka=ListVectorFieldPlot3D[{normalovyvektor[f,0.5,0.5]},VectorHeads->True,
ColorFunction->Hue];
Show[graf,sipka,dotyk,PlotRange->All,BoxRatios->Automatic]

grad[f_,a_,b_]:={D[f[x,y],x]/.{x->a,y->b},D[f[x,y],y]/.{x->a,y->b}}

a=grad[f,0,0]
Norm[a]
b=grad[f,0.1,-0.1]
Norm[b]
c=grad[f,-0.2,-0.2]
Norm[c]

g1=ContourPlot[f[x,y],{x,-2,2},{y,-2,2},
Contours->Table[c,{c,-1,2,0.25}]]

a=0.5;b=0;
s1=
Graphics[{RGBColor[1,0,0],
Arrow[{{a,b},{a+grad[f,a,b][[1]],b+grad[f,a,b][[2]]}}]}];
Show[g1,s1]

a=1/Sqrt[2];b=1/Sqrt[2];
s1=
Graphics[{RGBColor[1,0,0],
Arrow[{{a,b},{a+grad[f,a,b][[1]],b+grad[f,a,b][[2]]}}]}];
Show[g1,s1]

a=1/Sqrt[2];b=1/Sqrt[2];
s1=
Graphics[{RGBColor[1,0,0],
Arrow[{{a,b},{a-grad[f,a,b][[1]],b-grad[f,a,b][[2]]}}]}];
Show[g1,s1]

derivaciavsmere[f_,a_,b_,e_]:=grad[f,a,b].e

e={1,0};
dvs=derivaciavsmere[f,a,b,e];
s1=
Graphics[{RGBColor[1,0,0],

f[x_,y_]:=-1+Sqrt[x^2+y^2]/(0.6+0.4Sin[4ArcTan[y/x]])

graf=Plot3D[f[x,y],{x,-1,1},{y,-1,1},BoxRatios->{1,1,1}]

g1=ContourPlot[f[x,y],{x,-2,2},{y,-2,2},
Contours->Table[c,{c,-1,1,0.1}]]

{{a,b},{a+grad[f,a,b][[1]]/Norm[grad[f,a,b]],b+grad[f,a,b][[2]]/Norm[grad[f,a,b]]}}

s1=
Graphics[{RGBColor[1,0,0],
Arrow[{{a,b},{a+grad[f,a,b][[1]]/Norm[grad[f,a,b]],b+grad[f,a,b][[2]]/Norm[grad[f,a,b]]}}]}]

g1

a=1.5;b=0.6;
s1=
Graphics[{RGBColor[1,0,0],
Arrow[{{a,b},{a+grad[f,a,b][[1]]/Norm[grad[f,a,b]],b+grad[f,a,b][[2]]/Norm[grad[f,a,b]]}}]}];
s2=
Graphics[{RGBColor[0,0,1],
Arrow[{{a,b},{a-grad[f,a,b][[2]]/Norm[grad[f,a,b]],b+grad[f,a,b][[1]]/Norm[grad[f,a,b]]}}]}];
Show[g1,s1,s2,PlotRange->All,AspectRatio->Automatic]

f[x_,y_]:=-1+(x-1)^2+(y+2)^2
graf=Plot3D[f[x,y],{x,-3,5},{y,-5,1},BoxRatios->{1,1,1}]

stacbod=Solve[{D[f[x,y],x]==0,D[f[x,y],y]==0},{x,y}]

a=x/.stacbod[[1]]
b=y/.stacbod[[1]]
D[D[f[x,y],x],x]
D[D[f[x,y],x],x]/.{x->a,y->b}

f[x_,y_]:=1-(x-1)^2-(y+2)^2
graf=Plot3D[f[x,y],{x,-3,5},{y,-5,1},BoxRatios->{1,1,1}]
stacbod=Solve[{D[f[x,y],x]==0,D[f[x,y],y]==0},{x,y}]
a=x/.stacbod[[1]]
b=y/.stacbod[[1]]
Matica[a_,b_]:=
{{D[D[f[x,y],x],x]/.{x->a,y->b},D[D[f[x,y],x],x]/.{x->a,y->b}},