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?
NDSolve
, please notice this is a serious problem. (Actually you'll getivone
warniing in or before v9. ) Why does v10 or higher solve the problem without warning? BecauseFiniteElement
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 caseNDSolve
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.. $\endgroup$