For a given PDE, uniqueness of the solution requires boundary/initial conditions, the exact type of conditions depending on the particular PDE under consideration. For example consider the wave equation in 2 dimensions:

$u_{tt}(t,x)=c^2 u_{xx}(t,x)$

where $c>0$, we take $x\in[0,L]$ with $L>0$ and $t>0$. Then for instance we get a unique solution if we specify the functions $u(0,x)$, $u_t(0,x)$, $u(t,0)$ and $u(t,L)$ (with special care to choose these functions consistently). Mathematica behaves as expected in this case (i.e. it gives me a solution and no error/warnings).

However, if I don't specify part of the boundary conditions, say I don't fix the value of $u(t,L)$, then Mathematica gives no error (nor warning) and gives a solution for $u(t,x)$.

How is this possible? We don't expect such problems to have a unique solution, so is Mathematica implicitly choosing the missing boundary condition? Or is Mathematica using a property of numerical solutions to PDE that I am missing?


With all the boundary conditions:

  Derivative[2, 0][u][t, x] == 2 Derivative[0, 2][u][t, x], 
  u[0, x] == 0, 
  Derivative[1, 0][u][0, x] == 1, 
  u[t, 0] == Sin[t], 
  u[t, 5] == (1/3) Sin[3 t]}, 
 u, {t, 0, 10}, {x, 0, 5}]

The same as above but with one boundary condition dropped:

  Derivative[2, 0][u][t, x] == 2 Derivative[0, 2][u][t, x], 
  u[0, x] == 0, 
  Derivative[1, 0][u][0, x] == 1, 
  u[t, 0] == Sin[t]},
  u, {t, 0, 10}, {x, 0, 5}]
  • 5
    $\begingroup$ Please give the code for an example so that others can easily confirm what you are saying. $\endgroup$
    – C. E.
    Mar 30, 2017 at 14:29
  • $\begingroup$ I'd be happy to, but copy/pasting Mathematica code in code environment gives the full input form which is hardly readable. How to proceed? $\endgroup$
    – arovai
    Mar 30, 2017 at 14:59
  • $\begingroup$ Make the code as simple as possible (choose the most simple PDE etc., the wave equation should be fine) and then post that. We can demand nothing more. $\endgroup$
    – C. E.
    Mar 30, 2017 at 15:04
  • $\begingroup$ The code is very simple. But it is the copy/paste procedure that produces extra things. I tried all the options for the copy command in Mathematica (copy as plain text, copy as input, ...) it always gives nasty things. For instance, ∂ gives PartialD and so on. $\endgroup$
    – arovai
    Mar 30, 2017 at 15:15
  • 1
    $\begingroup$ The way to copy code properly is introduced in this post. Then, I should say I'm surprised that in this case the bcart warning doesn't pop up, I've included this in the previous question, thanks for pointing out. $\endgroup$
    – xzczd
    Mar 31, 2017 at 3:44

1 Answer 1



c = 1;
pde = {D[u[t, x], t, t] == c^2 D[u[t, x], x, x]};    

ics = {u[0, x] == 0, Derivative[1, 0][u][0, x] == 1};    

bcs1 = {u[t, 0] == Sin[t], u[t, 5] == 1/3 Sin[3*t]};    

bcAll1 = Flatten[{ics, bcs1}, 1];    

sol1 = NDSolve[{pde, bcAll1}, {u}, {t, 0, 10}, {x, 0, 5}];

When you drop out one of the boundary condition, NDSolve artificially choose one for it. Now the real question is, what type of bc that could be? To this, I do not know the answer.

The same type of question has been asked here, but with no real answer.

You have left out this u[t, 5] == 1/3 Sin[3*t] and interestingly, NDSolve solve the pde without any warning, while making an artificial replacement for it.

bcs2 = {u[t, 0] == Sin[t]};

bcAll2 = Flatten[{ics, bcs2}, 1];

sol2 = NDSolve[{pde, bcAll2}, {u}, {t, 0, 10}, {x, 0, 5}];

Not the answer you're looking for? Browse other questions tagged or ask your own question.