Linear Approximation 2d

linear-approximation-2d

Edit and compile if you like:

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{math}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{0.125pt}
%
% File name: linear-approximation-2d.tex
% Description: 
% The linear approximation for a function of one variable $y = f(x)$ is shown.
% 
% Date of creation: March, 7th, 2021.
% Date of last modification: October, 9th, 2022.
% Author: Efran Soto Apolinar.
% https://www.aprendematematicas.org.mx/author/efrain-soto-apolinar/instructing-courses/
% Source: page 15 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{tikzpicture}
	\pgfmathsetmacro{\xi}{2.5}
	\pgfmathsetmacro{\step}{1.0}
	\pgfmathsetmacro{\xf}{\xi+\step}
	\pgfmathsetmacro{\yi}{exp(0.35*\xi)}
	\pgfmathsetmacro{\yf}{exp(0.35*\xf)}
	\pgfmathsetmacro{\yfa}{0.35*exp(0.35*\xi)*(\xf-\xi)+\yi}
	\pgfmathsetmacro{\ym}{0.5*(\yi+\yfa)}
	% Coordinate axis
	\draw[thick,->] (-0.125,0) -- (5,0) node [right]{$x$};
	\draw[thick,->] (0,-0.125) -- (0,4.5) node [above]{$y$};
	% Graph of the function $y = y(x)$
	\draw[red,thick,->] plot[domain=0:4.25] (\x,{exp(0.35*\x)}) node[right]{\footnotesize$y = y(x)$};
	% The linear approximation
	\draw[blue,very thick] (\xi,\yi) -- (\xf,\yfa) 
		-- (\xf,\yi) 
		-- (\xi,\yi); 	
	%
	\draw[dash dot] (\xi,0) node[black,below] {\footnotesize$x$} -- (\xi,\yi) 
			-- (0,\yi) node[left] {\footnotesize$f(x)$};
	\draw[dash dot] (\xf,0) node[black,below]{\footnotesize$x + \Delta x$} 
			-- (\xf,\yf) 
			-- (0,\yf) node[left] {\footnotesize$f(x + \Delta x)$};
	% Indication of points, measures and lengths
	\draw[dash dot dot,shift={(\xf,\yi)}] (0,0) -- (2,0);
	\draw[dash dot dot,shift={(\xf,\yfa)}] (0,0) -- (2,0);
	\draw[thick,<->,shift={(0,0)}] (\xi,\yi-0.5) -- (\xf,\yi-0.5) node [midway,fill=white] {\footnotesize$\Delta x$};
	\draw[thick,<->,shift={(0,0)}] (\xf+1.0,\yi) -- (\xf+1.0,\yfa) node [midway,fill=white] {\footnotesize$f'(x) \cdot \Delta x$};
	\draw[thick,<->,shift={(0.55*\xi,0)}] (0,\yi) -- (0,\yf) node [midway,fill=white] {\footnotesize$f(x + \Delta x) - f(x)$};
	\draw[thick,<->,shift={(0,0)}] (\xf+1.0,\yi) -- (\xf+1.0,0) node [midway,fill=white] {\footnotesize$f(x)$};
	\end{tikzpicture}
	%
	\end{document}

Click to download: linear-approximation-2d.texlinear-approximation-2d.pdf
Open in Overleaf:
linear-approximation-2d.tex
See more on the author page of Efraín Soto Apolinar.

Leave a Reply

Your email address will not be published.