物理量の固有関数/メモ のバックアップ(No.1)

更新


ハミルトニアン

演習:箱の中の自由粒子 = 実フーリエ級数

LANG:mathematica
c[n_Integer] =
  Integrate[
    Sqrt[2] Sin[n Pi xx] If[xx < 1/2, xx, -1 + xx],
    {xx, 0, 1}
  ]
approx = 
  Table[
    Sum[
      c[n] Sqrt[2] Sin[n Pi x],
      {n, 1, nmax}
    ],
    {nmax, {4, 16, 64, 256}}
];
Plot[
  {approx, If[x < 1/2, x, -1 + x]} // Flatten // Evaluate,
  {x, 0, 1}, ImageSize -> Large, PlotStyle -> {Thick}, 
  BaseStyle -> {FontSize -> 20}, 
  PlotLegends -> (Style[#, FontSize -> 20] & /@ { 
    "n \[LessEqual] 4", "n \[LessEqual] 16", "n \[LessEqual] 64", "n \[LessEqual] 256", 
    "Target"})
]

Counter: 3982 (from 2010/06/03), today: 1, yesterday: 0