Skip to content

Commit 2bd4aa8

Browse files
authored
Merge pull request #149 from chvmvd/change-variable-name-#124
Change v_x => u v_y => v #124
2 parents 756c354 + a45bf52 commit 2bd4aa8

File tree

4 files changed

+1733
-1733
lines changed

4 files changed

+1733
-1733
lines changed

docs/02advanced/03simulation/02parabolic_motion/index.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,37 @@ import Answer from "@site/src/components/Answer";
1111

1212
次は、もう少し複雑な放物運動を考えましょう。
1313

14-
初速度を $v_0$ 、$x$ 軸方向の速度を $v_x$ 、$y$ 軸方向の速度を $v_y$ 、重力加速度を $g$ 、 $t$ 秒後の変位を $x,y$ として、仰角 $\theta$ で物体を投げたとします。
14+
初速度を $v_0$ 、$x$ 軸方向の速度を $u$ 、$y$ 軸方向の速度を $v$ 、重力加速度を $g$ 、 $t$ 秒後の変位を $x,y$ として、仰角 $\theta$ で物体を投げたとします。
1515

1616
これらの関係は、次のようになります。
1717

1818
$$
1919
\begin{align*}
20-
\frac{dx}{dt} &= v_x \\
21-
\frac{dy}{dt} &= v_y \\
22-
\frac{dv_x}{dt} &= 0 \\
23-
\frac{dv_y}{dt} &= -g
20+
\frac{dx}{dt} &= u \\
21+
\frac{dy}{dt} &= v \\
22+
\frac{du}{dt} &= 0 \\
23+
\frac{dv}{dt} &= -g
2424
\end{align*}
2525
$$
2626

2727
これを差分化してみましょう。
2828

2929
$$
3030
\begin{align*}
31-
\frac{x_{n + 1} - x_n}{\Delta t} &= {v_x}_n \\
32-
\therefore x_{n + 1} - x_n &= {v_x}_n \Delta t \\
33-
\therefore x_{n + 1} &= x_n + {v_x}_n \Delta t
31+
\frac{x_{n + 1} - x_n}{\Delta t} &= u_n \\
32+
\therefore x_{n + 1} - x_n &= u_n \Delta t \\
33+
\therefore x_{n + 1} &= x_n + u_n \Delta t
3434
\end{align*}
3535
$$
3636

3737
他も同様にすると、次のようになります。
3838

3939
$$
4040
\begin{align*}
41-
x_{n + 1} &= x_n + {v_x}_n \Delta t \\
42-
y_{n + 1} &= y_n + {v_y}_n \Delta t \\
43-
{v_x}_{n + 1} &= {v_x}_n \\
44-
{v_y}_{n + 1} &= {v_y}_n - g\Delta t
41+
x_{n + 1} &= x_n + u_n \Delta t \\
42+
y_{n + 1} &= y_n + v_n \Delta t \\
43+
u_{n + 1} &= u_n \\
44+
v_{n + 1} &= v_n - g\Delta t
4545
\end{align*}
4646
$$
4747

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
11
{
2-
"nbformat": 4,
3-
"nbformat_minor": 2,
4-
"metadata": {},
5-
"cells": [
6-
{
7-
"metadata": {},
8-
"source": [
9-
"import math"
10-
],
11-
"cell_type": "code",
12-
"outputs": [],
13-
"execution_count": null
14-
},
15-
{
16-
"metadata": {},
17-
"source": [
18-
"g = 9.8\n",
19-
"\n",
20-
"\n",
21-
"def parabolic_motion_step(x, y, vx, vy, dt):\n",
22-
" x = x + vx * dt\n",
23-
" y = y + vy * dt\n",
24-
" vx = vx\n",
25-
" vy = vy - g * dt\n",
26-
" return [x, y, vx, vy]\n",
27-
"\n",
28-
"\n",
29-
"def parabolic_motion(v0, theta, t, dt):\n",
30-
" x = 0\n",
31-
" y = 0\n",
32-
" vx = v0 * math.cos(theta)\n",
33-
" vy = v0 * math.sin(theta)\n",
34-
" n = int(t / dt)\n",
35-
" for i in range(n):\n",
36-
" x, y, vx, vy = parabolic_motion_step(x, y, vx, vy, dt)\n",
37-
" return [x, y]\n",
38-
"\n",
39-
"\n",
40-
"print(parabolic_motion(30, math.pi / 4, 4, 0.01))"
41-
],
42-
"cell_type": "code",
43-
"outputs": [
2+
"nbformat": 4,
3+
"nbformat_minor": 2,
4+
"metadata": {},
5+
"cells": [
446
{
45-
"output_type": "stream",
46-
"name": "stdout",
47-
"text": [
48-
"[84.85281374238573, 6.648813742385697]\n"
49-
]
7+
"metadata": {},
8+
"source": [
9+
"import math"
10+
],
11+
"cell_type": "code",
12+
"outputs": [],
13+
"execution_count": null
14+
},
15+
{
16+
"metadata": {},
17+
"source": [
18+
"g = 9.8\n",
19+
"\n",
20+
"\n",
21+
"def parabolic_motion_step(x, y, u, v, dt):\n",
22+
" x = x + u * dt\n",
23+
" y = y + v * dt\n",
24+
" u = u\n",
25+
" v = v - g * dt\n",
26+
" return [x, y, u, v]\n",
27+
"\n",
28+
"\n",
29+
"def parabolic_motion(v0, theta, t, dt):\n",
30+
" x = 0\n",
31+
" y = 0\n",
32+
" u = v0 * math.cos(theta)\n",
33+
" v = v0 * math.sin(theta)\n",
34+
" n = int(t / dt)\n",
35+
" for i in range(n):\n",
36+
" x, y, u, v = parabolic_motion_step(x, y, u, v, dt)\n",
37+
" return [x, y]\n",
38+
"\n",
39+
"\n",
40+
"print(parabolic_motion(30, math.pi / 4, 4, 0.01))"
41+
],
42+
"cell_type": "code",
43+
"outputs": [
44+
{
45+
"output_type": "stream",
46+
"name": "stdout",
47+
"text": [
48+
"[84.85281374238573, 6.648813742385697]\n"
49+
]
50+
}
51+
],
52+
"execution_count": null
5053
}
51-
],
52-
"execution_count": null
53-
}
54-
]
54+
]
5555
}

static/simulation/parabolic_motion_return_array.ipynb

Lines changed: 57 additions & 57 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)