Edit and compile if you like:
\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{math}
\usepackage{ifthen}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{1pt}
%
% File name: differential-of-volume-rectangular-coordinates.tex
% Description:
% A geometric representation of the differential of
% volume in rectangular coordinates is shown.
%
% Date of creation: September, 25th, 2021.
% Date of last modification: October, 9th, 2022.
% Author: Efraín Soto Apolinar.
% https://www.aprendematematicas.org.mx/author/efrain-soto-apolinar/instructing-courses/
% Source: page 121 of the
% Glosario Ilustrado de Matem\'aticas Escolares.
% https://tinyurl.com/5udm2ufy
%
% Terms of use:
% According to TikZ.net
% https://creativecommons.org/licenses/by-nc-sa/4.0/
% Your commitment to the terms of use is greatly appreciated.
%
\begin{document}
%
\begin{center}
\tdplotsetmaincoords{70}{120}
%
\begin{tikzpicture}[tdplot_main_coords,scale=1.5]
\tikzmath{function funcion(\x,\y) {return 2.5+0.25*sin((0.5*\x + \y) r);};}
\pgfmathsetmacro{\step}{pi/50.0}
\pgfmathsetmacro{\xi}{0}
\pgfmathsetmacro{\xf}{1.0*pi}
\pgfmathsetmacro{\xe}{\xf+\step}
\pgfmathsetmacro{\xs}{\xi+\step}
\pgfmathsetmacro{\yi}{0}
\pgfmathsetmacro{\yf}{1.0*pi}
\pgfmathsetmacro{\ys}{\yi+\step}
\pgfmathsetmacro{\ye}{\yf+\step}
\pgfmathsetmacro{\h}{2.5}
% Límites de mi región en el plano xy
\pgfmathsetmacro{\a}{0.75}
\pgfmathsetmacro{\b}{\a+1.5}
\pgfmathsetmacro{\c}{1.0}
\pgfmathsetmacro{\d}{\c+1.5}
% Punto donde dibujo el diferencial de área
\pgfmathsetmacro{\px}{(0.45*\a+0.55*\b)}
\pgfmathsetmacro{\py}{0.5*(\c+\d)}
\pgfmathsetmacro{\dx}{0.1}
\pgfmathsetmacro{\dy}{0.1}
% Punto A (\a,\c,0)
\pgfmathsetmacro{\zA}{funcion(\a,\c)}
\pgfmathsetmacro{\zB}{funcion(\b,\c)}
\pgfmathsetmacro{\zC}{funcion(\b,\d)}
\pgfmathsetmacro{\zD}{funcion(\a,\d)}
\pgfmathsetmacro{\zdA}{funcion(\px,\py)}
\pgfmathsetmacro{\zdB}{funcion(\px+\dx,\py)}
\pgfmathsetmacro{\zdC}{funcion(\px+\dx,\py+\dy)}
\pgfmathsetmacro{\zdD}{funcion(\px,\py+\dy)}
% Coordinate axis
\draw[thick,->] (0,0,0) -- (\xf+0.25,0,0) node [below] {$x$}; % Eje x
\draw[thick,->] (0,0,0) -- (0,\yf+0.25,0) node [right] {$y$}; % Eje y
\draw[thick,->] (0,0,0) -- (0,0,\h+0.5,0) node [above] {$z = f(x,y)$};
% The region in the xy-plane
\draw[white] (\a,\d,0) -- (\b,\d,0) node [black,below,sloped,midway] {$R$};
\draw[dash dot dot] (\a,0,0) node[above left] {$a$} -- (\a,\c,0);
\draw[dash dot dot] (\b,0,0) node[above left] {$b$} -- (\b,\c,0);
\draw[dash dot dot] (0,\c,0) node[above right] {$c$}-- (\a,\c,0);
\draw[dash dot dot] (0,\d,0) node[above right] {$d$}-- (\a,\d,0);
\fill[gray!25] (\a,\c,0) -- (\b,\c,0) -- (\b,\d,0) -- (\a,\d,0) -- (\a,\c,0);
\draw[dash dot dot] (\a,\c,0) -- (\b,\c,0) -- (\b,\d,0) -- (\a,\d,0) -- (\a,\c,0);
% The solid (boundary)
\draw[dash dot dot] (\a,\c,0) -- (\a,\c,\zA);
\draw[dash dot dot] (\b,\c,0) -- (\b,\c,\zB);
\draw[dash dot dot] (\a,\d,0) -- (\a,\d,\zD);
\draw[dash dot dot] (\b,\d,0) -- (\b,\d,\zC);
% Differential of area $dA$
\draw[fill=cyan] (\px,\py,0) -- (\px,\py+\dy,0) -- (\px+\dx,\py+\dy,0) -- (\px+\dx,\py) -- (\px,\py,0);
% Delimiting the differential of volume
\draw[thin] (\px,\py,0) -- (\px,\py,\zdA);
% Face parallel to the yz plane
\fill[cyan,opacity=0.75,draw=white]
(\px+\dx,\py,0) -- (\px+\dx,\py,\zdB) -- (\px+\dx,\py+\dy,\zdC)
-- (\px+\dx,\py+\dy,0) -- (\px+\dx,\py,0);
% Face parallel to the xz plane
\fill[cyan,opacity=0.75,draw=white]
(\px,\py+\dy,0) -- (\px,\py+\dy,\zdD) -- (\px+\dx,\py+\dy,\zdC)
-- (\px+\dx,\py+\dy,0) -- (\px+\dx,\py+\dy,0);
\draw[thin] (\px+\dx,\py,0) -- (\px+\dx,\py,\zdB) node[left,midway] {$dV$};
\draw[thin] (\px,\py+\dy,0) -- (\px,\py+\dy,\zdD);
\draw[thin] (\px+\dx,\py+\dy,0) -- (\px+\dx,\py+\dy,\zdC);
\draw[thin] (\px+\dx,\py,0) -- (\px+\dx,\py+\dy,0);
\draw[thin] (\px,\py+\dy,0) -- (\px+\dx,\py+\dy,0);
\draw[fill=cyan,opacity=0.75,draw=black] (\px,\py,\zdA) -- (\px+\dx,\py,\zdB)
-- (\px+\dx,\py+\dy,\zdC) -- (\px,\py+\dy,\zdD) -- (\px,\py,\zdA);
% Coordinate axis
\draw[thick] (\xi-0.25,0,0) -- (0,0,0); % Eje x
\draw[thick] (0,\yi-0.25,0,0) -- (0,0,0); % Eje y
% Graph of $z = f(x,y)$ (first quadrant)
\foreach \x in {0,\step,...,\xf}{
\draw[cyan,opacity=0.5] plot[domain=0:\yf,smooth,variable=\t] ({\x},{\t},{funcion(\x,\t)});
}
\foreach \y in {0,\step,...,\yf}{
\draw[cyan,opacity=0.5] plot[domain=0:\yf,smooth,variable=\t] ({\t},{\y},{funcion(\t,\y)});
}
% Curves upon the graph of $z = f(x,y)$ that delimit the region of integration
\foreach \x in {\a,\b}
\draw[blue,thick,opacity=0.85] plot[domain=\c:\d,smooth,variable=\t] ({\x},{\t},{funcion(\x,\t)});
\foreach \y in {\c,\d}
\draw[blue,thick,opacity=0.85] plot[domain=\a:\b,smooth,variable=\t] ({\t},{\y},{funcion(\t,\y)});
\end{tikzpicture}
\end{center}
%
\end{document}Click to download: differential-of-volume-rectangular-coordinates.tex • differential-of-volume-rectangular-coordinates.pdf
Open in Overleaf: differential-of-volume-rectangular-coordinates.tex
See more on the author page of Efraín Soto Apolinar.
