## 2020年8月2日日曜日

### 数学 - Python - 解析学 - ベクトルの微分 - 微分係数 - 曲線と平面の交点

1. $6{t}^{2}-14+14t+3+{t}^{2}-10=0$
$7{t}^{2}+14t-21=0$
${t}^{2}+2t-3=0$
$\left(t+3\right)\left(t-1\right)=0$
$t=-3,1$

よって、 問題の曲線と平面は2点で交わり、その2点は

$\begin{array}{l}\left(18,4,12\right)\\ \left(2,0,4\right)\end{array}$

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import symbols, solve, Matrix
from sympy.plotting import plot3d_parametric_line, plot3d

print('19.')

t, x, y, z = symbols('t, x, y, z', real=True)
x1 = 2 * t ** 2
y1 = 1 - t
z1 = 3 + t ** 2
eq = 3 * x - 14 * y + z - 10
zs = solve(eq, z)

class Test(TestCase):
def test(self):
ts = solve(eq.subs({x: x1, y: y1, z: z1}))
self.assertEqual(set(ts), {-3, 1})
self.assertEqual(
{(x1.subs({t: t0}), y1.subs({t: t0}), z1.subs({t: t0}))
for t0 in ts},
{(18, 4, 12), (2, 0, 4)}
)

colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']
p = plot3d(*zs, show=False)
p.append(plot3d_parametric_line(
2 * t ** 2, 1 - t, 3 + t ** 2,
(t, -4, 2),
show=False,
legend=False,
)[0])
p.xlabel = x
p.ylabel = y
for o, color in zip(p, colors):
o.line_color = color
p.save(f'sample19.png')
p.show()

if __name__ == "__main__":
main()


% ./sample19.py -v
19.
test (__main__.Test) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.014s

OK
%