2020年3月25日水曜日

学習環境

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


  1. c が零の場合。

    x y 2 x 2 + y 2 = 0 x = 0 y 0 x 0 y = 0

    よって、 直線 x 軸 または y 軸である。

    c 0

    の場合。

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

    よって等位線は放物線である。

コード

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

print('12.')

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

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

p = plot(*[(sign * sqrt(1 / (4 * c ** 2) - 1) + 1 / (2 * c)) * x ** 2
           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('sample12_1.png')
p.show()

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

% ./sample12.py
12.
%

0 コメント:

コメントを投稿