I am solving the 1-d wave equation with the following initial conditions:
weqn = D[u[t, x], {t, 2}] == D[u[t, x], {x, 2}];
icn = {u[0, x] == Cos[x], Derivative[1, 0][u][0, x] == 0};
DSolveValue[{weqn, icn}, u[t, x], {t, x}]
The solution, as expected, is simply
1/2 (Cos[t - x] + Cos[t + x])
It is well known that these two solutions correspond to waves propagating to the right and to the left, respectively.
Now I want to solve the same equation with the same b.c.
tmin = 0; tmax = 10; xmin = -15; xmax = 15;
NDSolve[{weqn, icn}, u, {t, tmin, tmax}, {x, xmin, xmax}]
Mathematica solves the equation and gives the following warning
Warning: an insufficient number of boundary conditions have been specified for the
direction of independent variable x. Artificial boundary effects may be present in
the solution
In this simple case, I know the analytical solution and can pick, say, the solution that represents the wave propagating to the right.
Is there any way to make Mathematica pick that particular solution?
icn = {u[0, x] == Cos[x], Derivative[1, 0][u][0, x] == Sin[x]};– LouisB May 09 '19 at 02:47