## 2019年10月2日水曜日

### 数学 - Python - 微分積分学 - 微分法の公式 - 導関数の求め方 - 関数の積の導関数、対数微分法、有理式

1. $\begin{array}{l}\frac{d}{\mathrm{dx}}F\left(x\right)\\ =\frac{{p}_{1}{f}_{1}{\left(x\right)}^{{p}_{1}-1}{f}_{1}\text{'}\left(x\right)·\dots ·{f}_{m}{\left(x\right)}^{{p}_{m}}+\dots +{f}_{1}{\left(x\right)}^{{p}_{1}}·\dots ·{p}_{m}{f}_{n}{\left(x\right)}^{{p}_{m}-1}{f}_{n}\text{'}\left(x\right)}{{g}_{1}{\left(x\right)}^{{q}_{1}}·\dots ·{g}_{n}{\left(x\right)}^{{q}_{n}}}\\ -\frac{{f}_{1}{\left(x\right)}^{{p}_{1}}·\dots ·{f}_{n}{\left(x\right)}^{{p}_{n}}\left({q}_{1}{g}_{1}{\left(x\right)}^{{q}_{1}-1}{g}_{1}\text{'}\left(x\right)·\dots ·{g}_{n}{\left(x\right)}^{{q}_{n}}+\dots +{g}_{1}{\left(x\right)}^{{q}_{1}}·\dots ·{q}_{n}{g}_{n}{\left(x\right)}^{{q}_{n}-1}{g}_{n}\left(x\right)\right)}{{\left({g}_{1}{\left(x\right)}^{{q}_{1}}-\dots ·{g}_{n}{\left(x\right)}^{{q}_{n}}\right)}^{2}}\\ =F\left(x\right)\left({p}_{1}\frac{{f}_{1}\text{'}\left(x\right)}{{f}_{1}\left(x\right)}+\dots +{p}_{m}\frac{{f}_{m}\text{'}\left(x\right)}{{f}_{m}\left(x\right)}-{q}_{1}\frac{{g}_{1}\text{'}\left(x\right)}{{g}_{1}\left(x\right)}-\dots -{q}_{n}\frac{{g}_{n}\text{'}\left(x\right)}{{g}_{n}\left(x\right)}\right)\end{array}$

（証明終）

コード

Python 3

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

print('16.')

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

def tearDown(self):
pass

def test(self):
x, p1, p2, q1, q2, q3 = symbols('x, p1, p2, q1, q2, q3')
f1 = Function('f1')(x)
f2 = Function('f2')(x)
g1 = Function('g1')(x)
g2 = Function('g2')(x)
g3 = Function('g3')(x)
F = (f1 ** p1 * f2 ** p2) / \
(g1 ** q1 * g2 ** q2 * g3 ** q3)
h1 = Derivative(F, x, 1)
h2 = F * (p1 * Derivative(f1, x, 1) / f1 +
p2 * Derivative(f2, x, 1) / f2 -
q1 * Derivative(g1, x, 1) / g1 -
q2 * Derivative(g2, x, 1) / g2 -
q3 * Derivative(g3, x, 1) / g3)
for o in [h1, h1.doit(), h2, h2.doit()]:
pprint(o.simplify())
print()
self.assertEqual(h1.doit().factor(), h2.doit().factor())

if __name__ == '__main__':
main()

$./sample16.py 16. ∂ ⎛ p₁ p₂ -q₁ -q₂ -q₃ ⎞ ──⎝f₁ (x)⋅f₂ (x)⋅g₁ (x)⋅g₂ (x)⋅g₃ (x)⎠ ∂x ⎛ d d ⎜p₁⋅f₂(x)⋅g₁(x)⋅g₂(x)⋅g₃(x)⋅──(f₁(x)) + p₂⋅f₁(x)⋅g₁(x)⋅g₂(x)⋅g₃(x)⋅──(f₂(x)) - ⎝ dx dx d d q₁⋅f₁(x)⋅f₂(x)⋅g₂(x)⋅g₃(x)⋅──(g₁(x)) - q₂⋅f₁(x)⋅f₂(x)⋅g₁(x)⋅g₃(x)⋅──(g₂(x)) - dx dx d ⎞ p₁ - 1 p₂ - 1 -q₁ - 1 q₃⋅f₁(x)⋅f₂(x)⋅g₁(x)⋅g₂(x)⋅──(g₃(x))⎟⋅f₁ (x)⋅f₂ (x)⋅g₁ (x)⋅g₂ dx ⎠ -q₂ - 1 -q₃ - 1 (x)⋅g₃ (x) ⎛ d d d d d ⎞ ⎜ p₁⋅──(f₁(x)) p₂⋅──(f₂(x)) q₁⋅──(g₁(x)) q₂⋅──(g₂(x)) q₃⋅──(g₃(x))⎟ ⎜ dx dx dx dx dx ⎟ -⎜- ──────────── - ──────────── + ──────────── + ──────────── + ────────────⎟⋅ ⎝ f₁(x) f₂(x) g₁(x) g₂(x) g₃(x) ⎠ p₁ p₂ -q₁ -q₂ -q₃ f₁ (x)⋅f₂ (x)⋅g₁ (x)⋅g₂ (x)⋅g₃ (x) ⎛ d d d d d ⎞ ⎜ p₁⋅──(f₁(x)) p₂⋅──(f₂(x)) q₁⋅──(g₁(x)) q₂⋅──(g₂(x)) q₃⋅──(g₃(x))⎟ ⎜ dx dx dx dx dx ⎟ -⎜- ──────────── - ──────────── + ──────────── + ──────────── + ────────────⎟⋅ ⎝ f₁(x) f₂(x) g₁(x) g₂(x) g₃(x) ⎠ p₁ p₂ -q₁ -q₂ -q₃ f₁ (x)⋅f₂ (x)⋅g₁ (x)⋅g₂ (x)⋅g₃ (x) . ---------------------------------------------------------------------- Ran 1 test in 2.168s OK$