設計漸近線的概念

設計漸近線的概念

我剛剛讀過關於如何製作漸近線,但是如果我想用\dfrac{x^2+0.5x+1.5}{x+3}他們的漸近線繪製,有人可以教我同樣的方法嗎?還教我這個概念。

答案1

  1. 取得漸近線的函數:openhttps://www.wolframalpha.com/,輸入 asymptotes (x^2 + 0.5 * x + 1.5)/(x + 3)並按 Enter 鍵。計算結果將告訴您兩個漸近線是y = x - 2.5y = -3
  2. 繪製 的影像(x^2 + 0.5 * x + 1.5)/(x + 3)以及它的兩條漸近線:
% based on the example given in https://tex.stackexchange.com/a/291629
\documentclass[tikz,border=5pt]{standalone}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    axis lines = center,
    xlabel = $x$,
    ylabel = $y$,
    xmax = 5,
    xmin = -15,
    ymax = 5,
    ymin = -15,
    domain=-15:5
  ]
    % Image of function y = (x^2 + 0.5 * x + 1.5)/(x + 3)
    \addplot[
      restrict y to domain = -15:10,
      samples = 100,
    ] {(x^2 + 0.5 * x + 1.5)/(x + 3)};
    
    % Oblique asymptote at y = x - 2.5
    \addplot[dashed] {x - 2.5};
    % Vertical asymptote at x = -3
    \addplot[dashed] (-3, x);
  \end{axis}
\end{tikzpicture}
\end{document}

在此輸入影像描述

一般來說,

  • 若要在 處繪製斜漸近線y = f(x),請使用\addplot[dashed] {f(x)}(x, f(x)),以及
  • x = c若要在(c是常數)處繪製垂直漸近線,請使用\addplot[dashed] (c, x)

答案2

在此輸入影像描述

\documentclass[tikz,border=5pt]{standalone}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document}
\begin{tikzpicture}[font=\footnotesize]
\begin{axis}[
axis lines = center,
xlabel=$x$,
ylabel=$y$,
axis line style = {-latex},
xlabel style={anchor=north},
ylabel style={anchor=east},
%xmin=-10,      xmax=7,
ymin=-25,     ymax=25,
ytick={-25,-20,...,25},
restrict y to domain = -30:30,
domain=-10:10, 
enlarge x limits={abs=1.5},
enlarge y limits={abs=3.5},
%clip=false, 
]
\addplot[samples=111,  black,]{(x^2 + 0.5*x + 1.5)/(x + 3)} 
       node[above, xshift=-12mm]{$f(x)=\dfrac{x^2+0.5x+1.5}{x+3}$};
\addplot[dashed] {0.5*x-1}
      node[below=1mm, pos=0.1]{$a(x)=x-2.5$};
\addplot[dashdotted, domain=-25:29] ({-3},{x})
      node[left, pos=0.9]{$x_p=-3$};;
\end{axis}
\end{tikzpicture}
\end{document}

相關內容