## 2020年3月11日水曜日

### 数学 - Python - 解析学 - 多変数の関数 - ベクトルの微分 - 曲線の長さ - 対数関数、三角関数(正弦と余弦)

1. $\begin{array}{l}X\text{'}\left(t\right)=\left(1,\frac{1}{t}\right)\\ \int \sqrt{1+\frac{1}{{t}^{2}}}\mathrm{dt}\\ =\int \sqrt{\frac{1+{t}^{2}}{{t}^{2}}}\mathrm{dt}\\ =\int \frac{\sqrt{1+{t}^{2}}}{t}\mathrm{dt}\\ {u}^{2}=1+{t}^{2}\\ 2u·\frac{du}{\mathrm{dt}}=2t\\ \mathrm{dt}=\frac{u}{t}du\\ \int \frac{u}{t}·\frac{u}{t}du\\ =\int \frac{{u}^{2}}{{u}^{2}-1}du\\ =\int \frac{{u}^{2}-1+1}{{u}^{2}-1}du\\ =\int \left(1+\frac{1}{{u}^{2}-1}\right)du\\ =\int du+\int \frac{1}{\left(u+1\right)\left(u-1\right)}du\\ =u+\frac{1}{2}\int \left(\frac{1}{u-1}-\frac{1}{u+1}\right)du\\ =u+\frac{1}{2}\left(\mathrm{log}\left(u-1\right)-\mathrm{log}\left(u+1\right)\right)\\ =u+\frac{1}{2}\mathrm{log}\frac{u-1}{u+1}\end{array}$

よって、

$\begin{array}{l}{\int }_{1}^{2}\sqrt{1+\frac{1}{{t}^{2}}}\mathrm{dt}\\ ={\left[u+\frac{1}{2}\mathrm{log}\frac{u-1}{u+1}\right]}_{\sqrt{2}}^{\sqrt{5}}\\ =\sqrt{5}-\sqrt{2}+\frac{1}{2}\mathrm{log}\frac{\sqrt{5}-1}{\sqrt{5}+1}·\frac{\sqrt{2}+1}{\sqrt{2}-1}\end{array}$

2. $\begin{array}{l}{\int }_{3}^{5}\sqrt{1+\frac{1}{{t}^{2}}}\mathrm{dt}\\ ={\left[u+\frac{1}{2}\mathrm{log}\frac{u-1}{u+1}\right]}_{\sqrt{10}}^{\sqrt{26}}\\ =\sqrt{26}-\sqrt{10}+\frac{1}{2}\mathrm{log}\frac{\sqrt{26}-1}{\sqrt{26}+1}·\frac{\sqrt{10}+1}{\sqrt{10}-1}\end{array}$

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import symbols, Integral, Derivative, log, cos, tan, sqrt, pi
from sympy.plotting import plot_parametric

print('6.')

t = symbols('t', real=True)
x = t
y = log(cos(t))

class MyTestCase(TestCase):
def test(self):
self.assertEqual(
float(Integral(1 / cos(t), (t, 0, pi / 4)).doit()),
float(log((sqrt(2) + 1) / (sqrt(2) - 1)) / 2))

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

p = plot_parametric(*[(x, y, (t, t1, t2))
for t1, t2 in [(0.1, pi / 4), (pi / 4, pi / 2 - 0.1)]],
legend=False,
show=False)

for o, color in zip(p, colors):
o.line_color = color
p.show()
p.save('sample6.png')

if __name__ == "__main__":
main()


 % ./sample6.py -v
6.
test (__main__.MyTestCase) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.511s

OK
%