切線法線和 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庫(也可以讓 TikZ 計算 (A,FA)) 在其自己的):

\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}

兩者都會產生相同的輸出:

在此輸入影像描述

相關內容