5
$\begingroup$

Perhaps this is somehow related to the post: Numerical solution to PDE seems to contradict initial values

but still it may be useful.

Consider this code (I am using Mathematica 10.4):

sol := NDSolve[{
    D[e[x, t], x] == I u[x, t],
    D[u[x, t], t] == -u[x, t] + I e[x, t] + I s[x, t],
    D[s[x, t], t] == I u[x, t],
    s[x, 0] == 0, u[x, 0] == 0, e[0, t] == 1
    }, {e, u, s}, {x, 0, 1}, {t, 0, 1}] // Flatten

psol[x_, t_] = u[x, t] /. sol;
ssol[x_, t_] = s[x, t] /. sol;
esol[x_, t_] = e[x, t] /. sol;

Plot[Abs[psol[x, 0]], {x, 0, 1}]
Plot[Abs[ssol[t, 1]], {t, 0, 1}]
Plot[Abs[esol[t, 1]], {t, 0, 1}]

If you only rename the variables, e.g. replace u[x, t] by p[x, t], the result of the execution changes.

$\endgroup$
  • 1
    $\begingroup$ I think this might be caused by the same behavior that's discussed here. It happens in your context because the solution is probably not numerically unique and the variable ordering affects which of the possible solutions is chosen. I tried renaming the function u to p and found what you describe. But if I rename u to z (which maintains the lexicographical order of the variables), the result is not changed. $\endgroup$ – Jens Sep 2 '16 at 17:32
  • 2
    $\begingroup$ @Jens You suspicion is supported by the fact that the solution changes depending on whether the name comes before or after s alphabetically. $\endgroup$ – Szabolcs Sep 2 '16 at 17:34
  • $\begingroup$ @Jens I see you updated your comment too. $\endgroup$ – Szabolcs Sep 2 '16 at 17:34
  • 5
    $\begingroup$ This has nothing to do with Simplify; this is a know issue documented here and in this (duplicate) question. The problem is that I do not have a reliable way to detect this and warn about it. Once I come up with something it will be implemented. $\endgroup$ – user21 Sep 2 '16 at 17:54