2020年5月28日木曜日

学習環境

新装版 数学読本3 (松坂 和夫(著)、岩波書店)の第11章(立体的な広がりの中の図形 - 空間図形)、11.3(直線・平面・球の方程式)、2直線の交点、2直線に直交する直線の問25の解答を求めてみる。



    1. l : { x = 5 + 2 t y = 2 + 2 t z = - 3 - t m : { x = - 3 + 4 s y = - 7 + 5 s z = - 4 + 3 s 5 + 2 t = - 3 + 4 s 2 + 2 t = - 7 + 5 s 3 = 4 - s s = 1 5 + 2 t = - 3 + 4 t = - 2 - 3 + 2 = - 1 - 4 + 3 = - 1

      よって、2直線 l、 m は交り、 交点 の座標は、

      1 , - 2 , - 1

    2. l : { x = 3 + 5 t y = 2 - 2 t z = t m : { x = 2 + 3 s y = - 2 s z = - 8 - 2 s t = - 8 - 2 s 2 + 16 + 4 s = - 2 s s = - 3 t = - 8 + 6 = - 2 3 - 10 = - 7 2 - 9 = - 7 - 7 , 6 , - 2

コード

#!/usr/bin/env python3
from sympy import symbols
from sympy.plotting import plot3d_parametric_line

print('25.')

t = symbols('t')
p = plot3d_parametric_line(
    (5 + 2 * t, 2 + 2 * t, -3 - t, (t, -10, 10)),
    (-3 + 4 * t, -7 + 5 * t, -4 + 3 * t, (t, -10, 10)),
    (3 + 5 * t, 2 - 2 * t, t, (t, -10, 10)),
    (2 + 3 * t, -2 * t, -8 - 2 * t, (t, -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(f'sample25.png')

p.show()

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

% ./sample25.py
25.
%

0 コメント:

コメントを投稿