绘制递增/递减函数段图

绘制递增/递减函数段图

我想用线段模式绘制一个增加/减少的数学函数。我放了一张关于它的图片: 在此处输入图片描述

我更喜欢 TikZ 的情节。谢谢。

答案1

像这样?

在此处输入图片描述

您的问题属于“为我做/代替我做”的类型,但 TeX.SE 不是提供此类服务的网站... 由于暂时有一些空闲时间,为了锻炼和娱乐,我写了以下 MWE:

\documentclass[tikz,margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,shapes, shapes.arrows}

\begin{document}
    \begin{tikzpicture}[
every node/.style = {minimum size=1em,inner sep=2pt},
     Arrow/.style = {single arrow, draw, minimum height=3ex, 
                     single arrow head extend=1ex,
                     shape border rotate=#1}
                        ]
\draw[line width=1mm,{Bar[width=4mm,round]}-{Bar[width=4mm,round]}]
    (0,0) node [above=2mm] {$f'(x)$} 
          node [below=2mm] {$-\infty$}  -- ++ 
    (8,0) node [above=2mm] {}
          node [below=2mm] {$+\infty$} ;
\draw[line width=1mm,line cap=round]
    (3,-0.2) node[below] {$0$} -- ++ (0,0.4) 
    (5,-0.2) node[below] {$2$} -- ++ (0,0.4);
% signs    
\node[above] at (1.5,0.2) {$+$};
\node[above] at (4.0,0.2) {$-$};
\node[above] at (6.5,0.2) {$+$};
% arrows
\node[Arrow= 90, below] at (1.5,-0.2) {};
\node[Arrow=270, below] at (4.0,-0.2) {};
\node[Arrow= 90, below] at (6.5,-0.2) {};
    \end{tikzpicture}
\end{document}

答案2

\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(0.35,0.87) rectangle (5.51,2.79);
\draw (1.,2.)-- (5.,2.);
\draw (0.2,2.70) node[anchor=north west] {$f'(x)$};
\draw (0.70,2) node[anchor=north west] {$-\infty$};
\draw (0.2,1.53) node[anchor=north west] {$f(x)$};
\draw (1.48,2.60) node[anchor=north west] {$+$};
\draw (4.8,2.6) node[anchor=north west] {$+$};
\draw (4.6,1.9) node[anchor=north west] {$+\infty$};
\draw (2.1,1.9) node[anchor=north west] {$0$};
\draw (4,2) node[anchor=north west] {$2$};
\draw (3,2.6) node[anchor=north west] {$-$};
\draw [->,>=stealth] (1.6,1.2) -- (1.6,1.8);
\draw [->,>=stealth] (4.5,1.2) -- (4.5,1.8);
\draw [->,>=stealth] (3.1,1.8) -- (3.1,1.2);
\begin{scriptsize}
\draw [fill=black] (5.,2.0) circle (2.5pt);
\draw [fill=black] (1.,2.0) circle (2.5pt);
\draw [fill=black] (2.2,2) circle (2.5pt);
\draw [fill=black] (4.,2.0) circle (2.5pt);
\end{scriptsize}
\end{tikzpicture}
\end{document}

答案3

好的,我也需要用 mathjax 制作同样的图形。所以我不能使用 Tikz。我制作了以下代码

\begin{tabular}{c c c c c c c c}
    $f^\prime (x)$ &  & - &  & + &  & - &  \\ 
    \hline 
    $f(x)$ & $-\infty$ & $\uparrow$ & 0 & $\downarrow$ & 2 & $\uparrow$ & $+\infty$ \\ 
\end{tabular}

很抱歉造成您的不便。

相关内容