学習環境
- Surface、Surface ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro 10.5 + Apple Pencil
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
微分積分学 (ちくま学芸文庫) (吉田 洋一(著)、筑摩書房)のI.(微分法)、演習問題 I.、21、22、23の解答を求めてみる。
求める極値は最小値で、
極値は最大値で、
よって、極値は最小値で、
コード
Python 3
#!/usr/bin/env python3
from sympy import pprint, symbols, Derivative, sqrt, plot, solve
x = symbols('x', real=True)
fs = [1 - 2 * x + 3 * x ** 2,
sqrt(1 - x ** 2),
sqrt(x) + 4 / x]
xs = [(-5, 5),
(-1, 1),
(0.1, 5)]
ds = [Derivative(f, x, 1) for f in fs]
ds1 = [d.doit() for d in ds]
s = [solve(d, x) for d in ds1]
for i, (d, d1, t) in enumerate(zip(ds, ds1, s), 21):
print(f'{i}.')
for o in [d, d1, t]:
pprint(o)
print()
extremums = [f.subs({x: t[0]}) for f, t in zip(fs, s)]
p = plot(*[(f, (x, x1, x2)) for f, (x1, x2) in zip(fs, xs)],
*[(extremum, (x, -5, 5)) for extremum in extremums],
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('sample21.png')
入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))
C:\Users\...>py sample21.py
21.
d ⎛ 2 ⎞
──⎝3⋅x - 2⋅x + 1⎠
dx
6⋅x - 2
[1/3]
22.
⎛ ________⎞
d ⎜ ╱ 2 ⎟
──⎝╲╱ 1 - x ⎠
dx
-x
───────────
________
╱ 2
╲╱ 1 - x
[0]
23.
d ⎛ 4⎞
──⎜√x + ─⎟
dx⎝ x⎠
4 1
- ── + ────
2 2⋅√x
x
[4]
c:\Users\...>
0 コメント:
コメントを投稿