2020年3月23日月曜日

学習環境

解析入門 原書第3版 (S.ラング(著)、松坂 和夫(翻訳)、片山 孝次(翻訳)、岩波書店)の第Ⅵ部(多変数の関数)、第19章(多変数の関数)、1(グラフと等位線)の練習問題10の解答を求めてみる。


  1. 2 x - 3 y = c y = 2 3 x - c 3

    よって、等位線は直線である。

コード

#!/usr/bin/env python3
from sympy import symbols, plot, sqrt
from sympy.plotting import plot3d

print('10.')

x, y = symbols('x, y', real=True)
p = plot3d(2 * x - 3 * y, show=False)

p.xlabel = x
p.ylabel = y
p.show()
p.save('sample10.png')

p = plot(*[(2 * x - c) / 3
           for c in range(-5, 5)],
         (x, -10, 10),
         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.save('sample10_1.png')
p.show()

入出力結果(Zsh、PowerShell、Terminal、Jupyter(IPython))

% ./sample10.py
10.
%

0 コメント:

コメントを投稿