## 2019年10月5日土曜日

### 数学 - Python - 微分積分学 - 微分法の公式 - 導関数の求め方 - 累乗根(立方根)、積、対数微分法

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

コード

Python 3

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

print('19.')

x, a, b = symbols('x, a, b')
f = root(((a + x) * (b + x)) / ((a - x) * (b - x)), 3)
d = Derivative(f, x, 1).doit()

class MyTest(TestCase):
def setUp(self):
pass

def tearDown(self):
pass

def test(self):
d0 = f * Rational(1, 3) * (
1 / (a + x) + 1 / (b + x) + 1 / (a - x) + 1 / (b - x))
self.assertEqual(d.factor(), d0.factor())

p = plot(f.subs({a: 1, b: 2}),
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('sample19.png')

if __name__ == '__main__':
main()


$./sample19.py 19. . ---------------------------------------------------------------------- Ran 1 test in 0.055s OK$