1

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?

Michael E2
  • 235,386
  • 17
  • 334
  • 747
Thiago
  • 311
  • 1
  • 9

0 Answers0