# Vector Function

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: vector-function.tex
% Description:
% A geometric representation of a vector function is shown.
%
% 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 211 of the
% Glosario Ilustrado de Matem\'aticas Escolares.
% https://tinyurl.com/5udm2ufy
%
% According to TikZ.net
%
\begin{document}
%
\begin{center}
\tdplotsetmaincoords{70}{120}
%
\begin{tikzpicture}[tdplot_main_coords,scale=1.0]
% Component functions of the vector function
\tikzmath{function equis(\t) {return cos((\t) r);};}
\tikzmath{function ye(\t) {return sin((\t) r);};}
\tikzmath{function zeta(\t) {return 0.5+0.25*sqrt(\t)*sin(0.4*\t r);};}
% Evaluated at $t = \tcero$
\pgfmathsetmacro{\tcero}{1.0*pi}
\pgfmathsetmacro{\ti}{0.25}
\pgfmathsetmacro{\tf}{2.0*pi}
\pgfmathsetmacro{\n}{100}
\pgfmathsetmacro{\r}{2.0}
%
\pgfmathsetmacro{\xi}{\r*equis(\ti)}
\pgfmathsetmacro{\xf}{\r*equis(\tf)}
\pgfmathsetmacro{\xtcero}{\r*equis(\tcero)}
\pgfmathsetmacro{\yi}{\r*ye(\ti)}
\pgfmathsetmacro{\yf}{\r*ye(\tf)}
\pgfmathsetmacro{\ytcero}{\r*ye(\tcero)}
\pgfmathsetmacro{\zi}{\r*zeta(\ti)}
\pgfmathsetmacro{\zf}{\r*zeta(\tf)}
\pgfmathsetmacro{\ztcero}{\r*zeta(\tcero)}
% Coordinate axis (negative part)
\draw[thick,->] (-1.25,0,0) -- (\r+0.5,0,0) node[below left] {$x$}; % Eje x
\foreach \x in {-1,1}
\draw[thick] (\x,0,0.05) -- (\x,0,-0.05) node [below] {$\x$};
\draw[thick,->] (0,-1.25,0) -- (0,\r,0) node[right] {$y$}; % Eje y
\foreach \y in {-1,1}
\draw[thick] (0,\y,0.05) -- (0,\y,-0.05) node [below] {$\y$};
\draw[thick] (0,0,-0.25) -- (0,0,1.0); % Eje z (Primera parte)
%
\draw[blue,thick,->] (0,0,0) -- (\xtcero,\ytcero,\ztcero) node[midway,sloped,below] {$\vec{r}(t)$};
% Hraph of the vector function $\vec{r}(t)$
\draw[red,thick,->] plot[domain=\ti:\tf,smooth,variable=\t,samples=\n] ({\r*equis(\t)},{\r*ye(\t)},{\r*zeta(\t)});
\node[red,above] at (\xf,\yf,\zf) {$\vec{r(t)}$};
% The $z$ axis
\draw[thick,->] (0,0,1.0) -- (0,0,\r+1.0) node[above] {$z$}; % Eje z
\foreach \z/\posicion in {1/left}
\draw[thick] (0,0.05,\z) -- (0,-0.05,\z) node [\posicion] {$\z$};
\end{tikzpicture}
\end{center}
%
\end{document}