## 2019年9月30日月曜日

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

1. $\frac{d}{\mathrm{dx}}{x}^{-\frac{4}{3}}=-\frac{4}{3}{x}^{-\frac{7}{3}}$

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

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, root, Derivative, Rational, plot

print('1.')

x = symbols('x')
fs = [x ** -Rational(4, 3),
root((1 + x + x ** 2) ** 2, 3)]

for i, f in enumerate(fs, 1):
d = Derivative(f, x, 1)
for o in [f'({i})', d, d.doit()]:
pprint(o)
print()

p = plot((fs[0], (x, 0.1, 5)),
(fs[1], (x, -5, 5)),
ylim=(0, 10),
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('sample1.png')


$./sample1.py 1. (1) d ⎛ 1 ⎞ ──⎜────⎟ dx⎜ 4/3⎟ ⎝x ⎠ -4 ────── 7/3 3⋅x (2) ⎛ _______________⎞ ⎜ ╱ 2 ⎟ d ⎜3 ╱ ⎛ 2 ⎞ ⎟ ──⎝╲╱ ⎝x + x + 1⎠ ⎠ dx _______________ ╱ 2 3 ╱ ⎛ 2 ⎞ (4⋅x + 2)⋅╲╱ ⎝x + x + 1⎠ ───────────────────────────── ⎛ 2 ⎞ 3⋅⎝x + x + 1⎠$