学習環境
- Surface
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
続 解析入門 (原書第2版) (S.ラング(著)、松坂 和夫(翻訳)、片山 孝次(翻訳)、岩波書店)の第1章(ベクトル)、1(空間の点の定義)の練習問題9の解答を求めてみる。
コード
#!/usr/bin/env python3
from sympy import symbols, Matrix
from sympy.plotting import plot_parametric
print('9.')
t = symbols('t')
AS = [Matrix([a, b]) for a, b in [(1, 2),
(3, 1),
(1, 1),
(2, 2)]]
BS = [Matrix([a, b]) for a, b in [(2, 1),
(1, 3),
(-2, 2),
(3, -2)]]
CS = [A - B for A, B in zip(AS, BS)]
t = symbols('t')
p = plot_parametric(*[(*(t * v), (t, 0, 1)) for v in AS + BS + CS],
*[(*(v + t * w), (t, 0, 1)) for v, w in zip(BS, CS)],
xlim=(-5, 5),
ylim=(-5, 5),
legend=False,
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('sample9.png')
入出力結果(Zsh、PowerShell、Terminal、Jupyter(IPython))
% ./sample9.py
9.
/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/sympy/plotting/plot.py:1065: MatplotlibDeprecationWarning:
The set_smart_bounds function was deprecated in Matplotlib 3.2 and will be removed two minor releases later.
self.ax[i].spines['left'].set_smart_bounds(True)
/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/sympy/plotting/plot.py:1066: MatplotlibDeprecationWarning:
The set_smart_bounds function was deprecated in Matplotlib 3.2 and will be removed two minor releases later.
self.ax[i].spines['bottom'].set_smart_bounds(False)
%
0 コメント:
コメントを投稿