ClearAll["Global`*"]
(*--- funkce ---*)
(*f[x_,y_]:=Sin[3 x y]+0.5 Cos[x]*)
(*f[x_,y_]:=Sin[x y]*)
(*f[x_,y_]:=ArcTan[x^2+y^2]*)
f[x_,y_]:=Log[1+x^2+y^2]+0.2*x*y
fx[x_,y_]=D[f[x,y],x];
fy[x_,y_]=D[f[x,y],y];
(*----- GRAFICKÝ VÝSTUP -----*)
Manipulate[
Module[
{z0,fxab,fyab,rovina,skutecneZ,approxZ},
z0=f[a,b];
fxab=fx[a,b];
fyab=fy[a,b];
rovina[x_,y_]:=z0+fxab*(x-a)+fyab*(y-b);
(*--- hodnota funkce f v bodě (a+dx,b+dy)---*)
skutecneZ=f[a+dx,b+dy];
(*--- hodnota afinní aproximace funkce f v bodě (a+dx,b+dy)---*)
approxZ=rovina[a+dx,b+dy];
(*--- Výpis obrázků ---*)
Show[
Plot3D[f[x,y],{x,a-2.5,a+2.5},{y,b-2.5,b+2.5},Mesh->None,PlotPoints->60,PlotStyle->Directive[Opacity[0.7]],Lighting->"Neutral",ColorFunction->"Rainbow",
ColorFunctionScaling->True],
Plot3D[rovina[x,y],{x,a-2.5,a+2.5},{y,b-2.5,b+2.5},Mesh->None,PlotStyle->Directive[Opacity[0.35],LightGray]],
Graphics3D[{
Black,AbsolutePointSize[12],Point[{a,b,z0}],
Red,AbsolutePointSize[12],Point[{a+dx,b+dy,skutecneZ}],
Darker[Green],AbsolutePointSize[12],Point[{a+dx,b+dy,approxZ}],
Thick,Red,Line[{{a+dx,b+dy,approxZ},{a+dx,b+dy,skutecneZ}}]
}],
ImageSize->700,
ImagePadding->{{80,10},{10,10}},
BoxRatios->{1,1,0.7},
Boxed->False
]
],
Row[{
Column[{
Control@{{a,0,"a"},-1.5,1.5},
Control@{{b,0,"b"},-1.5,1.5}
}],
Spacer[50],
Column[{
Control@{{dx,1,"dx"},-2,2},
Control@{{dy,1,"dy"},-2,2}
}]
}],
ControlPlacement->Top,
ContinuousAction->False
]