How can I draw this picture in tikz, where D shows the domain of the function.

Asked
Active
Viewed 259 times
2 Answers
1
This may be a start. Using lualatex speeds up the compilation.
\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=middle,trig format plots=rad,axis
equal,colormap/viridis,xtick=\empty,ytick=\empty,ztick=\empty,
declare function={f(\x,\y)=4-0.5*pow(\x*cos(\y),2)+0.3*pow(\x*sin(\y),2);},
samples=71,smooth]
\addplot3[domain=0:2,domain y=0:2*pi,surf,shader=flat,color=gray!20]
({2*x*cos(y)},{x*sin(y)},{0});
\addplot3[domain=0:2,domain y=0:2*pi,surf,shader=interp]
({2*x*cos(y)},{x*sin(y)},{f(x,y)});
\draw[-stealth] (0,0,{f(0,0)}) -- (0,0,{f(0,0)+1});
\end{axis}
\end{tikzpicture}
\end{document}
0
Although I have used as in other circumstances the tool for TikZ, called Mathcha (https://www.mathcha.io/editor), I add, humbly, my answer. I hope that the picture, which I have retouched with many modifications, is very similar to the original.
%% Compile and read me!
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{newtxtext,newtxmath}
\begin{document}
% Gradient Info
\tikzset {_hnkzb4w96/.code = {\pgfsetadditionalshadetransform{ \pgftransformshift{\pgfpoint{0 bp } { 0 bp } } \pgftransformrotate{0 } \pgftransformscale{2 } }}}
\pgfdeclarehorizontalshading{_tf04f6hoq}{150bp}{rgb(0bp)=(1,0.75,0.02);
rgb(38.30357142857143bp)=(1,0.75,0.02);
rgb(61.160714285714285bp)=(1,0.84,0.37);
rgb(100bp)=(1,0.84,0.37)}
\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,300); %set diagram left start at 0, and has height of 300
%Shape: Polygon Curved [id:ds6815365882927698]
\draw [color=blue,draw opacity=.7][fill={rgb, 255: red, 76; green, 170; blue, 202 } ,fill opacity=.5 ] (340,58) .. controls (368.5,64) and (407.5,84) .. (420.5,94) .. controls (433.5,104) and (418.5,143) .. (388.5,141) .. controls (358.5,139) and (299.5,85) .. (265.5,83) .. controls (231.5,81) and (165.5,126) .. (156.5,112) .. controls (147.5,98) and (168.5,63) .. (233.5,56) .. controls (298.5,49) and (311.5,52) .. (340,58) -- cycle ;
%Shape: Polygon Curved [id:ds12217390318310284]
\path[color=brown,draw opacity=1][fill={rgb, 255: red, 249; green, 216; blue, 175} ,fill opacity=.5 ] (185.5,165) .. controls (212.5,148) and (240.82,164.71) .. (304.5,168) .. controls (357.5,175) and (382.5,182) .. (397.25,186) .. controls (422.5,196) and (413.75,267) .. (373.5,267) .. controls (333.25,267) and (180.5,225) .. (163.5,216) .. controls (138.75,207) and (158.5,182) .. (185.5,165) -- cycle ; % for fading
\draw [color=brown,draw opacity=.7][line width=1.5] (185.5,165) .. controls (212.5,148) and (240.82,164.71) .. (304.5,168) .. controls (357.5,175) and (382.5,182) .. (397.25,186) .. controls (422.5,196) and (413.75,267) .. (373.5,267) .. controls (333.25,267) and (180.5,225) .. (163.5,216) .. controls (138.75,207) and (158.5,182) .. (185.5,165) -- cycle ; % for border
%Straight Lines [id:da9098657818264375]
\draw (200,100.33) -- (200,181) ;
%Straight Lines [id:da9371044986986037]
\draw (199.67,70) -- (199.98,15.67) ;
\draw [shift={(200,12.67)}, rotate = 450.33] [fill={rgb, 255:red, 0; green, 0; blue, 0 } ][line width=0.08] [draw opacity=0] (10.72,-5.15) -- (0,0) -- (10.72,5.15) -- (7.12,0) -- cycle ;
%Straight Lines [id:da4338438995664917]
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}] (199.67,70) -- (200,100.33) ;
%Straight Lines [id:da512890093984915]
\draw (200,181) -- (151.47,236.74) ;
\draw [shift={(149.5,239)}, rotate = 311.05] [fill={rgb, 255:red, 0; green, 0; blue, 0 } ][line width=0.08] [draw opacity=0] (10.72,-5.15) -- (0,0) -- (10.72,5.15) -- (7.12,0) -- cycle ;
%Straight Lines [id:da33048780019886626]
\draw (200,181) -- (466.53,216.6) ;
\draw [shift={(469.5,217)}, rotate = 187.61] [fill={rgb, 255:red, 0; green, 0; blue, 0 } ][line width=0.08] [draw opacity=0] (10.72,-5.15) -- (0,0) -- (10.72,5.15) -- (7.12,0) -- cycle ;
%Straight Lines [id:da08451487109040978]
\draw [color={rgb, 255:red, 155; green, 155; blue, 155 } ,draw opacity=1 ] [dash pattern={on 4.5pt off 4.5pt}] (371,105) -- (370.5,141) ;
%Shape: Circle [id:dp8199312033055097]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (367.5,101.5) .. controls (367.5,99.57) and (369.07,98) .. (371,98) .. controls (372.93,98) and (374.5,99.57) .. (374.5,101.5) .. controls (374.5,103.43) and (372.93,105) .. (371,105) .. controls (369.07,105) and (367.5,103.43) .. (367.5,101.5) -- cycle ;
%Shape: Circle [id:dp3093305498019576]
\draw [fill={rgb, 255:red, 0; green, 0; blue, 0 } ,fill opacity=1 ] (367,226.5) .. controls (367,224.57) and (368.57,223) .. (370.5,223) .. controls (372.43,223) and (374,224.57) .. (374,226.5) .. controls (374,228.43) and (372.43,230) .. (370.5,230) .. controls (368.57,230) and (367,228.43) .. (367,226.5) -- cycle ;
%Straight Lines [id:da5536180233670509]
\draw (370.5,141) -- (370.5,223) ;
%Straight Lines [id:da07562530960944613]
\draw (400.5,64) -- (379.29,92.59) ;
\draw [shift={(377.5,95)}, rotate = 306.57] [fill={rgb, 255:red, 0; green, 0; blue, 0 } ][line width=0.08] [draw opacity=0] (8.93,-4.29) -- (0,0) -- (8.93,4.29) -- cycle ;
%Shape: Brace [id:dp3181099319960101]
\draw (379.5,227) .. controls (384.17,226.97) and (386.48,224.62) .. (386.44,219.95) -- (386.01,164.85) .. controls (385.96,158.18) and (388.26,154.83) .. (392.93,154.79) .. controls (388.26,154.83) and (385.9,151.52) .. (385.85,144.85)(385.88,147.85) -- (385.57,107.94) .. controls (385.53,103.27) and (383.18,100.96) .. (378.51,101) ;
% Text Node
\draw (445,55) node {$(x,f,f(x,y))$};
% Text Node
\draw (141,229) node {$x$};
% Text Node
\draw (457,205) node {$y$};
% Text Node
\draw (184,24) node {$z$};
% Text Node
\draw (281,69) node {$S$};
% Text Node
\draw (206,194) node {$O$};
% Text Node
\draw (275,211) node {$D$};
% Text Node
\draw (362,244) node {$(x,y,0)$};
% Text Node
\draw (420,153) node {$f(x,y)$};
\end{tikzpicture}
\end{document}
Sebastiano
- 54,118

