2

This diagram (lost a line!) represents the steps to evaluate integral by parts of

\[I = \int{(x^3+3x^2+2x+1)\cdot \mathrm{e}^x \mathrm{d}x}.\]

We have

\[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.\]

I don't know how to start.

enter image description here

Another integral

\[\int{(x^2+3 x+1)\sin x\,\mathrm{d}x}\]

with diagram enter image description here

We have

\[-(x^2+3 x+1) \cosx+(2 x+3) \sin  x +2 \cosx. \]

How do the arrows parallel and the signs +, -, +, - (on the arrows) aligned?

minthao_2011
  • 4,534
  • 7
  • 36
  • 61
  • 3
    On this site, a question should typically revolve around an abstract issue (e.g. "How do I get a double horizontal line in a table?") rather than a concrete application (e.g. "How do I make this table?"). Questions that look like "Please do this complicated thing for me" tend to get closed. Please try to make your question clear and simple by giving a minimal working example (MWE): you'll stand a greater chance of getting help. – jub0bs Nov 22 '13 at 07:29
  • 1
  • 1
    I can't give any mathematical meaning to that diagram – egreg Nov 22 '13 at 15:39
  • @egreg Please see my edit. – minthao_2011 Nov 22 '13 at 15:58
  • I still can't give any sensible meaning. – egreg Nov 22 '13 at 16:01
  • @egreg, this is the mathematical meaning: The first column of each diagram consists of successive derivatives of one factor of the integrand, the second column consists of successive antiderivatives of the other factor. The indefinite integral of the product is obtained as the sum of the products indicated by the arrows, each product being prefixed by the indicated sign. This is a pretty standard way to organize an integration that requires multiple integrations by parts. – Dan Nov 22 '13 at 19:33
  • I feel that, instead of updating a 8 years old question that has an accepted answer that is 6 years old, you will be much better off asking a new question. –  Jun 02 '19 at 03:04

5 Answers5

7

A strongly recommended solution with 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}

enter image description here

Moriambar
  • 11,466
6

There is always tikzmark way of doing things like this. However, since there are no equation numbers involved, this can happen:

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

enter image description here

3

Solution using matrix in TikZ.

The idea is to make the nodes in the matrix to have the same size, so that the symbols are aligned when placed midway above the drawn arrows.

Code

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

Output

enter image description here

Herr K.
  • 17,946
  • 4
  • 61
  • 118
2

Here is a solution with {NiceArray} of nicematrix and TikZ to draw the arrows.

\documentclass[preview,border=12pt]{standalone}
\usepackage{nicematrix,tikz}
\begin{document}
$
\begin{NiceArray}{r@{\qquad}l}
   x^3+3x^2+2x+1 & e^x\\
   3x^2+6x+2 & e^x \\
   6x+6 & e^x\\
   6 & e^x
\CodeAfter
   \begin{tikzpicture} [blue, thick, ->]
     \draw (1-1.south east) -- node [inner sep = 1pt, above] {$+$} (2-2) ;
     \draw (2-1.south east) -- node [inner sep = 1pt, above] {$+$} (3-2) ;
     \draw (3-1.south east) -- node [inner sep = 1pt, above] {$+$} (4-2) ;
   \end{tikzpicture}
\end{NiceArray}
$
\end{document}

Output of the above code

F. Pantigny
  • 40,250
1

Another solution with pure 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}

enter image description here

Zarko
  • 296,517