#### Example $\int x^2.e^{3x}.dx$
(from http://www.mathcentre.ac.uk/resources/uploaded/mc-ty-parts-2009-1.pdf)

$\ds \begin{equation} \label{eq3}
\begin{split}
\text{using formula} \\
\int u.\frac{d(v)}{dx} & = u.v - \int v.\frac{d(u)}{dx} dx \\
\text{we assign} \\
u & = x^2 \\
\frac{dv}{dx} & = e^{3x} \\
\text{we calculate} \\
v & = \int \frac{dv}{dx} dx = \int e^{3x} dx = \frac{1}{3}e^{3x} \\
\frac{du}{dx} & = \frac{d(x^2)}{dx} = 2x \\
\text{then apply to formula} \\
\int x^2e^{3x} & = x^2\frac{e^{3x}}{3} - \int \frac{e^{3x}}{3}2x dx \\
& = \frac{1}{3}x^2e^{3x} - \int \frac{2}{3}xe^{3x} dx \\
\\
\text{using formula again} \\
\int u.\frac{d(v)}{dx} & = u.v - \int v.\frac{d(u)}{dx} dx \\
\text{we assign} \\
u & = \frac{2}{3}x \\
\frac{dv}{dx} & = e^{3x} \\
\text{we calculate} \\
v & = \int \frac{dv}{dx} dx = \int e^{3x} dx = \frac{1}{3}e^{3x} \\
\frac{du}{dx} & = \frac{d(\frac{2}{3}x)}{dx} = \frac{2}{3} \\
\text{then apply to formula} \\
\int \frac{2}{3}xe^{3x} dx & = \frac{2}{3}x\frac{1}{3}e^{3x} - \int \Big( \frac{1}{3}e^{3x} . \frac{2}{3} \Big)   dx \\
& = \frac{2}{9}x.e^{3x} - \int \frac{2}{9}e^{3x} dx \\
& = \frac{2}{9}x.e^{3x} - \frac{2}{27}e^{3x} \\
\\
\text{replace with earlier calc} \\
& = \frac{1}{3}x^2e^{3x} - \frac{2}{9}x.e^{3x} - \frac{2}{27}e^{3x} + C \\
& = \Big( \frac{1}{3}x^2 - \frac{2}{9}x - \frac{2}{27} \Big)e^{3x} + C \\
& = \frac{9x^2 - 6x - 2}{27}e^{3x} + C \\
\text{completing the square} \\
& = \frac{(3x-1)^2 - 3}{27}e^{3x} + C \\
\\
\end{split}
\end{equation}$

----

### Integration by Parts
#### Example $\int x.cos(x).dx$
(from http://www.mathcentre.ac.uk/resources/uploaded/mc-ty-parts-2009-1.pdf)
$\newcommand{\dv}{\displaystyle \frac{d}{dx}}$
$\newcommand{\ds}{\displaystyle}$
$\ds \begin{equation} \label{eq2}
\begin{split}
\text{using formula} \\
\int u.\frac{d(v)}{dx} & = u.v - \int v.\frac{d(u)}{dx} dx \\
\text{we assign} \\
u & = x \\
\frac{dv}{dx} & = cos(x) \\
\text{we calculate} \\
v & = \int \frac{dv}{dx} dx = \int cos(x) dx = sin(x) \\
\frac{du}{dx} & = \frac{d(x)}{dx} = 1 \\
\text{then apply to formula} \\
\int x.cos(x).dx & = x.sin(x) - \int sin(x).1.dx \\
 & = x.sin(x) - cos(x) + C \\
\end{split}
\end{equation}$

----



```python

```

e1fa0d19f9aed408731eb51eedd95104d1439be9
ipynb
Jupyter Notebook
notebooks/math/calculus/calculus2.ipynb
sparkboom/my_jupyter_notes
9255e4236b27f0419cdd2c8a2159738d8fc383be
MIT
notebooks/math/calculus/calculus2.ipynb
sparkboom/my_jupyter_notes
9255e4236b27f0419cdd2c8a2159738d8fc383be
MIT
notebooks/math/calculus/calculus2.ipynb
sparkboom/my_jupyter_notes
9255e4236b27f0419cdd2c8a2159738d8fc383be
MIT
Qwen/Qwen-72B
1. YES
2. YES