# Second Derivative

I would like to make a function analysis and I'm trying to make a tabular which includes the first and second derivatives and the curve arrow which indicates the monotonicity of my function and I can't make the curve arrows which connects the monotonicity of the first derivative and the second. The best I can do is

\documentclass[11pt]{article}
\usepackage{color}
\usepackage{tikz}
\usepackage{MnSymbol}
\usepackage{tikz,tkz-tab,amsmath}
\usetikzlibrary{arrows}

\begin{document}

\newcommand{\E}{\mathrm{e}}
\begin{tikzpicture}
\tikzset{arrow style/.style = {blue,->,> = latex',
shorten > = 6pt,
shorten < = 6pt}}
\tkzTabInit[espcl=2]{$x$ /1, $f'(x)$ /1.5, $f''(x)$ /2,$f(x)$/2.5}{$-\infty$, $0$ ,$1$ , $2$ , $+\infty$}%
\tkzTabLine{ ,+,z,- ,d,-,z,+}%
\tkzTabLine{ ,-,t ,- ,d,+,t ,+}%
\tkzTabVar%
{ -/  ,  +/ ,-D+/  /  ,  -/  ,+/  /  }%
\end{tikzpicture}

\end{document}


Although I try to manage something like this

Anyone who can help me?

-
Hi! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – yo' Feb 25 '14 at 12:15
Please make a MWE. – Svend Tveskæg Feb 25 '14 at 12:18
Sorry my doc is in french. There is a chapter n0 11 in the doc page 57 You have some explanations about how to use some special coordinates and to draw your personal tools. I can help you but I need to see an example. Do you have a link to show what you want exactly or perhaps you can add a picture ? – Alain Matthes Feb 25 '14 at 15:04

This may help in putting curved arrows in place:

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{tikz,tkz-tab,amsmath}
\usetikzlibrary{arrows}

\begin{document}

\newcommand{\E}{\mathrm{e}}
\begin{tikzpicture}
\tikzset{arrow style/.style = {blue,->,> = latex',
shorten > = 6pt,
shorten < = 6pt}}
\tkzTabInit[espcl=2]{$x$ /1, $f'(x)$ /1.5, $f''(x)$ /2,$f(x)$/2.5}{$-\infty$, $0$ ,$1$ , $2$ , $+\infty$}%
\tkzTabLine{ ,+,z,- ,d,-,z,+}%
\tkzTabLine{ ,-,t ,- ,d,+,t ,+}%
% \tkzTabVar%
% {  -/  ,  +/ ,-D+/  /  ,  -/  ,+/  /  }%
\pgfnodebox{i1}[virtual]{\pgfxy(2.5,-5)}{$+\infty$}{0pt}{0pt}
\pgfnodebox{n1}[virtual]{\pgfxy(4.5,-5.5)}{$11$}{0pt}{0pt}
\pgfnodebox{n2}[virtual]{\pgfxy(6.5,-6)}{$-5$}{0pt}{0pt}
\pgfnodebox{n3}[virtual]{\pgfxy(8.5,-6.5)}{$-16$}{0pt}{0pt}
\pgfnodebox{i2}[virtual]{\pgfxy(10.5,-5)}{$+\infty$}{0pt}{0pt}
\pgfsetendarrow{\pgfarrowtriangle{4pt}}
\pgfnodeconncurve{i1}{n1}{-65}{-180}{.5cm}{.5cm}
\pgfnodeconncurve{n1}{n2}{0}{110}{.5cm}{.5cm}
\pgfnodeconncurve{n2}{n3}{-80}{-180}{.5cm}{.5cm}
\pgfnodeconncurve{n3}{i2}{0}{-90}{1.5cm}{1cm}
\end{tikzpicture}

\end{document}


I'm sure there is a more efficient way of producing the same kind of output:

-
Thank you for your time but the curved arrows have to go up or down like the image's.. – Giannis Feb 26 '14 at 8:08
It's fine but I think it's preferable in this case to use tikz's syntax and not pgf's syntax because it's not easy for new user of the package. Then you placed the values by hand and the tkz-tab gives coordinates to help the user. But It's a solution ! – Alain Matthes Feb 26 '14 at 8:34
@AlainMatthes I agree. I think your solution is much better. I don't understand French so I was lost with the tkz-tab package and couldn't figure out how to use its coordinates. (I still don't understand looking at your code how this is done, I'm afraid.) You are probably right about the syntax, too. I just find tikz even more difficult than pgf but no doubt this is because when I first did it, the former was not an option (or not one of which I was aware). I just really put this out there to provide an idea. I'm happy to see you've provided a more satisfactory solution! – cfr Feb 26 '14 at 16:02

I modify my answer to get what you want ...

My answer is not complete because I need more time ...

My package is useful for french mathematics teachers. We never make tables like you want. Below I made the "traditional" table ...

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{tkz-tab,tkz-fct}
\usetikzlibrary{arrows}

\begin{document}

\noindent\begin{tikzpicture}[xscale=1]
\tkzTabInit[espcl=1.5]{$x$/1,$f’(x)$/2,$f’'(x)$/2,$f(x)$/4}
{$-\infty$,$0$,$2$,$3$,$+\infty$}%
\tkzTabLine{,-,0,-, ,-,0,+, }%
\tkzTabLine{,+,0,-,0,+, ,+, }%
\tkzTabVar{+/ $+\infty$ ,R/ ,R/ ,-/-16,+/ $+\infty$ } % french method

\end{tikzpicture}
\begin{tikzpicture}
\tkzInit[xmin=-1,xmax=4,xstep=1,
ymin=-16,ymax=16,ystep=8]
\tkzAxeXY
\tkzFct[color=red,samples=100,domain = -1:4]{\x**4-4*\x**3+11}
\end{tikzpicture}
\end{document}


With the french method, it's usual to place some intermediate values like 11, -5 or -16

If you want to personalize the result you can use the help option. With this option you get

Now you have all the nodes defined in the picture. With this coordinates you can place what you want.

Now you can use N13 , N14 etc. to place the nodes and to draw some curve arrows. I can post a complete answer tomorrow but perhaps you can find the solution ...

Final

Now we know the nodes necessary for placing the curved arrows. We can place the values like this

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tkz-tab}
\usetikzlibrary{arrows}

\begin{document}

\begin{tikzpicture}
\tkzTabInit[espcl=1.5]{$x$/1,$f’(x)$/2,$f’'(x)$/2,$f(x)$/4} {$-\infty$,$0$,$2$,$3$,$+\infty$}%
\tkzTabLine{,-,0,-, ,-,0,+, }%
\tkzTabLine{,+,0,-,0,+, ,+, }%
\node [below] at (N13){\scriptsize$+\infty$};
\node [below=1cm] at (N23){\scriptsize$11$};
\node [below=2cm] at (N33){\scriptsize$-5$};
\node [above] at (N44){\scriptsize$-16$};
\node [below] at (N53){\scriptsize$+\infty$};
\end{tikzpicture}

\end{document}


Th next step is to draw arrows ... It's easy and there are several possibilities. We can give a name to the last nodes and ...

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{tkz-tab}
\usetikzlibrary{arrows}

\begin{document}

\begin{tikzpicture}

\tkzTabInit[espcl=2]{$x$/1,$f’(x)$/2,$f’'(x)$/2,$f(x)$/4} {$-\infty$,$0$,$2$,$3$,$+\infty$}
\tkzTabLine{,-,0,-, ,-,0,+, }
\tkzTabLine{,+,0,-,0,+, ,+, }

\node [below] (n1) at (N13){\scriptsize$+\infty$};
\node [below=1cm](n2) at (N23){\scriptsize$11$};
\node [below=2cm] (n3) at (N33){\scriptsize$-5$};
\node [above] (n4) at (N44){\scriptsize$-16$};
\node [below] (n5) at (N53){\scriptsize$+\infty$};

\draw[>->] (n1) to [out=-90,in=180] (n2);
\draw[>->] (n2) to [out=0,in=90] (n3);
\draw[>->] (n3) to  [out=-90,in=180] (n4);
\draw[>->] (n4) to [out=0,in=-90] (n5);

\end{tikzpicture}

\end{document}


Final remarks: I used kz-fct to draw the 2D plot but you can make this step independently. There iis no link finally with your question. You can draw this curve only with tikz or with the good tool PGFPlots. A lot of guys here can help you for this. tkz-fct needs to install gnuplot and sometimes it's not easy.

-
I would appreciate to see your complete answer because i don't know how it works the hole thing. I will use your example as a guide for other examples of mine. Thank you! – Giannis Feb 26 '14 at 8:06
@Giannis Now it's complete. The only problem is my solution is not automatic. It's possible but it's a big work – Alain Matthes Feb 26 '14 at 8:36
I make copy paste this part of code and it shows me error... – Giannis Feb 26 '14 at 8:58
Can you describe the error ? You try with the last code ? (it's preferable to avoid tkz-fct ) – Alain Matthes Feb 26 '14 at 9:42
Sorry I made a mix with my source and the code for adding the picture. I modify the answer – Alain Matthes Feb 26 '14 at 9:48

Here is a solution using PSTricks drawings inside a table. (Compile using latex --> dvips --> ps2pdf.)

\documentclass{article}

\usepackage[
tableposition = top,
labelformat = empty % Removes Table'' or Figure'' from caption.
]{caption}
\usepackage{pstricks}
\usepackage{booktabs}

% Increasing function.
\newcommand*\increase{
\raisebox{-1.2ex}{%
\begin{pspicture}(0.5,0.5)
\psline[linecolor = blue]{->}(0,0)(0.5,0.5)
\end{pspicture}%
}
}

% Decreasing function.
\newcommand*\decrease{
\raisebox{-1.2ex}{%
\begin{pspicture}(0.5,0.5)
\psline[linecolor = blue]{->}(0,0.5)(0.5,0)
\end{pspicture}%
}
}

\begin{document}

\begin{table}
\centering
\caption{Monotony of a function~$f$.}
\label{tbl:1}
\renewcommand\arraystretch{1.5}
\begin{tabular}{*{10}{c}}
\toprule
$x$      & $-\infty$ &           & $0$ &           & $1$ &           & $2$ &           & $+\infty$ \\
\midrule
$f'(x)$  &           & $+$       &     & $-$       &     & $-$       &     & $+$       &           \\
$f''(x)$ &           & $-$       &     & $-$       &     & $+$       &     & $+$       &           \\
$f(x)$   &           & \increase &     & \decrease &     & \decrease &     & \increase &           \\
\bottomrule
\end{tabular}
\end{table}

\end{document}


Note: I know it's not exactly what you asked for but I like this solution, so please consider it as my suggestion of how to do it.

-
Thank you very much for your time but as you said it is not what i ask for. I write a math book for students and i want to be specific at some symbols. Do you know how can i sent inbox at specific person here in this forum? – Giannis Feb 25 '14 at 13:06
You can use a users name, like @Giannis, in a comment to notify him. For more in depth conversations please use the chat. – canaaerus Feb 25 '14 at 22:34

As you seem to know tikz, there is a tikz dedicated package: tkz-tab. Documentation in french, which maybe a drawback, but if you take a look at this on-screen doc, with many examples, you will see it is quite complete, and the results are close to perfection.

-

If your are looking for curved arrows, check out the

\lcurvearrowne
\lcurvearrowse
\lcurvearrownw
\lcurvearrowsw


of the package MnSymbol

-
I tried these symbols but the result wasn't what i expected. The main problem is to combine the upper tikz package with the curve arrows. – Giannis Feb 25 '14 at 12:42

The following is what I could get with xypic so far, maybe I will improve it:

\documentclass{article}

\usepackage[all]{xypic}
\usepackage{amsmath}

\begin{document}
\newdir{ >}{{}*!/-7pt/\dir{>}}
\begin{equation*}\xymatrix@R=5mm{
+\infty \ar@{ >->}@(d,l)[dr] & & & & +\infty\\
& 11 \save[]+<0mm,-10pt>*\txt{$\Sigma$.K.}\restore \ar@{ >->}@(r,u)[dr]+L & & & \\
& & -5 \save[]+<0mm,-10pt>*\txt{$\Sigma$.K.}\restore \ar@{ >->}@(d,l)c+R;[dr]-R & & \\
& & & -16 \save[]+<0mm,-10pt>*\txt{T.E.}\restore \ar@{ >->}@(r,d)[uuur] &
}\end{equation*}

\end{document}


-