# add a little arrow at the end of a function

I have the following code of a segment of tikz:

\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=3cm,y=2cm]
\draw[->,color=black] (-0.9,0.) -- (1.9,0.);
\foreach \x in {}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[->,color=black] (0.,-2.4) -- (0.,2.4);
\foreach \y in {}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {};
\clip(-0.9,-2.4) rectangle (1.9,2.4);
\draw[<->,line width=1.2pt,color=qqqqff,smooth,samples=100,domain=-0.9:1.9] plot(\x,{3.0*(\x)^(3.0)-5.0*(\x)^(2.0)+(\x)+1.0});
\draw[line width=1.2pt,color=ffqqqq,smooth,samples=100,domain=-0.9:1.9] plot(\x,{9.0*(\x)^(2.0)-10.0*(\x)+1.0});
\draw [dash pattern=on 1pt off 1pt] (0.11111111164602015,-4.279272269869239E-9)-- (0.11111111164602015,1.0534979423868314);
\draw (-0.32,0.05) node[anchor=north west] {$\frac{1}{3}$};
\draw (0.06,0.07) node[anchor=north west] {$\frac{1}{9}$};
\draw (0.52,0.03) node[anchor=north west] {$\frac{5}{9}$};
\draw [dash pattern=on 1pt off 1pt] (0.54,0.54)-- (0.54,0.);
\draw (0.24,0.70) node[anchor=north west] {\tiny{Punto de inflexión}};
\draw (0.11,1.25) node[anchor=north west] {\tiny{máximo}};
\draw (0.8,1.37) node[anchor=north west] {$C'(x)$};
\draw (1.15,1.21) node[anchor=north west] {$C(x)$};
\draw (0.98,-0.20) node[anchor=north west] {\tiny{mínimo}};
\end{tikzpicture}


Wich result me in :

And I want a result like this

How can I do that?

You can use <-> or put a marking decoration. But the problem is you are clipping the curves. Hence it becomes difficult to find the end points. So you have to adjust the domain carefully so that the end points of the curves lie within the clipped area. Here is a sample:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,arrows.meta,decorations.markings}
\tikzset{myarrow/.style={draw,decoration={markings, mark=at position 0 with {\arrow{<}},mark=at position 1 with {\arrow{>}}},postaction={decorate}}
}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=3cm,y=2cm]
\draw[->,color=black,] (-0.9,0.) -- (1.9,0.);
\foreach \x in {}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[->,color=black] (0.,-2.4) -- (0.,2.4);
\foreach \y in {}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {};
\clip(-0.95,-2.5) rectangle (1.95,2.5);
\draw[<->,line width=1.2pt,color=orange,samples=100,domain=-0.6:1.65] plot(\x,{3.0*(\x)^(3.0)-5.0*(\x)^(2.0)+(\x)+1.0});
\draw[myarrow,line width=1.2pt,color=brown,samples=100,domain=-0.11:1.235] plot(\x,{9.0*(\x)^(2.0)-10.0*(\x)+1.0});
\draw [dash pattern=on 1pt off 1pt] (0.11111111164602015,-4.279272269869239E-9)-- (0.11111111164602015,1.0534979423868314);
\draw (-0.32,0.05) node[anchor=north west] {$\frac{1}{3}$};
\draw (0.06,0.07) node[anchor=north west] {$\frac{1}{9}$};
\draw (0.52,0.03) node[anchor=north west] {$\frac{5}{9}$};
\draw [dash pattern=on 1pt off 1pt] (0.54,0.54)-- (0.54,0.);
\draw (0.24,0.70) node[anchor=north west] {\tiny{Punto de inflexión}};
\draw (0.11,1.25) node[anchor=north west] {\tiny{máximo}};
\draw (0.8,1.37) node[anchor=north west] {$C'(x)$};
\draw (1.15,1.21) node[anchor=north west] {$C(x)$};
\draw (0.98,-0.20) node[anchor=north west] {\tiny{mínimo}};
\end{tikzpicture}
\end{document}


Here is a sample with pgfplots. I have just plotted the curves leaving other things as an exercise.

\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[>=triangle 45,]
\begin{axis}[width=\linewidth,
axis lines=center,
xmin=-1,xmax=3,
ymin=-3,ymax=3,
axis line style={->}
]

• @LuisFelipeVillavicencioLpez You are welcome. Happy tikzing. :-) – user11232 Apr 26 '15 at 12:47