2020年7月17日金曜日

学習環境

新装版 数学読本3 (松坂 和夫(著)、岩波書店)の第12章(放物線・だ円・双曲線 - 2次関数)、12.2(2次曲線と直線)、放物線と直線の問14の解答を求めてみる。


  1. P = ( x 1 , y 1 ) Q = ( x 2 , y 2 )

    とおく。

    放物線の方程式。

    y 2 = 4 · 1 · x

    点 P、 Q における接線の方程式。

    y y 1 = 2 ( x + x 1 ) y y 2 = 2 ( x + x 2 )

    PQ の中点を通り x 軸に平行な直線の方程式。

    y = y 1 + y 2 2

    2接線の交点の y 座標を求める。

    y ( y 1 + y 2 ) = 4 x + 2 ( x 1 + x 2 )
    2 y ( y 1 + y 2 ) = 2 y 2 + 2 y 2
    y ( y 1 + y 2 ) = 2 y 2
    y ( y - y 1 + y 2 2 ) = 0 y = 0 , y 1 + y 2 2
    y = 0

    のとき、 PQ の中点の y 座標は0なので、 問題の直線上にある。

    よって 問題の直線上にある。

    (証明終)

コード

#!/usr/bin/env python3
from sympy import plot, solve, symbols, sqrt

print('14.')

p = 1
x, y = symbols('x, y', real=True)
eq = y ** 2 - 4 * p * x
ys = solve(eq, y)
x1, y1 = 1, 2
l = (2 * (x + x1)) / y1
p0 = plot(*ys, l,
          (x, -10, 10),
          ylim=(-10, 10),
          legend=False,
          show=False)

for x2 in range(2, 10):
    y2 = -sqrt(4 * x2)
    l2 = 2 * (x + x2) / y2
    for f in [l2, (y1 + y2) / 2]:
        p0.append(plot(f,
                       (x, -10, 10),
                       ylim=(-10, 10),
                       legend=False,
                       show=False)[0])
colors = ['red', 'green', 'blue', 'brown', 'orange',
          'purple', 'pink', 'gray', 'skyblue', 'yellow']
for o, color in zip(p0, colors):
    o.line_color = color
    print(o, color)
p0.save('sample14.png')
p0.show()

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

% ./sample14.py
14.
cartesian line: -2*sqrt(x) for x over (-10.0, 10.0) red
cartesian line: 2*sqrt(x) for x over (-10.0, 10.0) green
cartesian line: x + 1 for x over (-10.0, 10.0) blue
cartesian line: -sqrt(2)*(2*x + 4)/4 for x over (-10.0, 10.0) brown
cartesian line: 1 - sqrt(2) for x over (-10.0, 10.0) orange
cartesian line: -sqrt(3)*(2*x + 6)/6 for x over (-10.0, 10.0) purple
cartesian line: 1 - sqrt(3) for x over (-10.0, 10.0) pink
cartesian line: -x/2 - 2 for x over (-10.0, 10.0) gray
cartesian line: -1 for x over (-10.0, 10.0) skyblue
cartesian line: -sqrt(5)*(2*x + 10)/10 for x over (-10.0, 10.0) yellow
%

0 コメント:

コメントを投稿