## 2020年1月3日金曜日

### 数学 - Python - 微分積分学 - 積分法 - 不定積分の公式 - 置換積分法

1. $\begin{array}{l}f\left(x\right)={\left(ax+b\right)}^{n}\\ g\left(x\right)=ax+b\end{array}$

とおくと、

$\begin{array}{l}g\text{'}\left(x\right)=a\\ \int {\left(ax+b\right)}^{n}\mathrm{dx}\\ =\frac{1}{a}\int {\left(ax+b\right)}^{n}adx\\ =\frac{1}{a}\int {\left(ax+b\right)}^{n}\frac{d\left(ax+b\right)}{\mathrm{dx}}dx\end{array}$

よって、

$t=ax+b$

ておくと、

$\begin{array}{l}\int {\left(ax+b\right)}^{n}\mathrm{dx}\\ =\frac{1}{a}\int {t}^{n}\mathrm{dt}\\ =\frac{{t}^{n+1}}{a\left(n+1\right)}+C\\ =\frac{{\left(ax+b\right)}^{n+1}}{\left(n+1\right)a}+C\end{array}$

(C は積分定数）

（証明終）

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import symbols, summation, Derivative, plot

print('2.')

x, b, n = symbols('x, b, n')
a = symbols('a', nonzero=True)
f = (a * x + b) ** n

class MyTestCase(TestCase):
def test(self):
self.assertEqual(f.simplify(), Derivative(
(a * x + b) ** (n + 1) / ((n + 1) * a), x, 1).doit().simplify())

p = plot(f.subs({a: 1, b: 2, n: 3}),
(x, -5, 5),
ylim=(-5, 5),
legend=True,
show=False)

colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']

for o, color in zip(p, colors):
o.line_color = color

p.show()
p.save('sample2.png')
if __name__ == '__main__':
main()


% ./sample2.py -v
2.
test (__main__.MyTestCase) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.307s

OK
%