2020年3月24日火曜日

学習環境

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


  1. x 0 y 0 x y x 2 + y 2 = c

    c が零の場合、 x またはyが零である。

    c が零ではない場合、

    x y = c x 2 + c y 2 c y 2 - x y = - c x 2 y 2 - x y c = - x 2 y - x 2 c 2 - x 2 4 c 2 = - x 2 y - x 2 c 2 = 1 4 c 2 - 1 x 2 y - x 2 c = ± 1 4 c 2 - 1 x 2 y = x 2 c ± 1 4 c 2 - 1 x 2 = x 2 c ± 1 4 c 2 - 1 x

コード

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

print('11.')

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

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

p = plot(*[x / (2 * c) + sign * abs(1 / (4 * c ** 2) - 1) * abs(x)
           for c in [Rational(1, d) for d in [-2, -3, -4, 4, 3, 2]]
           for sign in [-1, 1]],
         (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('sample11_1.png')
p.show()

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

% ./sample11.py
11.
%

0 コメント:

コメントを投稿