1

I'm trying to draw this picture with tangent lines and labels but when I use sqrt(x) function(I don't know the exact function) I get a diagram like picture: enter image description here

    \documentclass{standalone}
\usepackage{tikz}
\begin{document}
  \begin{tikzpicture}[domain=0:6] 

    \draw[->] (-0.2,0) -- (6.2,0) node[right] {$x$}; 
    \draw[->] (0,-1.2) -- (0,6.2) node[above] {$f(x)$};
    \draw[color=blue]   plot (\x,{1.5*sqrt(2*\x)})    node[right] {$f(x) = \sqrt x$};

  \end{tikzpicture}
\end{document}

How can I get a diagram like this picture with tangent lines and notations: enter image description here

Bernard
  • 271,350
H.H
  • 826
  • Offtopic: except from the first "straight line"... the others doesn't seem to be "tangential"... Ontopic: Also your code compiles fine for me (on sharelatex... Test it again there to see if your problem is local on your pc) – koleygr Apr 16 '18 at 07:48
  • That's right the picture is not perfect! – H.H Apr 16 '18 at 07:51
  • Found your error... (You possibly used : \sqrt instead of sqrt on your compiled code... but the one posted here has not that problem)... I get the same output if I change your function... – koleygr Apr 16 '18 at 07:53
  • How can I add the tangent lines? – H.H Apr 16 '18 at 08:12
  • 1
    Yuo can just edit your question and fix the error... Then the answer is easy (just a math derivative and some simple calculations)... But this moment any answer will be offtopic (Your question is about empty diagram right now) – koleygr Apr 16 '18 at 08:16
  • do you have gnuplot installed? Instead you can just use \draw[red] plot (\x,{sqrt(\x)}) node[right] {$f(x) =\sqrt x$}; – percusse Apr 16 '18 at 08:24
  • How can I add details like attached picture? – H.H Apr 16 '18 at 08:32
  • As koleygr already stated in his comment you could add a tangent to the graph if you know the function you plot as e.g. shown here. If you don't know the function you could add a tangent as e.g. shown here. – Stefan Pinnow Apr 16 '18 at 20:10

0 Answers0