## 2019年7月28日日曜日

### 数学 - Python - 図形と数や式の関係 - 平面図形と式 - 円と軌跡 - 軌跡の方程式 - 比率、距離、平方和、線分、内分点

1. 点 P を(x, y)とおく。

$\begin{array}{l}{\left(x-6\right)}^{2}+{y}^{2}={2}^{2}\left({x}^{2}+{\left(y-3\right)}^{2}\right)\\ 3{x}^{2}+12x+3{y}^{2}-24y=0\\ {x}^{2}+4x+{y}^{2}-8y=0\\ {\left(x+2\right)}^{2}+{\left(y-4\right)}^{2}=20\end{array}$

よって中心、半径がそれぞれ

$\begin{array}{l}\left(-2,4\right)\\ \sqrt{20}=2\sqrt{5}\end{array}$

の円。

2. $\begin{array}{l}{\left(x+1\right)}^{2}+{y}^{2}+{\left(x-1\right)}^{2}+{y}^{2}=4\\ 2{x}^{2}+2{y}^{2}=4\\ {x}^{2}+{y}^{2}=2\end{array}$

3. $\begin{array}{l}{x}^{2}+{y}^{2}={\left(x-1\right)}^{2}+{y}^{2}+{\left(x-2\right)}^{2}+{y}^{2}\\ {x}^{2}+{y}^{2}-6x+5=0\\ {\left(x-3\right)}^{2}+{y}^{2}=4\end{array}$

4. $\begin{array}{l}{x}^{2}+{y}^{2}+{\left(x-4\right)}^{2}+{\left(y-2\right)}^{2}+{\left(x-5\right)}^{2}+{\left(y-1\right)}^{2}=64\\ 3{x}^{2}+3{y}^{2}-18x-6y+46=64\\ 3{x}^{2}+3{y}^{2}-18x-6y=18\\ {x}^{2}+{y}^{2}-6x-2y=6\\ {\left(x-3\right)}^{2}+{\left(y-1\right)}^{2}=16\end{array}$

5. 点 Q の座標を

$\left(u,v\right)$

とおく。

$\begin{array}{l}{u}^{2}+{v}^{2}-6u-10v+30=0\\ x=\frac{3u}{3+1}\\ y=\frac{3v}{3+1}\\ u=\frac{4}{3}x\\ v=\frac{4}{3}y\\ {\left(\frac{4}{3}\right)}^{2}{x}^{2}+{\left(\frac{4}{3}\right)}^{2}{y}^{2}-6·\frac{4}{3}x-10·\frac{4}{3}y+30=0\\ {x}^{2}+{y}^{2}-6·\frac{3}{4}x-10·\frac{3}{4}y+30·\frac{{3}^{2}}{{4}^{2}}=0\\ {x}^{2}+{y}^{2}-\frac{9}{2}x-\frac{15}{2}y+\frac{135}{8}=0\\ {\left(x-\frac{9}{4}\right)}^{2}+{\left(y-\frac{15}{4}\right)}^{2}-{\left(\frac{9}{4}\right)}^{2}-{\left(\frac{15}{4}\right)}^{2}+\frac{135}{8}=0\\ {\left(x-\frac{9}{4}\right)}^{2}+{\left(y-\frac{15}{4}\right)}^{2}-\frac{81}{16}-\frac{225}{16}+\frac{270}{16}=0\\ {\left(x-\frac{9}{4}\right)}^{2}+{\left(y-\frac{15}{4}\right)}^{2}=\frac{36}{16}\\ {\left(x-\frac{9}{4}\right)}^{2}+{\left(y-\frac{15}{4}\right)}^{2}=\frac{9}{4}\end{array}$

コード

Python 3

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

print('30.')

x, y = symbols('x, y')
u = 4 * x / 3
v = 4 * y / 3
eq = u ** 2 + v ** 2 - 6 * u - 10 * v + 30
ys = solve(eq, y)

for o in [eq, eq.factor(), ys]:
pprint(o)
print()

r = Rational(3, 2)
ox = Rational(9, 4)
x1 = ox - r
x2 = ox + r
p = plot(*ys,
(x, x1, x2),
legend=True,
show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']

for s, color in zip(p, colors):
s.line_color = color

p.show()
p.save('sample30.png')


C:\Users\...>py sample30.py
30.
2             2
16⋅x          16⋅y    40⋅y
───── - 8⋅x + ───── - ──── + 30
9             9      3

⎛   2             2             ⎞
2⋅⎝8⋅x  - 36⋅x + 8⋅y  - 60⋅y + 135⎠
───────────────────────────────────
9

⎡        _____________________     _____________________     ⎤
⎢       ╱       2                 ╱       2                  ⎥
⎢15   ╲╱  - 16⋅x  + 72⋅x - 45   ╲╱  - 16⋅x  + 72⋅x - 45    15⎥
⎢── - ────────────────────────, ──────────────────────── + ──⎥
⎣4               4                         4               4 ⎦

C:\Users\...>