3

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?

Examples:

With all the boundary conditions:

NDSolve[{
  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:

NDSolve[{
  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}]
xzczd
  • 65,995
  • 9
  • 163
  • 468
arovai
  • 131
  • 2
  • 5
    Please give the code for an example so that others can easily confirm what you are saying. – C. E. Mar 30 '17 at 14:29
  • 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? – arovai Mar 30 '17 at 14:59
  • 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. – C. E. Mar 30 '17 at 15:04
  • 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. – arovai Mar 30 '17 at 15:15
  • @Bru That's ok then, you can post the simplest code that you know how to produce here on this site and we can help you simplify it if possible. There is a tool to automatically replace glyph codes like \[PartialD] with their corresponding characters, like ∂, here on the site. Many users have it installed. You can find it here. – C. E. Mar 30 '17 at 15:18
  • The result is useless and ugly. How to install the tool you mention? Any useful link? – arovai Mar 30 '17 at 15:23
  • @Bru The link is in my last comment. However, things like TagBox, RowBox etc. are not things that it can handle. But this is not at all useless to me, when I copy this code into Mathematica I get well-formatted code that I can run and experiment with. Thank you for adding this to the question, hopefully it will increase people's willingness to try to answer. That is the idea. – C. E. Mar 30 '17 at 18:10
  • 1
    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. – xzczd Mar 31 '17 at 03:44

1 Answers1

1

Comment

ClearAll["Global`*"];    
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}];
zhk
  • 11,939
  • 1
  • 22
  • 38