horizontal transformation of functions
Observe two functions, translated by some factor but otherwise identical:
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{arrows.meta}
%
\definecolor{firstfunctioncolor}{HTML}{8A5CF5}
\definecolor{secondfunctioncolor}{HTML}{E0DE71} % lighter
% \definecolor{secondfunctioncolor}{HTML}{E0AC00} % darker
%
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=10cm,
height=10cm,
axis lines = left,
enlargelimits=0.05,
xticklabels = {\empty},
yticklabels = {\empty},
legend pos = north west,
legend image post style = -,
legend cell align = left,
xtick = {-4,-3,-2,-1,...,6,7,8,9},
ytick = {-52,-27,0,27,52},
]
%
\addplot [
Latex-Latex,
domain=-5:5,
samples=101,
color=firstfunctioncolor,
very thick,
]
{x^3};
\addlegendentry{\(f(x)\)}
%
\addplot [
Latex-Latex,
domain=0:10,
samples=101,
color=secondfunctioncolor,
very thick,
]
{(x-5)^3)};
\addlegendentry{\(g(x)=f(x-h)\)}
%
\draw [dashed] (axis cs:10,27) -- (axis cs:0.5,27) node[left] {\(f(d-h)=g(d)\)};
\draw [dashed] (axis cs:-5,-27) -- (axis cs:3.5,-27) node[right] {\(f(c)=g(c+h)\)};
%
\begin{scope}[every node/.style={circle, fill, inner sep=1.5pt}]
\node[color=firstfunctioncolor, pin={[pin edge={firstfunctioncolor!50}]105:\small $d-h$}] at (axis cs:3,27) {};
\node[color=firstfunctioncolor, pin={[pin edge={firstfunctioncolor!50}]285:\small $c$}] at (axis cs:-3,-27) {};
\node[color=secondfunctioncolor, pin={[pin edge={secondfunctioncolor!50}]105:\small $d$}] at (axis cs:8,27) {};
\node[color=secondfunctioncolor, pin={[pin edge={secondfunctioncolor!50}]285:\small $c+h$}] at (axis cs:2,-27) {};
\end{scope}
%
% \node at (axis cs:5.5,14) {\(h\)};
% \node at (axis cs:-0.5,-14) {\(h\)};
%
\end{axis}
\end{tikzpicture}
\end{document}
But why, when shifting
First, let
This can be interpreted as:
| Whenever I input some value |
|
| Whenever I input some value |
|
| That 'less' is why we see a minus sign when we move a function to the right. It's because we are relating the 'new' function back to the original function. |
In fact, when we have a function
where