(* 放物型偏微分方程式の練習   2005/10/24  aito *)

(* 場合1 初期分布が正弦波状 *)

f0[x_] := Sin[x * Pi]/;0<=x <= 1

Plot[f0[x], {x, 0, 1}]

[Graphics:HTMLFiles/ExDeqs_5.gif]

- Graphics -

deq0 = D[u[x, t], t] == D[u[x, t], {x, 2}] ;

cond1 = u[x, 0] == f0[x] ;

cond2 = u[0, t] == 0 ;

cond3 = u[1, t] == 0 ;

solution0 = NDSolve[{deq0, cond1, cond2, cond3}, u, {x, 0, 1}, {t, 0, 0.5}] ;

Plot3D[Evaluate[u[x, t]/.First[solution0]], {x, 0, 1}, {t, 0, 0.25}, PlotRange -> All]

[Graphics:HTMLFiles/ExDeqs_13.gif]

- SurfaceGraphics -

ContourPlot[Evaluate[u[x, t]/.First[solution0]], {x, 0, 1}, {t, 0, 0.2}, PlotRange -> All, ColorFunction -> Hue]

[Graphics:HTMLFiles/ExDeqs_16.gif]

- ContourGraphics -

(* 場合2 : 初期分布が直線 *)

f1[x_] := x/;0<=x <= 0.5

f1[x_] := 1 - x/;0.5<x <= 1

Plot[f1[x], {x, 0, 1}]

[Graphics:HTMLFiles/ExDeqs_22.gif]

- Graphics -

deq1 = D[u[x, t], t] == D[u[x, t], {x, 2}] ;

cond1 = u[x, 0] == f1[x] ;

cond2 = u[0, t] == 0 ;

cond3 = u[1, t] == 0 ;

solution1 = NDSolve[{deq1, cond1, cond2, cond3}, u, {x, 0, 1}, {t, 0, 0.5}] ;

NDSolve :: mxsst : MaxPointsまたはMinStepSizeオプションで独立変数xに対して許容される最大グリッド点数10000が使用されます.  詳細

Plot3D[Evaluate[u[x, t]/.First[solution1]], {x, 0, 1}, {t, 0, 0.25}, PlotRange -> All]

[Graphics:HTMLFiles/ExDeqs_31.gif]

- SurfaceGraphics -

ContourPlot[Evaluate[u[x, t]/.First[solution1]], {x, 0, 1}, {t, 0, 0.2}, PlotRange -> All, ColorFunction -> Hue]

[Graphics:HTMLFiles/ExDeqs_34.gif]

- ContourGraphics -


Created by Mathematica  (October 24, 2005) Valid XHTML 1.1!