该图(少了一条线!)表示按部分求积分的步骤
\[I = \int{(x^3+3x^2+2x+1)\cdot \mathrm{e}^x \mathrm{d}x}.\]
我们有
\[I = (x^3+3x^2+2x+1)\cdot\mathrm{e}^x - (3x^2 + 6x + 2)\cdot\mathrm{e}^x
+ (6x+6)\cdot\mathrm{e}^x - 6\cdot\mathrm{e}^x.\]
我不知道如何开始。
另一个积分
\[\int{(x^2+3 x+1)\sin x\,\mathrm{d}x}\]
附有图表
我们有
\[-(x^2+3 x+1) \cosx+(2 x+3) \sin x +2 \cosx. \]
箭头如何平行且箭头上的 +、-、+、- 符号如何对齐?
答案1
总是有tikzmark
办法做这样的事情。但是,由于没有涉及方程式数字,因此可能会发生以下情况:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
% first column
\node (a) at (0,0) {$x^3 + 3x^2 + 2x^2 + 1$};
\node[below=5mm of a] (b) {$3x^2 + 6x^2 + 2$};
\node[below=5mm of b] (c) {$6x + 6$};
\node[below=5mm of c] (d) {$6$};
% second column
\node[right=1cm of a] (a1) {$e^x$};
\node[below=6mm of a1] (b1) {$e^x$};
\node[below=5mm of b1] (c1) {$e^x$};
\node[below=5mm of c1] (d1) {$e^x$};
% arrows
\draw[->,blue!70] (a.320) -- (b1.west) node[black,pos=.65, above] {$+$};
\draw[->,blue!70] (b.320) -- (c1.west) node[black,pos=.65, above] {$-$};
\draw[->,blue!70] (c.320) -- (d1.west) node[black,pos=.65, above] {$+$};
\end{tikzpicture}
\end{document}
答案2
强烈推荐使用 PSTricks 的解决方案。
\documentclass[preview,border=12pt]{standalone}
\usepackage{pst-node}
\usepackage{amsmath}
\begin{document}
\nointerlineskip
\psset{arrows=->,labelsep=1pt,nodesep=3pt,linecolor=blue}
$
\!
\begin{aligned}
\rnode[br]{11}{x^3+3x^2+2x+1} &\qquad & & e^x\\
\rnode[br]{21}{3x^2+6x+2} & & & \rnode[l]{22}{e^x} \\
\rnode[br]{31}{6x+6} & & & \rnode[l]{32}{e^x}\\
6 & & & \rnode[l]{42}{e^x}
\end{aligned}
\ncline{11}{22}\naput{+}
\ncline{21}{32}\naput{-}
\ncline{31}{42}\naput{+}
$
\end{document}
答案3
matrix
在 TikZ 中使用解决方案。
这个想法是让矩阵中的节点具有相同的大小,以便放置midway
above
绘制的箭头时符号对齐。
代码
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix(m)[matrix of math nodes,
every node/.append style={
anchor=base, % vertical alignment of node content
text height=\heightof{$f^2$}, % set height of each node
minimum width=\widthof{$x^2+3x+1$} % set width of each node
},
column sep=2cm,
row sep=1cm,
]{
x^2+3x+1 & \sin x \\
2x+3x & -\cos x \\
2 & -\sin x \\
0 & \cos x \\
};
\foreach[count=\i]\j/\symb in {2/+,3/-,4/+}
\draw[->](m-\i-1)--(m-\j-2)node[midway,above]{$\symb$};
\end{tikzpicture}
\end{document}
输出
答案4
另一种纯粹的解决方案tikz
:
\documentclass[margin=3pt]{standalone}
\usepackage{nicematrix,tikz}
\usetikzlibrary{arrows.meta,
matrix,
quotes}
\begin{document}
\begin{tikzpicture}[
every edge/.style = {draw, -Straight Barb, semithick, blue},
every edge quotes/.append style = {inner sep=1pt, anchor=south},
M/.style = {matrix of math nodes,
nodes = {inner sep=0pt, minimum height=2.2ex, anchor=east},
column sep=3em,
row sep=1ex}
]
\matrix (m) [M]
{
x^3+3x^2+2x+1 & e^x \\
3x^2+6x+2 & e^x \\
6x+6 & e^x \\
6 & e^x \\
};
\draw (m-1-1.south east) edge ["$+$"] (m-2-2)
(m-2-1.south east) edge ["$-$"] (m-3-2)
(m-3-1.south east) edge ["$+$"] (m-4-2);
\end{tikzpicture}
\end{document}