学習環境
- Surface、Surface ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro 10.5 + Apple Pencil
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
微分積分学 (ちくま学芸文庫) (吉田 洋一(著)、筑摩書房)のI.(微分法)、1.(関数)、問1の解答を求めてみる。
それぞれ、
コード
Python 3
#!/usr/bin/env python3
from sympy import pprint, symbols, plot, Rational
print('1.')
x = symbols('x')
f = x ** 4 + 3 * x - 2
xs = [0, 1, -1, Rational(1, 2)]
for x0 in xs:
pprint(f.subs({x: x0}))
print()
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']
p = plot(f, -2, 2, -4, -Rational(7, 16),
ylim=(-10, 10),
legend=True,
show=False)
for o, color in zip(p, colors):
o.line_color = color
p.show()
p.save('sample1.png')
入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))
C:\Users\...>py sample1.py 1. -2 2 -4 -7/16 c:\Users\...>
0 コメント:
コメントを投稿