Hello Bryan,
I forwarded my notebook to a friend who has a more recent version of Mathematica, and he too, doesn't get the same pictures as I do. Seems there indeed is something wrong.
However, he pointed out that your differential equation in the NDSolve-statement might be overdetermined. In principle, you have twice the statement containing xmax.....
You should delete one of them and try your code again.
I have no idea why my version (Mathematica 7) works properly and also with one of these conditions deleted.
Your original form was
Params:
m = 1;
k = 1;
\[Omega] = Sqrt[m^2 + k^2];
xmax = 1000;
giving the function f0
sol = \[Phi] /. NDSolve[
{-D[\[Phi][t, x], {t, 2}] + D[\[Phi][t, x], {x, 2}] -
m^2*\[Phi][t, x] == 0, \[Phi][t, -xmax] ==
Exp[-I*k*xmax - I*\[Omega]*t],
\[Phi][t, xmax] == Exp[I*k*xmax - I*\[Omega]*t],
\[Phi][0, x] == Exp[I*k*x],
Derivative[1, 0][\[Phi]][0, x] == -I*\[Omega]*Exp[I*k*x]},
\[Phi], {t, 0, 2}, {x, -xmax, xmax}][[1, 1]];
f0 = sol
In shorter form (one of the xmax-conditions deleted)
Clear[sol];
sol = \[Phi] /. NDSolve[
{-D[\[Phi][t, x], {t, 2}] + D[\[Phi][t, x], {x, 2}] -
m^2*\[Phi][t, x] == 0,
\[Phi][t, xmax] == Exp[I*k*xmax - I*\[Omega]*t],
\[Phi][0, x] == Exp[I*k*x],
Derivative[1, 0][\[Phi]][0, x] == -I*\[Omega]*Exp[I*k*x]},
\[Phi], {t, 0, 2}, {x, -xmax, xmax}][[1, 1]];
f1 = sol
with function f1 as a result.
However, there exists a symbolic solution.
Your differential equation reads
deq[f_] := -D[f, t, t] + D[f, x, x] - m^2 f
I found a symbolic solution ff
ff = (1/2 (E^(-I Sqrt[a^2 + m^2] t) + E^(I Sqrt[a^2 + m^2] t)) C[1] +
1/2 I (E^(-I Sqrt[a^2 + m^2] t) - E^(I Sqrt[a^2 + m^2] t)) C[
2]) (E^(I a x) K[1] + E^(-I a x) K[2]);
Indeed
deq[ff] // FullSimplify
(* 0 *)
Adjusting the constants, you get function ff1, which fulfills (almost) all your conditions:
ff /. t -> 0
rr1 = {K[1] -> 1, K[2] -> 0, C[1] -> 1,
C[2] -> -I \[Omega] /Sqrt[k^2 + m^2], a -> k}
ff1 = ff /. rr1
ff1 /. t -> 0
\[Phi][0, x] == Exp[I*k*x]
and
D[ff1, t] /. t -> 0
-I*\[Omega]*Exp[I*k*x]
Finally, fix k and m
ff1 /. {k -> 1, m -> 1}
and you will see that the two numerical solutions obtained above and the symbolic solution are identical. Plot all three functions together for different tmes and regions (try the Im-parts as well)
Manipulate[
Plot[
{Re@f0[tt, xx], Re@f1[tt, xx], Re@ff1 /. {t -> tt, x -> xx}},
{xx, -10, 10},
PlotStyle -> {{Dashing[.1], Thickness[.01], Black},
Blue, {Dashing[.05], Thick, Red}}
],
{tt, 0, 2}
]
I take this as a sign that NDSolve (on my system) works properly. What is happening with yours?
I attach the latest notebook as well if you consider sending it to Wolfram support.
Attachments: