## 2019年9月22日日曜日

### 数学 - Python - 微分積分学 - 微分法の公式 - 微分法の公式 - 合成関数の導関数

1. $\begin{array}{l}\frac{d}{\mathrm{dx}}\sqrt{2x-\frac{1}{{x}^{2}}}\\ =\frac{1}{2\sqrt{2x-\frac{1}{{x}^{2}}}}·\left(2+\frac{2x}{{x}^{4}}\right)\\ =\frac{1}{\sqrt{2x-\frac{1}{{x}^{2}}}}\left(1+\frac{1}{{x}^{3}}\right)\\ =\frac{{x}^{3}+1}{{x}^{2}\sqrt{2{x}^{3}-1}}\end{array}$

2. $\begin{array}{l}\frac{d}{\mathrm{dx}}\sqrt{x+\sqrt{1+{x}^{2}}}\\ =\frac{1}{2\sqrt{x+\sqrt{1+{x}^{2}}}}·\left(1+\frac{1}{2\sqrt{1+{x}^{2}}}·2x\right)\\ =\frac{1}{2\sqrt{x+\sqrt{1+{x}^{2}}}}·\frac{\sqrt{1+{x}^{2}}+x}{\sqrt{1+{x}^{2}}}\\ =\frac{\sqrt{x+\sqrt{1+{x}^{2}}}}{2\sqrt{1+{x}^{2}}}\end{array}$

3. $\begin{array}{l}\frac{d}{\mathrm{dx}}\sqrt{\frac{\left(a+x\right)\left(b+x\right)}{\left(a-x\right)\left(b-x\right)}}\\ =\frac{1}{2}\sqrt{\frac{\left(a-x\right)\left(b-x\right)}{\left(a+x\right)\left(b+x\right)}}·\\ \frac{\left(b+x+a+x\right)\left(a-x\right)\left(b-x\right)-\left(a+x\right)\left(b+x\right)\left(-\left(b-x\right)-\left(a-x\right)\right)}{{\left(a-x\right)}^{2}{\left(b-x\right)}^{2}}\\ =\frac{1}{2}\sqrt{\frac{\left(a-x\right)\left(b-x\right)}{\left(a+x\right)\left(b+x\right)}}·\frac{\left(a+b+2x\right)\left(a-x\right)\left(b-x\right)-\left(a+x\right)\left(b+x\right)\left(-a-b+2x\right)}{{\left(a-x\right)}^{2}{\left(b-x\right)}^{2}}\\ =\frac{1}{2}\frac{\left(a-x\right)\left(b-x\right)}{\sqrt{\left({a}^{2}-{x}^{2}\right)\left({b}^{2}-{x}^{2}\right)}}·\left(\frac{\left(a+b\right)\left(\left(a-x\right)\left(b-x\right)+\left(a+x\right)\left(b+x\right)\right)}{{\left(a-x\right)}^{2}{\left(b-x\right)}^{2}}+\\ \frac{2x\left(\left(a-x\right)\left(b-x\right)-\left(a+x\right)\left(b+x\right)\right)}{{\left(a-x\right)}^{2}{\left(b-x\right)}^{2}}\right)\\ =\frac{1}{2}·\frac{1}{\sqrt{\left({a}^{2}-{x}^{2}\right)\left({b}^{2}-{x}^{2}\right)}}·\frac{1}{\left(a-x\right)\left(b-x\right)}\left(\left(a+b\right)\left(2ab+2{x}^{2}\right)+2x\left(-2ax-2bx\right)\right)\\ =\frac{\left(a+b\right)\left(ab+{x}^{2}-2{x}^{2}\right)}{\sqrt{\left({a}^{2}-{x}^{2}\right)\left({b}^{2}-{x}^{2}\right)}\left(a-x\right)\left(b-x\right)}\\ =\frac{\left(a+b\right)\left(ab-{x}^{2}\right)}{\sqrt{\left({a}^{2}-{x}^{2}\right)\left({b}^{2}-{x}^{2}\right)}\left(a-x\right)\left(b-x\right)}\end{array}$

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, sqrt, Derivative

print('3.')

x, a, b = symbols('x, a, b')
fs = [sqrt(2 * x - 1 / x ** 2),
sqrt(x + sqrt(1 + x ** 2)),
sqrt((a + x) * (b + x) / ((a - x) * (b - x)))]
dfs1 = [Derivative(f, x, 1).doit() for f in fs]
dfs2 = [(x ** 3 + 1) / (x ** 2 * sqrt(2 * x ** 3 - 1)),
sqrt(x + sqrt(1 + x ** 2)) / (2 * sqrt(1 + x ** 2)),
(a + b) * (a * b - x ** 2) /
(sqrt((a ** 2 - x ** 2) * (b ** 2 - x ** 2)) *
(a - x) * (b - x))]
for i, o in enumerate(zip(dfs1, dfs2), 1):
print(f'({i})')
for t in o:
pprint(t.factor())
print()


$./sample3.py 3. (1) ⎛ 2 ⎞ (x + 1)⋅⎝x - x + 1⎠ ──────────────────── __________ 3 ╱ 1 x ⋅ ╱ 2⋅x - ── ╱ 2 ╲╱ x ⎛ 2 ⎞ (x + 1)⋅⎝x - x + 1⎠ ──────────────────── __________ 2 ╱ 3 x ⋅╲╱ 2⋅x - 1 (2) _________________ ╱ ________ ╱ ╱ 2 ╲╱ x + ╲╱ x + 1 ───────────────────── ________ ╱ 2 2⋅╲╱ x + 1 _________________ ╱ ________ ╱ ╱ 2 ╲╱ x + ╲╱ x + 1 ───────────────────── ________ ╱ 2 2⋅╲╱ x + 1 (3) ______________________ ╱ (a + x)⋅(b + x) ⎛ 2⎞ - ╱ ──────────────────── ⋅(a + b)⋅⎝-a⋅b + x ⎠ ╱ 2 ╲╱ a⋅b - a⋅x - b⋅x + x ───────────────────────────────────────────────── (-a + x)⋅(a + x)⋅(-b + x)⋅(b + x) ⎛ 2⎞ -(a + b)⋅⎝-a⋅b + x ⎠ ─────────────────────────────────────────────────────── ___________________________________ ╲╱ (-a + x)⋅(a + x)⋅(-b + x)⋅(b + x) ⋅(-a + x)⋅(-b + x)$