我正在做一道积分微积分练习。积分为$\int \dfrac{dx}{4-x^2}$
。这个积分可以通过 来解$x = 2\sin\,\alpha$
,其解为$\dfrac{1}{2}\ln\,|\sec\,\alpha + \tan\,\alpha|+C$
。我需要画一个矩形三角形以避免做所有繁琐的数学运算,试图根据找到$\sec\,\alpha$
和。图中是我想要画的。$\tan\,\alpha$
$x$
答案1
\documentclass[border=5mm]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}
\begin{tikzpicture}[scale=.8]
\tkzInit[xmax=5,ymax=3] %\tkzClip[space=.5]
\tkzDefPoint(0,0){A} \tkzDefPoint(4,0){B}
\tkzDrawTriangle[pythagore](A,B)
\tkzGetPoint{C}
\tkzMarkRightAngle(A,B,C)
\tkzDrawPoints(A,B,C)
\tkzLabelPoints[below](A,B)
\tkzLabelPoints[above](C)
\tkzLabelSegment[below,font=\footnotesize](A,B){$\sqrt{4 - x^2}$}
\tkzLabelSegment[above,font=\footnotesize](A,C){$2$}
\tkzLabelSegment[right,font=\footnotesize](B,C){$x$}
\tkzMarkAngle[fill= blue!40,size=1.4cm,opacity=.5](B,A,C)
\tkzLabelAngle[pos=0.8](B,A,C){$\alpha$}
\end{tikzpicture}
\end{document}
答案2
尝试MetaPost,在 LuaLaTeX 中。
给定一个实数x
(应该大于 0 且小于 2),它使用勾股减法(内置于 MetaPost)来计算与该角度相邻的另一边的长度。
\documentclass[border=2bp]{standalone}
\usepackage{luamplib}
\mplibtextextlabel{enable}
\mplibsetformat{metafun}
\begin{document}
\begin{mplibcode}
numeric u; u = 2.5cm;
beginfig(1);
x = 1; y = 2 +-+ x; % Pythagorean subtraction
pair A, B, C; A = origin; B = (u*y, 0); C = (0, u*x);
label.bot("$\sqrt{4-x^2}$", .5[A,B]);
label.lft("$x$", .5[A,C]);
label.urt("$2$", .5[B,C]);
draw ((1, 0) -- (1, 1) -- (0, 1)) scaled 2mm; % mark right angle
path angle_mark;
angle_mark = anglebetween(B--A, B--C, "\alpha"); % angle \alpha
fill B -- angle_mark -- cycle withcolor .8white;
draw A -- B -- C -- cycle;
draw angle_mark;
endfig;
\end{mplibcode}
\end{document}
输出x = 1
:
和x = 0.5
:
和x = 1.5
:
答案3
这里有一个钛钾是版本:
\documentclass[border=5mm,tikz]{standalone}
\usepackage{mwe}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=2]
\draw(0,0)--node[below]{$\sqrt{4-x^2}$} (1.7,0)
--node[above]{$2$}(0,1)
--node[left]{$x$}(0,0);
\draw[very thin,<->](1.4,0) arc [start angle=180,end angle=150, radius=0.3];
\node at (1.3,0.1){$\alpha$};
\end{tikzpicture}
\end{document}
答案4
如果您想考虑使用pstricks
,这是您的图形的短代码:
\documentclass[pdf]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{pst-node}
\begin{document}
\footnotesize
\psset{shortput=nab, arrows=c-c, linearc = 0.005}%
\begin{psmatrix}[colsep=3.8cm, rowsep=1.8cm]
[name = A]\\
[name = B] & [name = C]
\pspolygon(A)(B)(C)
\psset{linewidth=0pt}
\ncline{A}{C}^{$2$}
\ncline{A}{B}\nbput{$x$}
\ncline{B}{C}_{$\sqrt{4-x^2}$}
\end{psmatrix}
\end{document}