切线法线和 x 轴之间的阴影区域

切线法线和 x 轴之间的阴影区域

我想知道我是否可以得到一些帮助来填充切线法线和 x 轴之间的区域(即三角形)。我已经阅读了相当多的材料和线程,但无法找到如何用我目前设置图表的方式来做到这一点。

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{center}
\begin{tikzpicture}
    \draw (3,{0.06*exp(3)+1}) circle[radius=2pt] node[right] {$(a,f(a))$};
    \fill (3,{0.06*exp(3)+1}) circle[radius=2pt];
    \draw [<->] (-1,0) -- (7,0) node[right]{$x$};
    \draw [<->] (0,-1) -- (0,5)node[above]{$y$};
    \draw[domain=-1:4] [<->] plot (\x,{0.06*exp(\x)+1}) node[right] {$y = f(x)$};
    \draw[domain=0.5:4] [<->] plot (\x, {0.06*exp(3)*(\x-3)+0.06*exp(3)+1}) node[right] {$\ell_T$};

    \draw[domain=2:6.5] [<->] plot (\x, {-1/(0.06*exp(3))*(\x-3)+0.06*exp(3)+1}) node[right] {$\ell_N$};;
\end{tikzpicture}
\end{center} 

\end{document}

目前的情况就是这样。

在此处输入图片描述

答案1

您可以使用该intersections库(也可以让 TiZ 计算(的位置AFA)) 在其自己的):

\documentclass[tikz, border=10pt]{standalone}
\usetikzlibrary{intersections, backgrounds}
 
\begin{document}
\begin{tikzpicture}

    \draw[<->, name path=x-axis] (-1,0) -- (7,0) 
        node[right]{$x$};
    \draw[<->] (0,-1) -- (0,5) 
        node[above]{$y$};
    \draw[domain=-1:4, <->] 
        plot (\x,{0.06*exp(\x)+1}) 
        node[right] {$y = f(x)$};
    \draw[domain=0.5:4, <->, name path=tangent] 
        plot (\x, {0.06*exp(3)*(\x-3)+0.06*exp(3)+1}) 
        node[right] {$\ell_T$};
    \draw[domain=2:6.5, <->, name path=normal] 
        plot (\x, {-1/(0.06*exp(3))*(\x-3)+0.06*exp(3)+1}) 
        node[right] {$\ell_N$};

    \path[name intersections={of=normal and tangent}]
        (intersection-1) coordinate (a);
    \path[name intersections={of=normal and x-axis}]
        (intersection-1) coordinate (b);
    \path[name intersections={of=tangent and x-axis}]
        (intersection-1) coordinate (c);
        
    \filldraw (a) circle[radius=2pt] 
        node[right] {$(a,f(a))$};

    \begin{scope}[on background layer]
        \fill[red!10] (a) -- (b) -- (c) -- cycle;
    \end{scope}
    
\end{tikzpicture}
\end{document}

您还可以利用fillbetween图书馆这是软件包自带的pgfplots(这里可能有点过度,但在更复杂的设置中很有用,例如,一个边界是一个图):

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usetikzlibrary{fillbetween, backgrounds}
 
\begin{document}
\begin{tikzpicture}

    \draw (3,{0.06*exp(3)+1}) circle[radius=2pt] 
        node[right] {$(a,f(a))$};
    \fill (3,{0.06*exp(3)+1}) circle[radius=2pt];
    \draw[<->, name path=x-axis] (-1,0) -- (7,0) 
        node[right]{$x$};
    \draw[<->] (0,-1) -- (0,5) 
        node[above]{$y$};
    \draw[domain=-1:4, <->] 
        plot (\x,{0.06*exp(\x)+1}) 
        node[right] {$y = f(x)$};
    \draw[domain=0.5:4, <->, name path=tangent] 
        plot (\x, {0.06*exp(3)*(\x-3)+0.06*exp(3)+1}) 
        node[right] {$\ell_T$};
    \draw[domain=2:6.5, <->, name path=normal] 
        plot (\x, {-1/(0.06*exp(3))*(\x-3)+0.06*exp(3)+1}) 
        node[right] {$\ell_N$};

    \path[
        name path=temp,
        intersection segments={
            of=normal and tangent,
            sequence={L2 -- R1}
        }
    ] -- cycle;

    \begin{scope}[on background layer]
        \fill[
            red!10,
            intersection segments={
                of=temp and x-axis,
                sequence={L1 -- R2}
            }
        ] -- cycle;
    \end{scope}
    
\end{tikzpicture}
\end{document}

两者都产生相同的输出:

在此处输入图片描述

相关内容