学習環境
- Surface、Surface ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro 10.5 + Apple Pencil
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
微分積分学 (ちくま学芸文庫) (吉田 洋一(著)、筑摩書房)のⅡ.(微分法の公式)、6.(導関数の求め方)、演習問題I7の解答を求めてみる。
コード
Python 3
#!/usr/bin/env python3
from sympy import pprint, symbols, Derivative, plot
from unittest import TestCase, main
print('17.')
x = symbols('x')
f = (x + 1) ** 2 / ((x + 2) ** 3 * (x + 3) ** 4)
d = Derivative(f, x, 1).doit()
class MyTest(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test(self):
d0 = -(x + 1) * (5 * x ** 2 + 14 * x + 5) / \
((x + 2) ** 4 * (x + 3) ** 5)
self.assertEqual(d.factor(), d0.factor())
p = plot(f, d,
ylim=(-10, 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('sample17.png')
if __name__ == '__main__':
main()
入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))
$ ./sample17.py 17. . ---------------------------------------------------------------------- Ran 1 test in 0.023s OK $
0 コメント:
コメントを投稿