学習環境
- Surface、Surface ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro 10.5 + Apple Pencil
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
微分積分学 (ちくま学芸文庫) (吉田 洋一(著)、筑摩書房)のⅡ.(微分法の公式)、6.(導関数の求め方)、演習問題I6の解答を求めてみる。
(証明終)
コード
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()
入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))
$ ./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 $
0 コメント:
コメントを投稿