# NDSolve outcome depends on system size?

I tried to solve a simple wave equation numerically and plot the result within the time range t=0...1. Now when I change the tmax in the NDSolve the outcome of my plot (I don't change anything else besides tmax in NDSolve) changes. Here is my code:

TL = 1 - Exp[-10 #1] &;
TR = 0 &;
TP = NDSolveValue[{D[Tp[t, x], x, x] - D[Tp[t, x], t, t] == 0,
Tp[t, 0] == TL[t], Tp[t, 1] == TR[t], Tp[0, x] == 0},
Tp, {t, 0, 10}, {x, 0, 1}];
Plot[TP[t, 1/2], {t, 0, 1}, PlotRange -> All]


For example if I compare the plots for tmax=10 and for a very drastic case e.g. tmax=300 there even occurs a sign change in the plot. I read the NDSolve section of the mathematica manual and played around with the precision and accuracygoal but they did not affect my solution. How can I fix this?

• The variable on the LHS is "TP" and the one on the RHS is "Tp" and mathematica variables are case sensitive?! Originally I had $\tau$p as variable but the problem is the same. Apr 23, 2019 at 20:19
• You only give one initial condition to NDSolve, please notice this is a serious problem. (Actually you'll get ivone warniing in or before v9. ) Why does v10 or higher solve the problem without warning? Because FiniteElement is added, and it actually uses zero Neumann value at the right boundary of $t$ i.e. end of time as the boundary condition (b.c.), so it's not surprising at all that the solution changes. What's more, in this case NDSolve is solving a pure boundary value problem of wave equation, which is a well known ill-posed problem. So, in a word, please add the other b.c.. Apr 24, 2019 at 5:57

You will need to add at least a time derivative initial condition for Tp (a second initial condition) as otherwise this will be solved as a pure 2D spatial problem. Using t as a time variable is not sufficient to tell NDSolve that this is supposed to be a time dependent problem.

So something along the lines of:

  TL = 1 - Exp[-10 #1] &;
TR = 0 &;
TP = NDSolveValue[{D[Tp[t, x], x, x] - D[Tp[t, x], t, t] == 0,
Tp[t, 0] == TL[t], Tp[t, 1] == TR[t], Tp[0, x] == 0,
Derivative[1, 0][Tp][0, x] == (D[TL[t], t] /. t -> 0)},
Tp, {t, 0, 10}, {x, 0, 1}];


The above gives a message that BCs are not consistent. I'll let you think about that.