## 2020年8月5日水曜日

### 数学 - Python - 解析学 - ベクトルの微分 - 微分係数 - 曲線、三角関数(正弦と余弦)、速度ベクトルと加速度ベクトル、長さ、一定

1. $X\text{'}\left(t\right)=\left(-a\left(\mathrm{sin}t\right),a\left(\mathrm{cos}t\right),b\right)$
$X\text{'}\text{'}\left(t\right)=\left(-a\left(\mathrm{cos}t\right),-a\left(\mathrm{sin}t\right),0\right)$
$\parallel X\text{'}\left(t\right)\parallel =\sqrt{{a}^{2}{\mathrm{sin}}^{2}t+{a}^{2}{\mathrm{cos}}^{2}t+{b}^{2}}=\sqrt{{a}^{2}+{b}^{2}}$
$\parallel X\text{'}\text{'}\left(t\right)\parallel =\sqrt{{a}^{2}}$

よって、 速度ベクトルと加速度ベクトルの長さは一定。

コード

#!/usr/bin/env python3
from sympy import cos, sin, Matrix, Derivative
from sympy.plotting import plot3d_parametric_line, plot3d
from sympy.abc import t

print('22.')

a = 2
b = 3
x = Matrix([a * cos(t), a * sin(t), b * t])
x1 = Derivative(x, t, 1).doit()
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']

p = plot3d_parametric_line(*x, legend=False, show=False)
for t0 in range(-5, 6):
p.append(
plot3d_parametric_line(
*(x.subs({t: t0}) + t * x1.subs({t: t0})),
(t, 0, 1),
legend=False,
show=False
)[0]
)
p.xlabel = 'x'
p.ylabel = 'y'
for o, color in zip(p, colors):
o.line_color = color
p.save(f'sample21.png')
p.show()


% ./sample22.py
22.
/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/ma/core.py:2831: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
_data = np.array(data, dtype=dtype, copy=copy,
%