2020年6月17日水曜日

学習環境

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



    1. (x-3)2+y2+(z+2)2=36

    2. (x+4)2+(y-3)2+(z-5)2=16

    3. |(2,0,0)-(0,-4,-6)|=|(2,4,6)|=|2(1,2,3)|=21+4+9=214
      (x-1)2+(y+2)2+(z+3)2=14

    4. (x-r)2+(y-r)2+(z-r)2=r2(1-r)2+(4-r)2+(5-r)2=r22r2-20r+42=0r2-10r+21=0(r-3)(r-7)=0

      よって求める球の方程式は、

      (x-3)2+(y-3)2+(z-3)2=9(x-7)2+(y-7)2+(z-7)2=49

    5. (x-a)2+(y-b)2+(z-c)2=r2
      {(1-a)2+b2+c2=r2a2+(2-b)2+c2=r2a2+b2+(3-c)2=r2(1-a)2+(2-b)2+(3-c)2=r2
      2(a2+b2+c2)+r2=3r2a2+b2+c2=r2
      (1-a)2=a21-2a+a2=a2a=12
      (2-b)2=b24-4b=0b=1
      (3-c)2=c29-6c=0c=32
      r2=14+1+94=144=72

      よって求める球の方程式は、

      (x-12)2+(y-1)2+(z-32)2=72

コード

#!/usr/bin/env python3
from sympy import solve
from sympy.plotting import plot3d
from sympy.abc import x, y, z

print('40.')

eq1 = (x - 3) ** 2 + (y - 3) ** 2 + (z - 3) ** 2 - 9
eq2 = (x - 7) ** 2 + (y - 7) ** 2 + (z - 7) ** 2 - 49

colors = ['red', 'green', 'blue', 'brown', 'orange',
          'purple', 'pink', 'gray', 'skyblue', 'yellow']


p = plot3d(
    *solve(eq1, z),
    *solve(eq2, z),
    (x, 0, 14),
    (y, 0, 14),
    show=False
)
for o, color in zip(p, colors):
    o.line_color = color
p.save(f'sample40.png')

p.show()

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

% ./sample40.py
40.
%

0 コメント:

コメントを投稿