引き延ばされた糸の振動を調べる
波動方程式を使って,引き延ばされた糸の振動を調べる.
In[1]:=
![Click for copyable input](assets.ja/study-the-vibrations-of-a-stretched-string/In_77.png)
weqn = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}];
振動中に糸の両端が固定されたままであるように指定する.
In[2]:=
![Click for copyable input](assets.ja/study-the-vibrations-of-a-stretched-string/In_78.png)
bc = {u[0, t] == 0, u[\[Pi], t] == 0};
糸のさまざまな位置における初期値を与える.
In[3]:=
![Click for copyable input](assets.ja/study-the-vibrations-of-a-stretched-string/In_79.png)
ic = {u[x, 0] == x^2 (\[Pi] - x),
\!\(\*SuperscriptBox[\(u\),
TagBox[
RowBox[{"(",
RowBox[{"0", ",", "1"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, 0] == 0};
初期境界値問題を解く.
In[4]:=
![Click for copyable input](assets.ja/study-the-vibrations-of-a-stretched-string/In_80.png)
dsol = DSolve[{weqn, bc, ic}, u, {x, t}] /. {K[1] -> m}
Out[4]=
![](assets.ja/study-the-vibrations-of-a-stretched-string/O_36.png)
Inactiveの和から4項を取り出す.
In[5]:=
![Click for copyable input](assets.ja/study-the-vibrations-of-a-stretched-string/In_81.png)
asol[x_, t_] = u[x, t] /. dsol[[1]] /. {\[Infinity] -> 4} // Activate
Out[5]=
![](assets.ja/study-the-vibrations-of-a-stretched-string/O_37.png)
和のそれぞれの項は定常波を表す.
In[6]:=
![Click for copyable input](assets.ja/study-the-vibrations-of-a-stretched-string/In_82.png)
Table[Show[
Plot[Table[asol[x, t][[m]], {t, 0, 4}] // Evaluate, {x, 0, Pi},
Ticks -> False], ImageSize -> 150], {m, 4}]
Out[6]=
![](assets.ja/study-the-vibrations-of-a-stretched-string/O_38.png)
糸の振動を可視化する.
In[7]:=
![Click for copyable input](assets.ja/study-the-vibrations-of-a-stretched-string/In_83.png)
Animate[Plot[asol[x, t], {x, 0, \[Pi]}, PlotRange -> {-5, 5},
ImageSize -> Medium, PlotStyle -> Red], {t, 0, 2 Pi},
SaveDefinitions -> True]
![](assets.ja/study-the-vibrations-of-a-stretched-string/swf_4.png)