Tengo el siguiente código de un segmento de 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}
Lo que me resulta en:
Y quiero un resultado como este
¿Cómo puedo hacer eso?
Respuesta1
Puedes usar <->
o poner una decoración de marcado. Pero el problema es que estás recortando las curvas. Por lo tanto, resulta difícil encontrar los puntos finales. Por lo tanto, debe ajustar el dominio con cuidado para que los puntos finales de las curvas queden dentro del área recortada. Aquí hay una muestra:
\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}
Aquí hay una muestra con pgfplots
. Sólo he trazado las curvas dejando otras cosas como ejercicio.
\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={->}
]
\addplot+[<->,mark=none,line width=1pt,samples=100,domain=-0.6:1.65] {3*(x^3)-5*(x^2)+x+1};
\addplot+[<->,mark=none,line width=1pt,samples=100,domain=-0.145:1.25] {9*(x^2)-10*(x)+1};
\end{axis}
\end{tikzpicture}
\end{document}